public static string GetOrganizationEmail(RestCommand command, int organizationEmailID) { OrganizationEmail organizationEmail = OrganizationEmails.GetOrganizationEmail(command.LoginUser, organizationEmailID); if (organizationEmail.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(organizationEmail.GetXml("OrganizationEmail", true)); }
public static void SaveEmailTemplate(int emailTemplateID, string subject, string header, string footer, string body, bool isHtml, bool useTemplate, int productFamilyID) { if (!UserSession.CurrentUser.IsSystemAdmin) { return; } EmailTemplate template = EmailTemplates.GetEmailTemplate(UserSession.LoginUser, emailTemplateID); subject = template.IsEmail ? subject : ""; if (UserSession.LoginUser.UserID == -34) { template.Body = body; template.EmailTemplateID = emailTemplateID; template.IsHtml = isHtml; template.Subject = subject; template.Header = header; template.Footer = footer; template.UseGlobalTemplate = useTemplate && template.IsEmail; template.Collection.Save(); } else { OrganizationEmails emails = new OrganizationEmails(UserSession.LoginUser); emails.LoadByTemplateAndProductFamily(UserSession.LoginUser.OrganizationID, emailTemplateID, productFamilyID); OrganizationEmail email = emails.IsEmpty || (emails[0].ProductFamilyID == null && productFamilyID != -1) ? (new OrganizationEmails(UserSession.LoginUser)).AddNewOrganizationEmail() : emails[0]; email.Body = body; email.EmailTemplateID = emailTemplateID; email.IsHtml = isHtml; email.OrganizationID = UserSession.LoginUser.OrganizationID; email.Subject = subject; email.Header = header; email.Footer = footer; email.UseGlobalTemplate = useTemplate && template.IsEmail; if (productFamilyID == -1) { email.ProductFamilyID = null; } else { email.ProductFamilyID = productFamilyID; } email.Collection.Save(); } }
protected ITranslationDefinitions <OrganizationEmail, TModel> CreateBaseEntityVmDefinitions(OrganizationEmail entity) { throw new NotImplementedException("Translator OrganizationEmail -> IVmOpenApiOrganizationEmail is not implemented"); }
public override TModel TranslateEntityToVm(OrganizationEmail entity) { return(CreateBaseEntityVmDefinitions(entity).GetFinal()); }
public override VmOpenApiOrganizationEmail TranslateEntityToVm(OrganizationEmail entity) { return(base.TranslateEntityToVm(entity)); }