public static Type ToType(this SystemEmailEntity systemEmail) { if (systemEmail == null) { return(null); } return(systemEmailToType.Value.GetOrThrow(systemEmail, "The system email {0} was not registered")); }
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); }
private static EmailTemplateEntity GetDefaultTemplate(SystemEmailEntity systemEmailEntity, Entity entity) { var isAllowed = Schema.Current.GetInMemoryFilter <EmailTemplateEntity>(userInterface: false); var templates = SystemEmailsToEmailTemplates.Value.TryGetC(systemEmailEntity.ToLite()).EmptyIfNull(); if (templates.IsNullOrEmpty()) { using (ExecutionMode.Global()) using (OperationLogic.AllowSave <EmailTemplateEntity>()) using (Transaction tr = Transaction.ForceNew()) { var template = CreateDefaultTemplate(systemEmailEntity); template.Save(); return(tr.Commit(template)); } } templates = templates.Where(isAllowed); return(templates.Where(t => t.IsApplicable(entity)).SingleEx(() => "Active EmailTemplates for SystemEmail {0}".FormatWith(systemEmailEntity))); }
public string GetConstructorType(SystemEmailEntity systemEmailTemplate) { var type = SystemEmailLogic.GetEntityType(systemEmailTemplate.ToType()); return(ReflectionServer.GetTypeName(type)); }
public static ISystemEmail CreateSystemEmail(SystemEmailEntity systemEmail, ModifiableEntity model) { return((ISystemEmail)SystemEmailLogic.GetEntityConstructor(systemEmail.ToType()).Invoke(new[] { model })); }
internal static bool HasDefaultTemplateConstructor(SystemEmailEntity systemEmailTemplate) { SystemEmailInfo info = systemEmails.GetOrThrow(systemEmailTemplate.ToType()); return(info.DefaultTemplateConstructor != null); }
public static bool RequiresExtraParameters(SystemEmailEntity systemEmailEntity) { return(GetEntityConstructor(systemEmailToType.Value.GetOrThrow(systemEmailEntity)) == null); }