//readonly ConcurrentQueue<MimeMessageContainer> _emailQ = new ConcurrentQueue<MimeMessageContainer>();

        #endregion

        #region constructor

        /// <summary>
        /// Initializes a new instance of the <see cref="EmailDispatcher"/> class using the specified parameter.
        /// </summary>
        /// <param name="emailClient">An object used to send e-mails.</param>
        /// <param name="emailSettingsProvider">An object used to obtain and refresh the e-mail configuration settings.</param>
        /// <param name="logger">An object used for logging.</param>
        /// <param name="options">The options to use for the current <see cref="IEmailDispatcher"/>.</param>
        /// <param name="sysEventRepo">The system event repository.</param>
        /// <param name="appSettingsRepo">The application settings repository.</param>
        /// <param name="sysLogger">The system event logger.</param>
        /// <param name="hubContext">The SignalR hub context.</param>
        public EmailDispatcher(IEmailClientService emailClient
                               , ILogger <EmailDispatcher> logger
                               , IOptions <MessageDispatchOptions> options
                               , IRepository <SysEventLog> sysEventRepo
                               , IRepository <AppSetting> appSettingsRepo
                               , ISysEventLogger sysLogger
                               , IHubContext <NotificationHub, INotificationHub> hubContext) : base(logger, options)
        {
            if (Instance != null)
            {
                throw new InvalidOperationException($"No more than one instance is allowed for the singleton {nameof(EmailDispatcher)} service.");
            }

            Instance = this;

            _emailClient     = emailClient;
            _sysRepo         = sysEventRepo;
            _appSettingsRepo = appSettingsRepo;
            _sysLogger       = sysLogger;
            _hubContext      = hubContext;

            SetEventHandlers()
            .Execute() // ensures that unsent e-mails stored in the database are requeued
            .StartTimer();
        }
Пример #2
0
 public DashboardController(UserManager <AppUser> userManager
                            , ApplicationDbContext appDbContext
                            , IOptions <IdentityInitializerSettings> identitySettings
                            , IHttpContextAccessor httpContextAccessor
                            , ISysEventLogger sysLogger)
     : base(appDbContext, identitySettings, httpContextAccessor, sysLogger)
 {
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataControllerBase"/> class.
 /// </summary>
 /// <param name="userManager">The user manager.</param>
 /// <param name="dbContext">The application database context.</param>
 /// <param name="identitySettings"></param>
 protected DataControllerBase(UserManager <AppUser> userManager
                              , ApplicationDbContext dbContext
                              , IOptions <IdentityInitializerSettings> identitySettings
                              , IHttpContextAccessor httpContextAccessor
                              , ISysEventLogger sysLog) : base(dbContext, identitySettings, httpContextAccessor, sysLog)
 {
     UserManager = userManager;
 }
 public TicketsController(ApplicationDbContext appDbContext
                          , IOptions <IdentityInitializerSettings> identitySettings
                          , IHttpContextAccessor httpContextAccessor
                          , ISysEventLogger sysLogger
                          , IIssueEmailProducer emailProducer)
     : base(appDbContext, identitySettings, httpContextAccessor, sysLogger)
 {
     _emailProducer = emailProducer;
 }
Пример #5
0
 public AdminController(UserManager <AppUser> userManager
                        , ApplicationDbContext appDbContext
                        , IOptions <IdentityInitializerSettings> identitySettings
                        , IHttpContextAccessor httpContextAccessor
                        , IMapper mapper
                        , ISysEventLogger sysEventRegister
                        , IMessageProducer notifier
                        )
     : base(userManager, appDbContext, identitySettings, httpContextAccessor, sysEventRegister)
 {
     _mapper   = mapper;
     _notifier = notifier;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="HelpDeskControllerBase"/> class using the specified parameters.
        /// </summary>
        /// <param name="dbContext">The database context used.</param>
        /// <param name="httpContextAccessor">An object used to access the current user's claims principal.</param>
        protected HelpDeskControllerBase(ApplicationDbContext dbContext, IOptions <IdentityInitializerSettings> identitySettings, IHttpContextAccessor httpContextAccessor, ISysEventLogger sysLogger)
        {
            Db               = dbContext;
            EventLogger      = sysLogger;
            IdentitySettings = identitySettings.Value;
            _caller          = httpContextAccessor.HttpContext.User;

            CurrentThread.CurrentCulture   = FrenchCulture;
            CurrentThread.CurrentUICulture = FrenchCulture;

            Db.SysEvent        += Db_SysEvent;
            EventLogger.Logged += AfterEventLoggedAsync;
        }
 public AuthController(UserManager <AppUser> userManager
                       , IJwtFactory jwtFactory
                       , IOptions <JwtIssuerOptions> jwtOptions
                       , ApplicationDbContext appDbContext
                       , IOptions <IdentityInitializerSettings> identitySettings
                       , IHttpContextAccessor httpContextAccessor
                       , ISysEventLogger sysEventRegister
                       , IMessageProducer notifier)
     : base(userManager, appDbContext, identitySettings, httpContextAccessor, sysEventRegister)
 {
     _jwtFactory = jwtFactory;
     _jwtOptions = jwtOptions.Value;
     _notifier   = notifier;
 }
Пример #8
0
 public AccountsController(IEmailClientService emailClient
                           , IEmailConfigurationProvider emailClientSettingsFactory
                           , UserManager <AppUser> userManager
                           , ApplicationDbContext dbContext
                           , IMapper mapper
                           , IOptions <IdentityInitializerSettings> identitySettings
                           , IHttpContextAccessor httpContextAccessor
                           , ISysEventLogger sysLog
                           , IViewRenderService templateViewRender
                           , IHostingEnvironment hostingEnvironment)
     : base(userManager, dbContext, identitySettings, httpContextAccessor, sysLog)
 {
     _mapper                     = mapper;
     _templateViewRender         = templateViewRender;
     _hostingEnvironment         = hostingEnvironment;
     _emailClient                = emailClient;
     _emailClientSettingsFactory = emailClientSettingsFactory;
 }