upd Authentification
This commit is contained in:
@@ -53,7 +53,7 @@ namespace SvetoforVKBot.Models.Commands.Admin
|
||||
//--
|
||||
var user = db.Users.Single(usr => usr.chatId == 59111081);
|
||||
int id = user.id;
|
||||
string fio = user.fio;
|
||||
//string fio = user.fio;
|
||||
var birthday = user.birthday;
|
||||
var jsPhones = JsonConvert.DeserializeObject<List<string>>(user.phone);
|
||||
int choosenTrack = user.track;
|
||||
|
||||
@@ -38,12 +38,16 @@ namespace SvetoforVKBot.Models.Commands.ExpertLK
|
||||
|
||||
var user = db.Users.Single(usr => usr.id == userId);
|
||||
int uChatId = Convert.ToInt32(user.chatId);
|
||||
string fio = user.fio;
|
||||
|
||||
var idsVk = new long[] { uChatId };
|
||||
var userVk = client.Users.Get(idsVk);
|
||||
|
||||
//string fio = user.fio;
|
||||
var birthday = user.birthday;
|
||||
var jsPhones = JsonConvert.DeserializeObject<List<string>>(user.phone);
|
||||
|
||||
@params.Message = "Участник:\n\n" +
|
||||
fio + "\n" +
|
||||
userVk[0].FirstName + " " + userVk[0].LastName + "\n" +
|
||||
"Дата рождения: " + birthday.ToShortDateString() + "\n" +
|
||||
"Телефон: " + jsPhones[0];
|
||||
|
||||
|
||||
@@ -37,27 +37,19 @@ namespace SvetoforVKBot.Models.Commands.ExpertLK
|
||||
string[] payload = update.@object.message.payload.Split('-');
|
||||
int userId = Convert.ToInt32(regex.Replace(payload[1], ""));
|
||||
//@params.Message = "Выберите участника.\n";
|
||||
|
||||
|
||||
|
||||
var user = db.Users.Single(usr => usr.id == userId);
|
||||
int uChatId = user.chatId;
|
||||
string fio = user.fio;
|
||||
|
||||
var idsVk = new long[] { uChatId };
|
||||
var userVk = client.Users.Get(idsVk);
|
||||
|
||||
user.personal = 1;
|
||||
db.Entry(db.PersonalConsultations.Where(el => el.chatId == uChatId)).Property("state").CurrentValue = 2;
|
||||
db.SaveChanges();
|
||||
|
||||
//SqlCommand updTag = new SqlCommand("UPDATE Users SET personal = @personal WHERE chatId = @chatId;", Con);
|
||||
//updTag.Parameters.AddWithValue("@chatId", uChatId);
|
||||
//updTag.Parameters.AddWithValue("@personal", 1);
|
||||
//updTag.ExecuteNonQuery();
|
||||
|
||||
//SqlCommand updState = new SqlCommand("UPDATE PersonalConsultation SET state = @state WHERE chatId = @chatId;", Con);
|
||||
//updState.Parameters.AddWithValue("@chatId", uChatId);
|
||||
//updState.Parameters.AddWithValue("@state", 2);
|
||||
//updState.ExecuteNonQuery();
|
||||
|
||||
@params.Message = "✅Персональный режим для участника " + fio + " включен";
|
||||
@params.Message = "✅Персональный режим для участника " + userVk[0].FirstName + " " + userVk[0].LastName + " включен";
|
||||
|
||||
keyboardBuilder
|
||||
//.AddButton("Вкл. персональный режим", "selectPersonalPlan-", KeyboardButtonColor.Positive)
|
||||
|
||||
@@ -36,6 +36,9 @@ namespace SvetoforVKBot.Models.Commands.LK.Consultation
|
||||
List<int> ids = new List<int>();
|
||||
try
|
||||
{
|
||||
var idsVk = new long[] { chatId };
|
||||
var userVk = client.Users.Get(idsVk);
|
||||
|
||||
if (db.PersonalConsultations.Where(c => c.chatId == chatId).Count() > 0)
|
||||
{
|
||||
@params.Message = "Ваша заявка уже на рассмотрении. Чтобы вернуться назад, нажмите кнопку \"Личный кабинет\".";
|
||||
@@ -69,7 +72,7 @@ namespace SvetoforVKBot.Models.Commands.LK.Consultation
|
||||
|
||||
@params.Message = "📌Ваша заявка:\n\n";
|
||||
|
||||
msg = "ФИО: " + user.fio +
|
||||
msg = "Имя: " + userVk[0].FirstName + " " + userVk[0].LastName + "\n" +
|
||||
"\n" +
|
||||
"Телефон: " + jsPhones[0] +
|
||||
"\n" +
|
||||
@@ -94,7 +97,7 @@ namespace SvetoforVKBot.Models.Commands.LK.Consultation
|
||||
Thread.Sleep(1000);
|
||||
|
||||
@params2.Message = "✅Новая заявка на консультацию:\n\n" +
|
||||
"ФИО: " + user.fio +
|
||||
"Имя: " + userVk[0].FirstName + " " + userVk[0].LastName + "\n" +
|
||||
"\n" +
|
||||
"Телефон: " + jsPhones[0] +
|
||||
"\n" +
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace SvetoforVKBot.Models.Commands.LK.EditData
|
||||
var ids = new long[] { chatId };
|
||||
|
||||
var user = db.Users.Single(usr => usr.chatId == chatId);
|
||||
user.fio = update.@object.message.text.Trim();
|
||||
//user.fio = update.@object.message.text.Trim();
|
||||
user.tag = "Личный кабинет - Данные";
|
||||
db.SaveChanges();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace SvetoforVKBot.Models.Commands.LK
|
||||
int height = user.height;
|
||||
int gender = user.gender;
|
||||
int notifyCount = user.notifyCount;
|
||||
string fio = user.fio;
|
||||
//string fio = user.fio;
|
||||
var jsPhones = JsonConvert.DeserializeObject<List<string>>(user.phone);
|
||||
var birthday = user.birthday;
|
||||
int track = user.track;
|
||||
@@ -74,7 +74,7 @@ namespace SvetoforVKBot.Models.Commands.LK
|
||||
.AddButton("📐Рост: " + height, "selectEditData-2", KeyboardButtonColor.Primary)
|
||||
.AddLine()
|
||||
.AddButton("🔔Уведомления", "selectEditData-3", KeyboardButtonColor.Primary)
|
||||
.AddButton("✏ФИО", "selectEditData-4", KeyboardButtonColor.Primary)
|
||||
//.AddButton("✏ФИО", "selectEditData-4", KeyboardButtonColor.Primary)
|
||||
.AddLine()
|
||||
.AddButton("📅Дата рождения", "selectEditData-5", KeyboardButtonColor.Primary)
|
||||
.AddButton("📞Телефон", "selectEditData-6", KeyboardButtonColor.Primary)
|
||||
@@ -116,8 +116,6 @@ namespace SvetoforVKBot.Models.Commands.LK
|
||||
|
||||
@params.Message = "РЕДАКТИРОВАНИЕ ДАННЫХ" +
|
||||
"\n\n" +
|
||||
"ФИО: " + fio +
|
||||
"\n" +
|
||||
"Телефон: " + jsPhones[0] +
|
||||
"\n" +
|
||||
"Дата рождения: " + birthday.ToShortDateString() +
|
||||
@@ -190,7 +188,7 @@ namespace SvetoforVKBot.Models.Commands.LK
|
||||
int height = user.height;
|
||||
int gender = user.gender;
|
||||
int notifyCount = user.notifyCount;
|
||||
string fio = user.fio;
|
||||
//string fio = user.fio;
|
||||
var jsPhones = JsonConvert.DeserializeObject<List<string>>(user.phone);
|
||||
var birthday = user.birthday;
|
||||
int track = user.track;
|
||||
@@ -251,8 +249,6 @@ namespace SvetoforVKBot.Models.Commands.LK
|
||||
|
||||
@params.Message = "РЕДАКТИРОВАНИЕ ДАННЫХ" +
|
||||
"\n\n" +
|
||||
"ФИО: " + fio +
|
||||
"\n" +
|
||||
"Телефон: " + jsPhones[0] +
|
||||
"\n" +
|
||||
"Дата рождения: " + birthday.ToShortDateString() +
|
||||
|
||||
@@ -40,8 +40,6 @@ namespace SvetoforVKBot.Models.Commands.LK
|
||||
user.colorId = 0;
|
||||
db.SaveChanges();
|
||||
|
||||
msg += user.fio + "\n\n";
|
||||
|
||||
if ((DateTime.Now.Month >= user.birthday.Month) && (DateTime.Now.Day >= user.birthday.Day))
|
||||
age = DateTime.Now.Year - user.birthday.Year;
|
||||
else
|
||||
|
||||
@@ -38,20 +38,6 @@ namespace SvetoforVKBot.Models.Commands.LK.SportsLK
|
||||
user.colorId = 0;
|
||||
db.SaveChanges();
|
||||
|
||||
//SqlCommand getUser = new SqlCommand("SELECT * FROM Users WHERE chatId = @chatId;", Con);
|
||||
//getUser.Parameters.AddWithValue("@chatId", chatId);
|
||||
//SqlDataReader rgetUser = getUser.ExecuteReader();
|
||||
//rgetUser.Read();
|
||||
//string fio = rgetUser["fio"].ToString();
|
||||
//int weight = Convert.ToInt32(rgetUser["weight"]);
|
||||
//int height = Convert.ToInt32(rgetUser["height"]);
|
||||
//int gender = Convert.ToInt32(rgetUser["gender"]);
|
||||
//var birthday = DateTime.Parse(rgetUser["birthday"].ToString());
|
||||
//int kkal = Convert.ToInt32(rgetUser["kkal"]);
|
||||
//rgetUser.Close();
|
||||
|
||||
msg += user.fio + "\n\n";
|
||||
|
||||
age = (DateTime.Today.Year - user.birthday.Year);
|
||||
|
||||
if (user.gender == 1)
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace SvetoforVKBot.Models.Commands.Registration
|
||||
var ids = new long[] { chatId };
|
||||
|
||||
var user = db.Users.Single(usr => usr.chatId == chatId);
|
||||
user.fio = update.@object.message.text.Trim();
|
||||
user.tag = "Подписчик - Регистрация - ДР - Год";
|
||||
db.SaveChanges();
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using SvetoforVKBot.Models.Updates;
|
||||
using VkNet;
|
||||
using VkNet.Enums.SafetyEnums;
|
||||
using VkNet.Model.Keyboard;
|
||||
using VkNet.Model.RequestParams;
|
||||
using System.Linq;
|
||||
using SvetoforVKBot.Services;
|
||||
|
||||
namespace SvetoforVKBot.Models.Commands.Registration
|
||||
{
|
||||
public class GetLoginCommand
|
||||
{
|
||||
public void Execute(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
|
||||
{
|
||||
var chatId = update.@object.message.from_id;
|
||||
MessagesSendParams @params = new MessagesSendParams();
|
||||
var keyboardBuilder = new KeyboardBuilder().Clear();
|
||||
|
||||
try
|
||||
{
|
||||
if (update.@object.message.text.Length > 0 && update.@object.message.text.Length <= 50)
|
||||
{
|
||||
var ids = new long[] { chatId };
|
||||
string login = update.@object.message.text.Trim();
|
||||
string message = "";
|
||||
var user = db.Users.Single(usr => usr.chatId == chatId);
|
||||
string pincode = PasswordService.GeneratePassword();
|
||||
string hash = PasswordService.CreateMD5(pincode + chatId.ToString());
|
||||
message = $"Ваш код подтверждения: {pincode}";
|
||||
|
||||
|
||||
keyboardBuilder
|
||||
.AddButton("Отменить", "startPL", KeyboardButtonColor.Default);
|
||||
@params.Keyboard = keyboardBuilder.Build();
|
||||
@params.Message = "На Вашу корпоративную почту отправлено письмо с кодом подтверждения.\n" +
|
||||
"Введите код в ответ на данное сообщение, чтобы завершить авторизацию.";
|
||||
@params.UserId = chatId;
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
|
||||
user.login = login;
|
||||
user.password = hash;
|
||||
user.tag = "Подписчик - Регистрация - Код";
|
||||
db.SaveChanges();
|
||||
|
||||
EmailService emailService = new EmailService();
|
||||
emailService.SendEmailAsync($"{login}@vyatsu.ru", "Код подтверждения", message);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@params.Message = "Данные введены некорректно 😕 Напишите, пожалуйста, текст длиной до 50 символов.";
|
||||
@params.UserId = chatId;
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
}
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
@params.Message = "‼Ошибка в GetFIOCommand: " + ee.Message;
|
||||
@params.Attachments = null;
|
||||
@params.Keyboard = null;
|
||||
@params.UserId = 59111081;
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly RandomNumberGenerator Rng = RandomNumberGenerator.Create();
|
||||
public int GetRandomId()
|
||||
{
|
||||
var intBytes = new byte[4];
|
||||
|
||||
Rng.GetBytes(intBytes);
|
||||
|
||||
return BitConverter.ToInt32(intBytes, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
108
SvetoforVKBot/Models/Commands/Registration/GetPincodeCommand.cs
Normal file
108
SvetoforVKBot/Models/Commands/Registration/GetPincodeCommand.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using SvetoforVKBot.Models.Updates;
|
||||
using VkNet;
|
||||
using VkNet.Enums.SafetyEnums;
|
||||
using VkNet.Model.Keyboard;
|
||||
using VkNet.Model.RequestParams;
|
||||
using System.Linq;
|
||||
using SvetoforVKBot.Services;
|
||||
using SvetoforVKBot.Models.Commands.LK;
|
||||
|
||||
namespace SvetoforVKBot.Models.Commands.Registration
|
||||
{
|
||||
public class GetPincodeCommand
|
||||
{
|
||||
public void Execute(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
|
||||
{
|
||||
var chatId = update.@object.message.from_id;
|
||||
MessagesSendParams @params = new MessagesSendParams();
|
||||
var keyboardBuilder = new KeyboardBuilder().Clear();
|
||||
|
||||
try
|
||||
{
|
||||
if (update.@object.message.text.Length > 0 && update.@object.message.text.Length <= 50)
|
||||
{
|
||||
var ids = new long[] { chatId };
|
||||
string pincode = update.@object.message.text.Trim();
|
||||
var user = db.Users.Single(usr => usr.chatId == chatId);
|
||||
|
||||
string hashCheck = PasswordService.CreateMD5(pincode + chatId.ToString());
|
||||
|
||||
if (user.password.Equals(hashCheck))
|
||||
{
|
||||
user.isAuthorized = 1;
|
||||
user.tag = "Подписчик - Регистрация - Пол";
|
||||
db.SaveChanges();
|
||||
|
||||
if (user.reg == 1)
|
||||
{
|
||||
ShowLKCommand showLK = new ShowLKCommand();
|
||||
showLK.Execute(update, client, db);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
keyboardBuilder
|
||||
.AddButton("М", "selectGender-1", KeyboardButtonColor.Primary)
|
||||
.AddButton("Ж", "selectGender-2", KeyboardButtonColor.Primary)
|
||||
.AddLine()
|
||||
.AddButton("Отменить", "startPL", KeyboardButtonColor.Default);
|
||||
|
||||
@params.Keyboard = keyboardBuilder.Build();
|
||||
@params.UserId = chatId;
|
||||
@params.Message = //1 шаг из 4.
|
||||
"✅ Авторизация прошла успешно.\n" +
|
||||
"Выберите на клавиатуре внизу или напишите пол в формате \"М\" или \"Ж\"";
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
keyboardBuilder
|
||||
.AddButton("Отменить", "startPL", KeyboardButtonColor.Default);
|
||||
|
||||
@params.Keyboard = keyboardBuilder.Build();
|
||||
@params.Message = "Вы ввели неверный код подтверждения. Попробуйте ещё раз.";
|
||||
@params.UserId = chatId;
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@params.Message = "Данные введены некорректно 😕 Напишите, пожалуйста, текст длиной до 50 символов.";
|
||||
@params.UserId = chatId;
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
}
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
@params.Message = "‼Ошибка в GetFIOCommand: " + ee.Message;
|
||||
@params.Attachments = null;
|
||||
@params.Keyboard = null;
|
||||
@params.UserId = 59111081;
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly RandomNumberGenerator Rng = RandomNumberGenerator.Create();
|
||||
public int GetRandomId()
|
||||
{
|
||||
var intBytes = new byte[4];
|
||||
|
||||
Rng.GetBytes(intBytes);
|
||||
|
||||
return BitConverter.ToInt32(intBytes, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,44 +34,11 @@ namespace SvetoforVKBot.Models.Commands.Registration
|
||||
{
|
||||
var user = db.Users.Single(usr => usr.chatId == chatId);
|
||||
|
||||
List<MediaAttachment> listDoc = new List<MediaAttachment>()
|
||||
user.tag = "Подписчик - Регистрация - Авторизация";
|
||||
db.SaveChanges();
|
||||
|
||||
if (user.isAuthorized == 0)
|
||||
{
|
||||
new Document() { Id = 602601883, OwnerId = 59111081 } //59111081_600676073
|
||||
};
|
||||
|
||||
if (user.agree == 0)
|
||||
{
|
||||
switch (user.child)
|
||||
{
|
||||
case 0:
|
||||
@params.Message = "Вам уже исполнилось 18 лет? Исходя из возраста, мы сформируем для Вас подходящий документ " +
|
||||
"согласия на обработку персональных данных.\n\n" +
|
||||
"Нажмите кнопку на специальной клавиатуре👇";
|
||||
|
||||
keyboardBuilder
|
||||
.AddButton("Да", "selectChildAge-2", KeyboardButtonColor.Positive)
|
||||
.AddButton("Нет", "selectChildAge-1", KeyboardButtonColor.Negative)
|
||||
.AddLine()
|
||||
.AddButton("Назад", "startPL", KeyboardButtonColor.Default);
|
||||
|
||||
@params.Keyboard = keyboardBuilder.Build();
|
||||
@params.UserId = chatId;
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
return;
|
||||
|
||||
default:
|
||||
SelectAgreementCommand selectAgreement = new SelectAgreementCommand();
|
||||
selectAgreement.ExecutePL(update, client, db);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
user.tag = "Подписчик - Регистрация - Пол";
|
||||
db.SaveChanges();
|
||||
|
||||
keyboardBuilder
|
||||
.AddButton("М", "selectGender-1", KeyboardButtonColor.Primary)
|
||||
.AddButton("Ж", "selectGender-2", KeyboardButtonColor.Primary)
|
||||
@@ -81,10 +48,12 @@ namespace SvetoforVKBot.Models.Commands.Registration
|
||||
@params.Keyboard = keyboardBuilder.Build();
|
||||
@params.UserId = chatId;
|
||||
@params.Message = //1 шаг из 4.
|
||||
"Выберите на клавиатуре внизу или напишите пол в формате \"М\" или \"Ж\"";
|
||||
"Для продолжения необходимо авторизоваться. Введите Ваш логин, ипользуемый на портале ВятГУ.\n" +
|
||||
"Например, stud0000";
|
||||
@params.RandomId = GetRandomId();
|
||||
client.Messages.SendAsync(@params);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace SvetoforVKBot.Models.Commands.Registration
|
||||
{
|
||||
var user = db.Users.Single(usr => usr.chatId == chatId);
|
||||
user.tag = "Регистрация - Возраст";
|
||||
user.fio = user.firstName + " " + user.lastName;
|
||||
//user.fio = user.firstName + " " + user.lastName;
|
||||
db.SaveChanges();
|
||||
|
||||
@params.Message = "2 шаг из 4. Напиши возраст одним числом, например, 19. \n";
|
||||
|
||||
@@ -15,6 +15,7 @@ using SvetoforVKBot.Models.Commands.LK;
|
||||
using SvetoforVKBot.Models.Commands.LK.SportsLK;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using SvetoforVKBot.Models.Commands.Registration;
|
||||
|
||||
namespace SvetoforVKBot.Models.Commands
|
||||
{
|
||||
@@ -36,89 +37,7 @@ namespace SvetoforVKBot.Models.Commands
|
||||
var user = client.Users.Get(ids, ProfileFields.Sex);
|
||||
var gender = Convert.ToInt32(user[0].Sex);
|
||||
var listButtons = new List<ReadOnlyCollection<MessageKeyboardButton>>();
|
||||
Uri URL = new Uri("https://www.vyatsu.ru/");
|
||||
#region UTM
|
||||
/*
|
||||
utm = update.@object.message.@ref;
|
||||
|
||||
if (utm != "" && utm != null)
|
||||
{
|
||||
if (int.TryParse(utm, out int refer))
|
||||
{
|
||||
if (refer != chatId)
|
||||
{
|
||||
int referId = 1;
|
||||
|
||||
//Проверяем приглашали ли этого пользователя раннее
|
||||
getUser = new SqlCommand("SELECT referId FROM Users WHERE chatId = @chatId;", Con);
|
||||
getUser.Parameters.AddWithValue("@chatId", chatId);
|
||||
rgetUser = getUser.ExecuteReader();
|
||||
rgetUser.Read();
|
||||
int uReferId = Convert.ToInt32(rgetUser["referId"]);
|
||||
rgetUser.Close();
|
||||
|
||||
if (uReferId == 0) // 0 - не приглашали
|
||||
{
|
||||
//Ищем пользователя, который пригласил
|
||||
SqlCommand getRefer = new SqlCommand("SELECT chatId FROM Users WHERE chatId = @refer;", Con);
|
||||
getRefer.Parameters.AddWithValue("@refer", refer);
|
||||
SqlDataReader rgetRefer = getRefer.ExecuteReader();
|
||||
if (rgetRefer.HasRows) // если пользователь существует
|
||||
{
|
||||
rgetRefer.Close();
|
||||
|
||||
SqlCommand updReferId = new SqlCommand("UPDATE Users SET referId = @referId WHERE chatId = @chatId;", Con);
|
||||
updReferId.Parameters.AddWithValue("@chatId", chatId);
|
||||
updReferId.Parameters.AddWithValue("@referId", refer);
|
||||
updReferId.ExecuteNonQuery();
|
||||
|
||||
selectQuestRoom.ExecutePL(update, client, Con);
|
||||
return;
|
||||
}
|
||||
else
|
||||
rgetRefer.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
selectQuestRoom.ExecutePL(update, client, Con);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
selectQuestRoom.ExecutePL(update, client, Con);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SourceUpdate sourceUpdate = new SourceUpdate();
|
||||
sourceUpdate.Execute(update, client, Con);
|
||||
|
||||
switch (utm)
|
||||
{
|
||||
case "afisha":
|
||||
SelectEventsCommand selectEvents = new SelectEventsCommand();
|
||||
selectEvents.ExecutePL(update, client, Con);
|
||||
return;
|
||||
|
||||
case "quest":
|
||||
selectQuestRoom.ExecutePL(update, client, Con);
|
||||
return;
|
||||
|
||||
case "project":
|
||||
SelectProjectOfficeCommand selectProjectOffice = new SelectProjectOfficeCommand();
|
||||
selectProjectOffice.ExecutePL(update, client, Con);
|
||||
return;
|
||||
|
||||
case "faq":
|
||||
SelectOSCommand selectOS = new SelectOSCommand();
|
||||
selectOS.ExecutePL(update, client, Con);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
#endregion UTM
|
||||
Uri URL = new Uri("https://www.vyatsu.ru/");
|
||||
|
||||
var getUser = db.Users.Single(usr => usr.chatId == chatId);
|
||||
int reg = getUser.reg;
|
||||
@@ -130,17 +49,15 @@ namespace SvetoforVKBot.Models.Commands
|
||||
switch (reg)
|
||||
{
|
||||
case 1:
|
||||
if (activityKind == 2 || activityKind == 3)
|
||||
if (getUser.isAuthorized == 1)
|
||||
{
|
||||
ShowLKCommand showLK = new ShowLKCommand();
|
||||
showLK.Execute(update, client, db);
|
||||
}
|
||||
else // спортсмены
|
||||
else
|
||||
{
|
||||
ShowLKCommand showLK = new ShowLKCommand();
|
||||
showLK.Execute(update, client, db);
|
||||
//ShowSportsLKCommand showSportsLK = new ShowSportsLKCommand();
|
||||
//showSportsLK.Execute(update, client, Con);
|
||||
SelectParticipateCommand selectParticipate = new SelectParticipateCommand();
|
||||
selectParticipate.ExecutePL(update, client, db);
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
@@ -40,6 +40,16 @@ namespace SvetoforVKBot.Models.Dop
|
||||
getGender.Execute(update, client, db);
|
||||
return;
|
||||
|
||||
case "Подписчик - Регистрация - Авторизация":
|
||||
GetLoginCommand getLogin = new GetLoginCommand();
|
||||
getLogin.Execute(update, client, db);
|
||||
return;
|
||||
|
||||
case "Подписчик - Регистрация - Код":
|
||||
GetPincodeCommand getPincode = new GetPincodeCommand();
|
||||
getPincode.Execute(update, client, db);
|
||||
return;
|
||||
|
||||
case "Регистрация - Корпус":
|
||||
GetKorpusCommand getKorpus = new GetKorpusCommand();
|
||||
getKorpus.Execute(update, client, db);
|
||||
|
||||
@@ -28,16 +28,16 @@ namespace SvetoforVKBot.Models.Dop
|
||||
var checkUser = db.Users.FirstOrDefault(u => u.chatId == chatId);
|
||||
if(checkUser!=null)
|
||||
{
|
||||
checkUser.firstName = firstName;
|
||||
checkUser.lastName = lastName;
|
||||
//checkUser.firstName = firstName;
|
||||
//checkUser.lastName = lastName;
|
||||
}
|
||||
else
|
||||
{
|
||||
db.Users.Add(new Data.Users()
|
||||
{
|
||||
chatId = chatId,
|
||||
firstName = firstName,
|
||||
lastName = lastName,
|
||||
//firstName = firstName,
|
||||
//lastName = lastName,
|
||||
sourse = JsonConvert.SerializeObject(new Sourses()
|
||||
{
|
||||
sourses = new List<Sourse>() { new Sourse() { name = "main", dateTime = DateTime.Now } }
|
||||
|
||||
Reference in New Issue
Block a user