Ejemplo n.º 1
0
        public static async void ChooseTripIdToEdit(int userId, string message)
        {
            try
            {
                var temp = message;
                if (message == "Назад")
                {
                    StartEditTimetable(userId);
                }
                else if (message == "Отмена")
                {
                    Undo(userId);
                }
                else if (!int.TryParse(temp, out var tempInt))
                {
                    await BotController.Bot.SendTextMessageAsync(userId, "Введите число, которое является ID рейса.");
                }
                else
                {
                    if (!DataBaseContextAdmin.CheckTripId(tempInt))
                    {
                        await BotController.Bot.SendTextMessageAsync(userId, "Введите существующий ID рейса.");
                    }
                    DataBaseContextAdmin.SetTripId(userId, tempInt);
                    await BotController.Bot.SendTextMessageAsync(userId, "Выберите, что будете редактировать.",
                                                                 replyMarkup : KeyboardContainer.CreateTimetableEditTripKeyboard());

                    DataBaseContextAdmin.SetCommandId(userId, (int)AdminCommandStep.ChooseTripColumn);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 2
0
 public static async void ChooseTripIdToDelete(int userId, string message)
 {
     try
     {
         var temp = message;
         if (message == "Назад")
         {
             StartEditTimetable(userId);
         }
         else if (message == "Отмена")
         {
             Undo(userId);
         }
         else if (!int.TryParse(temp, out var tempInt))
         {
             await BotController.Bot.SendTextMessageAsync(userId, "Введите число, которое является ID рейса.");
         }
         else if (!KeyWords.Contains(message))
         {
             if (!DataBaseContextAdmin.CheckTripId(tempInt))
             {
                 await BotController.Bot.SendTextMessageAsync(userId, "Введите существующий ID рейса.");
             }
             DataBaseContextAdmin.DeleteTrip(tempInt);
             StartEditTimetable(userId);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }