static public void Delete(System.Int32 storeId, System.Int16 emailTemplateId, esSqlAccessType sqlAccessType) { var obj = new StoreEmailTemplate(); obj.StoreId = storeId; obj.EmailTemplateId = emailTemplateId; obj.AcceptChanges(); obj.MarkAsDeleted(); obj.Save(sqlAccessType); }
public void AddMissingEmailTemplates() { List <vStoreEmailTemplate> storeEmails = GetAllEmailTemplates(); EmailTemplateCollection allEmailCollection = new EmailTemplateCollection(); allEmailCollection.LoadAll(); List <EmailTemplate> allEmails = allEmailCollection.ToList(); allEmails.RemoveAll(e => storeEmails.Exists(se => se.EmailTemplateId == e.Id)); List <EmailTemplate> missingEmails = allEmails; foreach (EmailTemplate missingEmail in missingEmails) { StoreEmailTemplate template = this.StoreEmailTemplateCollectionByStoreId.AddNew(); template.EmailTemplateId = missingEmail.Id; template.SubjectTemplate = missingEmail.DefaultSubject; template.BodyTemplate = missingEmail.DefaultBody; } this.Save(); }