Exemplo n.º 1
0
        public static void RegisterSystemEmail(Type model, Func <EmailTemplateEntity> defaultTemplateConstructor, object queryName = null)
        {
            if (defaultTemplateConstructor == null)
            {
                throw new ArgumentNullException("defaultTemplateConstructor");
            }

            systemEmails[model] = new SystemEmailInfo
            {
                DefaultTemplateConstructor = defaultTemplateConstructor,
                QueryName = queryName ?? GetEntityType(model),
            };
        }
Exemplo n.º 2
0
        protected override void Init()
        {
            CompanyDTO company   = null;
            var        dbFactory = new DbFactory();

            using (var db = dbFactory.GetRDb())
            {
                company = db.Companies.GetByIdWithSettingsAsDto(CompanyId);
            }
            var addressService = AddressService.Default;

            //Checking email service, sent test message
            var emailSmtpSettings = SettingsBuilder.GetSmtpSettingsFromCompany(company, AppSettings.IsDebug, AppSettings.IsSampleLabels);
            var emailService      = new EmailService(GetLogger(), emailSmtpSettings, addressService);

            var info = new SystemEmailInfo(addressService, "[commercentric.com] Launched emails thread", "Support", "*****@*****.**");

            emailService.SendEmail(info, CallSource.Service);
        }
Exemplo n.º 3
0
        internal static EmailTemplateEntity CreateDefaultTemplate(SystemEmailEntity systemEmail)
        {
            SystemEmailInfo info = systemEmails.GetOrThrow(systemEmailToType.Value.GetOrThrow(systemEmail));

            EmailTemplateEntity template = info.DefaultTemplateConstructor();

            if (template.MasterTemplate != null)
            {
                template.MasterTemplate = EmailMasterTemplateLogic.GetDefaultMasterTemplate();
            }

            if (template.Name == null)
            {
                template.Name = systemEmail.FullClassName;
            }

            template.SystemEmail = systemEmail;
            template.Query       = QueryLogic.GetQueryEntity(info.QueryName);

            template.ParseData(DynamicQueryManager.Current.QueryDescription(info.QueryName));

            return(template);
        }
Exemplo n.º 4
0
        internal static bool HasDefaultTemplateConstructor(SystemEmailEntity systemEmailTemplate)
        {
            SystemEmailInfo info = systemEmails.GetOrThrow(systemEmailTemplate.ToType());

            return(info.DefaultTemplateConstructor != null);
        }