Пример #1
0
        private void AddMoreTimeMenuHandler(Update update, UserState userState)
        {
            long chatId = _updateHelper.GetChatId(update);


            if (update.Message.Text == "/cancel")
            {
                if (userState == UserState.InAddMoreTimeInTheRoom)
                {
                    _menuLoader.LoadStateMenu(chatId, UserState.InTheRoom);
                }
                else
                {
                    _menuLoader.LoadStateMenu(chatId, UserState.InQueue);
                }

                return;
            }

            int timeMinutes;

            int.TryParse(update.Message.Text, out timeMinutes);
            if (timeMinutes != 0 && timeMinutes < _config.Value.TimeLimitMinutes)
            {
                _room.AddMoreTime(chatId, timeMinutes);
                if (userState == UserState.InAddMoreTimeInTheRoom)
                {
                    _menuLoader.LoadStateMenu(chatId, UserState.InTheRoom);
                }
                else
                {
                    _menuLoader.LoadStateMenu(chatId, UserState.InQueue);
                }
            }
            else
            {
                if (timeMinutes == 0)
                {
                    //_menuLoader.SendText(chatId, NumberNotParsed);
                    _notificationRouter.RouteNotification(new NotificationItem(chatId, NotificationType.Send, NumberNotParsed));
                }
                else
                {
                    _notificationRouter.RouteNotification(new NotificationItem(chatId, NotificationType.Send, NumberOverLimit));
                    //_menuLoader.SendText(chatId, NumberOverLimit);
                }
                _menuLoader.LoadStateMenu(chatId, userState);
            }
        }