Добавьте файлы проекта.

This commit is contained in:
Daria
2021-10-19 06:04:52 +03:00
parent 6ee25d0f59
commit eab3081ec2
187 changed files with 100839 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
using Newtonsoft.Json;
using SvetoforVKBot.Models.Commands.LK;
using SvetoforVKBot.Models.Updates;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.SqlClient;
using System.Linq;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Threading;
using VkNet;
using VkNet.Enums.SafetyEnums;
using VkNet.Model.Attachments;
using VkNet.Model.Keyboard;
using VkNet.Model.RequestParams;
namespace SvetoforVKBot.Models.Commands.Water
{
public class SelectOffWaterNotifyCommand : Command
{
public override string Name => "{\"button\":\"selectOffWaterNotify\"}";
public override void ExecutePL(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
{
var chatId = update.@object.message.from_id;
MessagesSendParams @params = new MessagesSendParams();
var keyboardBuilder = new KeyboardBuilder().Clear();
List<UserObject> users = new List<UserObject>();
List<int> chatIds = new List<int>();
string name = "";
try
{
var user = db.Users.Single(usr => usr.chatId == chatId);
user.waterNotify = 0;
db.SaveChanges();
@params.Message = "Напоминания отключены.\n" +
"Настроить напоминания можно в Личном кабинете, в разделе \"📝Редактировать данные\".";
keyboardBuilder
.AddButton("Личный кабинет", "startPL", KeyboardButtonColor.Primary)
.SetInline();
@params.Keyboard = keyboardBuilder.Build();
@params.UserId = chatId;
@params.RandomId = GetRandomId();
client.Messages.SendAsync(@params);
//Thread.Sleep(1500);
//SelectEditDataCommand selectEditData = new SelectEditDataCommand();
//selectEditData.Execute(update, client, Con);
//return;
}
catch (Exception ee)
{
@params.Message = "Ошибка в SelectOffWaterNotifyCommand: " + ee.Message;
@params.Attachments = null;
@params.Keyboard = null;
@params.UserId = 59111081;
@params.RandomId = GetRandomId();
client.Messages.SendAsync(@params);
}
}
public override void Execute(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
{
}
}
}