Exemplo n.º 1
0
 public DeleteMessageTemplateOverrideModelBinder(IMessageTemplateProvider messageTemplateProvider, Site site,
                                                 IKernel kernel)
     : base(kernel)
 {
     _messageTemplateProvider = messageTemplateProvider;
     _site = site;
 }
Exemplo n.º 2
0
        /// <summary>
        ///   Create instance of EmailService with specified providers
        /// </summary>
        /// <param name="mailProvider"></param>
        /// <param name="templateProvider"></param>
        /// <param name="emailTemplateConfiguration"></param>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="EmailSettingsException"></exception>
        public EmailService(IMailProvider mailProvider, IMessageTemplateProvider templateProvider,
                            IEmailTemplateConfiguration emailTemplateConfiguration)
        {
            _log = LogManager.GetLogger(GetType());

            if (mailProvider == null)
            {
                throw new ArgumentNullException(nameof(mailProvider));
            }
            if (emailTemplateConfiguration == null)
            {
                throw new ArgumentNullException(nameof(emailTemplateConfiguration));
            }
            _emailSettings = new Settings().EmailSettings;

            if (_emailSettings == null)
            {
                throw new EmailSettingsException();
            }

            _mailProvider               = mailProvider;
            _templateProvider           = templateProvider;
            _emailTemplateConfiguration = emailTemplateConfiguration;
            _engineService              = RazorEngineService.Create((ITemplateServiceConfiguration)_emailTemplateConfiguration);
        }
Exemplo n.º 3
0
 public MessageTemplatePreviewService(IMessageTemplateProvider messageTemplateProvider, Site site, IKernel kernel, ISession session)
 {
     _messageTemplateProvider = messageTemplateProvider;
     _site    = site;
     _kernel  = kernel;
     _session = session;
 }
 public DeleteMessageTemplateOverrideModelBinder(IMessageTemplateProvider messageTemplateProvider, Site site,
     IKernel kernel)
     : base(kernel)
 {
     _messageTemplateProvider = messageTemplateProvider;
     _site = site;
 }
Exemplo n.º 5
0
 public MessageTemplatePreviewService(IMessageTemplateProvider messageTemplateProvider, Site site, IKernel kernel, ISession session)
 {
     _messageTemplateProvider = messageTemplateProvider;
     _site = site;
     _kernel = kernel;
     _session = session;
 }
Exemplo n.º 6
0
 public MessageParser(IQueueMessage queueMessage, IMessageTemplateProvider messageTemplateProvider,
                      IMessageTemplateParser messageTemplateParser, Site site)
 {
     _queueMessage            = queueMessage;
     _messageTemplateProvider = messageTemplateProvider;
     _messageTemplateParser   = messageTemplateParser;
     _site = site;
 }
Exemplo n.º 7
0
        /// <summary>
        ///   Create instance of EmailService with specified providers
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="configuration"></param>
        /// <param name="mailProvider"></param>
        /// <param name="templateProvider"></param>
        /// <param name="emailTemplateConfiguration"></param>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="EmailSettingsException"></exception>
        public EmailService(ILogger <EmailService> logger, IConfiguration configuration, IMailProvider mailProvider,
                            IMessageTemplateProvider templateProvider, IEmailTemplateConfiguration emailTemplateConfiguration, IMessageProvider messageProvider)
        {
            _logger        = logger;
            _configuration = configuration;

            var section = _configuration.GetSection("gaia:emailSettings");

            //if (section?.Value == null)
            //{
            //	throw new EmailSettingsException();
            //}

            _emailSettings = new EmailSettings();
            section.Bind(_emailSettings);

            _mailProvider               = mailProvider ?? throw new ArgumentNullException(nameof(mailProvider));
            _templateProvider           = templateProvider ?? throw new ArgumentNullException(nameof(templateProvider));
            _emailTemplateConfiguration = emailTemplateConfiguration ?? throw new ArgumentNullException(nameof(emailTemplateConfiguration));
            _messageProvider            = messageProvider ?? throw new ArgumentNullException(nameof(messageProvider));
        }
Exemplo n.º 8
0
        public static bool IsTemplateDefault <T>(this HtmlHelper htmlHelper, T template) where T : MessageTemplate
        {
            if (template.SiteId.HasValue)
            {
                return(false);
            }

            IMessageTemplateProvider provider = htmlHelper.ViewContext.HttpContext.Get <IMessageTemplateProvider>();

            MessageTemplate messageTemplate = provider.GetNewMessageTemplate(typeof(T));

            return(template.IsHtml == messageTemplate.IsHtml &&
                   template.Bcc == messageTemplate.Bcc &&
                   template.Body == messageTemplate.Body &&
                   template.Cc == messageTemplate.Cc &&
                   template.FromAddress == messageTemplate.FromAddress &&
                   template.FromName == messageTemplate.FromName &&
                   template.Subject == messageTemplate.Subject &&
                   template.ToAddress == messageTemplate.ToAddress &&
                   template.ToName == messageTemplate.ToName);
        }
Exemplo n.º 9
0
 public MessageService(IMessageTemplateProvider templateProvider, IEmailService emailService, IApplicationSettings settings)
 {
     _templateProvider = templateProvider;
     _emailService     = emailService;
     _settings         = settings;
 }
Exemplo n.º 10
0
 public MailBodyBuilder(IMessageTemplateProvider templateProvider)
 {
     this.templateProvider = templateProvider;
 }
Exemplo n.º 11
0
 public MessageTemplateAdminService(IMessageTemplateProvider messageTemplateProvider, Site site, ISession session)
 {
     _messageTemplateProvider = messageTemplateProvider;
     _site    = site;
     _session = session;
 }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="messageTemplateProvider"></param>
 /// <param name="mapper"></param>
 public MessageTemplateController(IMessageTemplateProvider messageTemplateProvider, IMapper mapper) : base(mapper)
 {
     _messageTemplateProvider = messageTemplateProvider;
 }