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

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,51 @@
using System;
using System.Data.SqlClient;
using System.Linq;
using System.Text.RegularExpressions;
using SvetoforVKBot.Models.Updates;
using VkNet;
using VkNet.Model.RequestParams;
namespace SvetoforVKBot.Models.Commands.Registration
{
public class SelectDRMonthCommand : Command
{
public override string Name => "{\"button\":\"selectDRMonth-";
public override void Execute(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
{
}
public override void ExecutePL(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
{
MessagesSendParams @params = new MessagesSendParams();
var chatId = update.@object.message.from_id;
Regex regex = new Regex("[^0-9]");
try
{
string[] payload = update.@object.message.payload.Split('-');
int curYear = Convert.ToInt32(regex.Replace(payload[1], ""));
int curMonth = Convert.ToInt32(regex.Replace(payload[2], ""));
var user = db.Users.Single(usr => usr.chatId == chatId);
user.tag = "Подписчик - Регистрация - ДР - Число";
db.SaveChanges();
DateTime dt = new DateTime(curYear, curMonth, 1);
ShowCalendar showCalendar = new ShowCalendar();
showCalendar.Execute(update, client, db, dt);
}
catch (Exception ee)
{
@params.Message = "‼Ошибка в SelectStudentDRMonthCommand: " + ee.Message;
@params.Attachments = null;
@params.Keyboard = null;
@params.UserId = 59111081;
@params.RandomId = GetRandomId();
client.Messages.SendAsync(@params);
}
}
}
}