private string LoadSimpleSubscribedMenuText()
        {
            string menuText = _localizationHelper.GetLocalizedString(StringToLocalize.SimpleSubscribedMenuText);//_config.Value.SimpleMenuTexts.SimpleSubscribedMenuText;//.MenuTexts.VisitDurationMenuText;

            //text assembly
            return(menuText);
        }
Beispiel #2
0
        }                                           //= "Add yourself some time to cover both the person in the room and yourself.";

        public SessionRouter(IUpdateHelper updateHelper,
                             IMenuLoader menuLoader,
                             ILogger <SessionRouter> logger,
                             IRoomService room,
                             IUsersService users,
                             IBotService botService,
                             IOptions <BotConfiguration> config,
                             ILockTrackerService lockTrackerService,
                             ILogHelper logHelper,
                             INotificationRouter notificationRouter,
                             ILocalizationHelper localizationHelper)
        {
            _menuLoader         = menuLoader;
            _config             = config;
            _logHelper          = logHelper;
            _updateHelper       = updateHelper;
            _notificationRouter = notificationRouter;
            _localizationHelper = localizationHelper;
            _users              = users;
            _logger             = logger;
            _room               = room;
            _botService         = botService;
            _lockTrackerService = lockTrackerService;

            CommandNotRecognized    = _localizationHelper.GetLocalizedString(StringToLocalize.CommandNotRecognized);
            NumberOverLimit         = _localizationHelper.GetLocalizedString(StringToLocalize.NumberOverLimit);
            NumberNotParsed         = _localizationHelper.GetLocalizedString(StringToLocalize.NumberNotParsed);
            doorIsLockedInstruction = _localizationHelper.GetLocalizedString(StringToLocalize.doorIsLockedInstruction);
        }
Beispiel #3
0
        }                                        //"Command wasn't recognized. Please try again.";
        public SimpleSessionRouter(IUpdateHelper updateHelper,
                                   IMenuLoader menuLoader,

                                   IRoomService room,
                                   IUsersService users,
                                   IBotService botService,

                                   ILockTrackerService lockTrackerService,
                                   ILogHelper logHelper,
                                   INotificationRouter notificationRouter,
                                   ILocalizationHelper localizationHelper)
        {
            _menuLoader = menuLoader;

            _logHelper = logHelper;

            _updateHelper       = updateHelper;
            _notificationRouter = notificationRouter;

            _users = users;

            _room                = room;
            _botService          = botService;
            _lockTrackerService  = lockTrackerService;
            _localizationHelper  = localizationHelper;
            CommandNotRecognized = _localizationHelper.GetLocalizedString(StringToLocalize.CommandNotRecognized);
        }
 public int Enqueue(long id, int timeMinutes = 5)
 {
     QueueList.Add(new QueueSlot(id, timeMinutes));
     if (QueueList.Count - 1 > 0)
     {
         string notificationText = _localizationHelper.GetLocalizedString(StringToLocalize.EnqueueAlert)
                                   .Replace("[QUEUEPOS]", (QueueList.Count - 1).ToString())
                                   .Replace("[WAITTIME]", GetTimeToWait(id).ToString());
         AlertSubscriber(id, notificationText);
         return(QueueList.Count - 1);
     }
     else
     {
         //var t = Task.Run(() => ProcessUserInBetweenQueueAndRoom());
         ProcessUserInBetweenQueueAndRoom();
         return(0);
     }
 }
 public async Task Invoke(HttpContext context, ILocalizationHelper localizationHelper)
 {
     try
     {
         await _next(context);
     }
     catch (AspirinException aspirinException)
     {
         var logLevel = GetLevel(aspirinException.StatusCode);
         _logger.Write(logLevel, aspirinException, "AspirinException occured with message {AspirinMessage}", aspirinException.Message);
         await ClearResponseAndBuildErrorDto(context, aspirinException.StatusCode, new List <string> {
             aspirinException.Message
         }).ConfigureAwait(false);
     }
     catch (ValidationException validationException)
     {
         var messages = new List <string>();
         if (validationException.Errors.Any())
         {
             messages.AddRange(validationException.Errors.Select(i => i.ErrorMessage));
         }
         else
         {
             messages.Add(validationException.Message);
         }
         _logger.Warning("Validation failed with messages {@ValidationMessages}", messages);
         await ClearResponseAndBuildErrorDto(context, StatusCodes.Status400BadRequest, messages).ConfigureAwait(false);
     }
     catch (Exception exception)
     {
         var logger = GetErrorLogger(context);
         logger.Error(exception, "Internal Server Error!");
         await ClearResponseAndBuildErrorDto(context, StatusCodes.Status500InternalServerError, new List <string> {
             localizationHelper.GetLocalizedString("InternalServerError")
         }).ConfigureAwait(false);
     }
 }
        public string LoadMainMenuText()
        {
            string menuText = _localizationHelper.GetLocalizedString(StringToLocalize.MainMenuText);//_config.Value.MenuTexts.MainMenuText;

            //text assembly
            return(menuText);
        }
Beispiel #7
0
        public string LoadMainMenuText()
        {
            string menuText =
                _localizationHelper.GetLocalizedString(StringToLocalize.MainMenuText) +
                _localizationHelper.GetLocalizedString(StringToLocalize.MainMenuCommands);

            //text assembly
            return(menuText);
        }