Exemple #1
0
        public static async void ChooseTripColumn(int userId, string message)
        {
            try
            {
                var keyCommands = new Dictionary <string, string>();
                keyCommands.Add("Место отправки", AdminCommandStep.DeparturePlace.ToString());
                keyCommands.Add("Дата отправки", AdminCommandStep.DepartureDate.ToString());
                keyCommands.Add("Время отправки", AdminCommandStep.DepartureTime.ToString());
                keyCommands.Add("Место прибытия", AdminCommandStep.ArrivalPlace.ToString());
                keyCommands.Add("Дата прибытия", AdminCommandStep.ArrivalDate.ToString());
                keyCommands.Add("Время прибытия", AdminCommandStep.ArrivalTime.ToString());

                if (keyCommands.ContainsKey(message))
                {
                    keyCommands.TryGetValue(message, out var resMessage);
                    DataBaseContextAdmin.SetColumn(userId, resMessage);
                    await BotController.Bot.SendTextMessageAsync(userId, "Введите новое значение.",
                                                                 replyMarkup : KeyboardContainer.CreateTwoKeyboardAdminButtons());

                    DataBaseContextAdmin.SetCommandId(userId, (int)AdminCommandStep.EditTripColumn);
                }
                else if (message == "Назад")
                {
                    await BotController.Bot.SendTextMessageAsync(userId, "Введите ID рейса для редактирования.",
                                                                 replyMarkup : KeyboardContainer.CreateTwoKeyboardAdminButtons());

                    DataBaseContextAdmin.SetCommandId(userId, (int)AdminCommandStep.SetTripIdEdit);
                }
                else if (message == "Отмена")
                {
                    Undo(userId);
                }
                else
                {
                    await BotController.Bot.SendTextMessageAsync(userId, "Выберите, что будете редактировать.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }