public async Task CommandHandler_BuisnessRegistrationKorporativ(long chatid, string message, MessageEventArgs messageObject) { if (provider.userService == null) { await client.SendTextMessageAsync(chatid, "strange"); } int currentStep = await provider.userService.GetCurrentActionStep(chatid); UserDTO user = await provider.userService.FindById(chatid); DronDTO dron = new DronDTO(); if (currentStep == 1) { if (user == null) { await provider.userService.AuthenticateUser(chatid); } user.FIO = message; await provider.userService.Update(user); await provider.userService.ChangeAction(chatid, "Корпоративная бизнесс-регистрация", ++currentStep); await client.SendTextMessageAsync(chatid, "Введите номер телефона"); return; } if (currentStep == 2) { if (RegularExpression.IsTelephoneCorrect(message)) { user.Phone = message; user.BuisnesPrivilag = 1; await provider.userService.Update(user); await provider.userService.ChangeAction(chatid, "NULL", 0); await client.SendTextMessageAsync(chatid, "Вы успешно зарегистрировались", 0, false, false, 0, KeyBoardHandler.Murkup_BuisnessmanMenu()); await provider.managerPush.SendMessage(client, chatid); return; } else { await client.SendTextMessageAsync(chatid, "Вы ввели некорректный телефон,попробуйте еще раз"); } } }
public async Task ReplenishAccount(MessageEventArgs messageObject) { string messageText = messageObject.Message.Text; long chatId = messageObject.Message.Chat.Id; int currStep = await provider.userService.GetCurrentActionStep(chatId); if (currStep == 1) { string cart = EasyPay.GetCart(); await client.SendTextMessageAsync(chatId, $"Внесите оплату на кошелек:{cart}\nПосле этого введите ваш номер чека"); await provider.userService.ChangeAction(chatId, "Пополнить баланс", ++currStep); return; } if (currStep == 2) { Regex isPayCorrect = new Regex(@"/^(\d){1,13}$/g"); if (isPayCorrect.IsMatch(messageText)) { int?sum = await EasyPay.IsPayCorrect(messageText); if (sum == null) { await client.SendTextMessageAsync(chatId, "Неправильный кошелек", 0, false, false, 0, KeyBoardHandler.Murkup_BuisnessmanMenu()); await provider.userService.ChangeAction(chatId, "NULL", 0); return; } UserDTO user = await provider.userService.FindById(chatId); user.balance = sum; await provider.userService.Update(user); await client.SendTextMessageAsync(chatId, "Вы успешно пополнили баланс", 0, false, false, 0, KeyBoardHandler.Murkup_BuisnessmanMenu()); } else { await client.SendTextMessageAsync(chatId, "Вы ввели некорректный формат чека", 0, false, false, 0, KeyBoardHandler.Murkup_BuisnessmanMenu()); await provider.userService.ChangeAction(chatId, "NULL", 0); return; } } }