Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EmailServiceManager"/> class.
        /// </summary>
        /// <param name="configuration">An instance of <see cref="IConfiguration"/>.</param>
        /// <param name="repositoryFactory">An instance of <see cref="IRepositoryFactory"/>.</param>
        /// <param name="cloudStorageClient">An instance of <see cref="ICloudStorageClient"/>.</param>
        /// <param name="logger">Instance of Logger.</param>
        /// <param name="notificationProviderFactory">An instance of <see cref="INotificationProviderFactory"/>.</param>
        /// <param name="emailManager">An instance of <see cref="IEmailManager"/>.</param>
        public EmailServiceManager(
            IConfiguration configuration,
            IRepositoryFactory repositoryFactory,
            ICloudStorageClient cloudStorageClient,
            ILogger logger,
            INotificationProviderFactory notificationProviderFactory,
            IEmailManager emailManager)
        {
            this.repositoryFactory           = repositoryFactory;
            this.configuration               = configuration;
            this.emailNotificationRepository = repositoryFactory.GetRepository(Enum.TryParse <StorageType>(this.configuration?[Constants.StorageType], out this.repo) ? this.repo : throw new Exception());
            this.cloudStorageClient          = cloudStorageClient;
            this.logger = logger;
            this.notificationProvider = notificationProviderFactory.GetNotificationProvider(Enum.TryParse <NotificationProviderType>(this.configuration?[Constants.NotificationProviderType], out this.provider) ? this.provider : throw new Exception());
            if (this.configuration?["MailSettings"] != null)
            {
                this.mailSettings = JsonConvert.DeserializeObject <List <MailSettings> >(this.configuration?["MailSettings"]);
            }

            this.emailManager = emailManager;
        }
Beispiel #2
0
 public FailureWhenSendingEmailDocumentDeletedNotification(
     ILogger <FailureWhenSendingEmailDocumentDeletedNotification> logger,
     INotificationProviderFactory notificationProviderFactory
     ) : base(logger, notificationProviderFactory.CreateDocumentDeletedSuccessFullyButProblemSendingEmailNotification())
 {
 }
Beispiel #3
0
 public SendNotificationDocumentCreated(
     ILogger <SendNotificationDocumentCreated> logger,
     INotificationProviderFactory notificationProviderFactory
     ) : base(logger, notificationProviderFactory.CreateDocumentCreatedSuccessFullyNotification())
 {
 }
Beispiel #4
0
 /// <summary>
 /// Instantiate the <see cref="NotificationBuilder"/>
 /// </summary>
 /// <param name="services"></param>
 /// <param name="providerFactory"></param>
 public NotificationBuilder(IServiceCollection services, INotificationProviderFactory providerFactory)
 {
     Services        = services;
     ProviderFactory = providerFactory;
 }
Beispiel #5
0
 public FailureWhenDeletingDocumentFromStorageNotification(
     ILogger <FailureWhenDeletingDocumentFromStorageNotification> logger,
     INotificationProviderFactory notificationProviderFactory
     ) : base(logger, notificationProviderFactory.CreateDocumentHasNotBeenDeletedDueToTechnicalErrorNotification())
 {
 }
Beispiel #6
0
 public FailureWhenAddingDocumentToDbNotification(
     ILogger <FailureWhenAddingDocumentToDbNotification> logger,
     INotificationProviderFactory notificationProviderFactory
     ) : base(logger, notificationProviderFactory.CreateDocumentHasNotBeenCreatedDueToTechnicalErrorNotification())
 {
 }
Beispiel #7
0
 /// <summary>
 /// Instantiate the <see cref="Notification"/>
 /// </summary>
 /// <param name="logger">The logger object</param>
 /// <param name="providerFactory">The factory for the notification providers</param>
 public Notification(ILogger <Notification> logger, INotificationProviderFactory providerFactory)
 {
     _logger          = logger;
     _providerFactory = providerFactory;
 }