Пример #1
0
        public IActionResult LogOff()
        {
            var user = _userManager.GetUser();

            _sessionProvider.CloseSession(user.SessionId);
            _userManager.RemoveUser();

            return(RedirectToLocal(null));
        }
        private void CheckEmails(object state)
        {
            _logger.Info("Checking for notifications");
            try
            {
                lock (this)
                {
                    if (_processing)
                    {
                        _logger.Info("Throtling");

                        return;
                    }

                    _processing = true;
                }

                _logger.Trace("Opening session");
                //Open session
                _sessionProvider.OpenSession();
                _logger.Trace("Opened session");

                //Get errors
                var pendingNotifications = _emailNotificationRepository.GetPending();

                //Process emails
                SendNotifications(pendingNotifications);

                _logger.Trace("Commiting");

                //Close session
                _sessionProvider.CloseSession();

                _logger.Trace("Commited");
            }
            catch (Exception e)
            {
                _logger.Fatal(e);
                throw;
            }
            finally
            {
                lock (this)
                {
                    _processing = false;
                }
            }
        }