public JsonResult SaveNewsletterGroup(NewsletterGroup obj) { List <string> returnValue = new List <string>(); //Dictionary<string, object> returnValue = new Dictionary<string, object>(); bool Success = true; Exception exc = null; try { obj.Save(); } catch (Exception ex) { Success = false; exc = ex; } if (Success) { //BaseCollection<NewsletterGroup> Groups = LoadNewsletterGroupList(); returnValue.Add(obj.ID.ToString()); return(JsonResult.CreateResult(Success, returnValue)); } else { return(JsonResult.CreateResult(Success, exc.Message)); } }
private void showEmailSend() { ModuleNavigationActionLite action = GetFirstNavigationAction(); Dictionary <string, object> DataObject = new Dictionary <string, object>(); DataObject.Add("NavigationType", action.NavigationType); DataObject.Add("NavigationUrl", action.NavigationUrl); Response.Clear(); Response.Write(JsonResult.CreateResult(true, DataObject).ToJsonString()); Response.End(); /* ModuleNavigationActionLite action = GetFirstNavigationAction(); * if (action.NavigationType == NavigationTypeEnum.NavigateToPage) * { * * * Response.Redirect(action.NavigationUrl); * } * else * { * if (this.Messagelabel != null) * { * this.Messagelabel.Text = this.Settings["SendCompleteMessage"].ToString(); * } * * } */ }
public JsonResult SaveAbbonementEmail(string NewsLetterGroupId, string Email) { NewsletterSubscriber Subscriber; Guid NewsletterGroupID = Guid.Parse(NewsLetterGroupId); NewsletterGroup CurrentNewsletterGroup = NewsletterGroup.GetById <NewsletterGroup>(NewsletterGroupID); //BaseCollection<NewsletterSubscriber> SubScribers = BaseCollection<NewsletterSubscriber>.Get("EmailAdres = '" + Email + "'"); BaseCollection <NewsletterSubscriber> SubScribers = BaseCollection <NewsletterSubscriber> .Get("Name = '" + Email + "'"); if (SubScribers.Count >= 1) { Subscriber = SubScribers[0]; if (Subscriber.SubscribedGroups.Where(c => c.ID == NewsletterGroupID).Count() >= 1) { return(JsonResult.CreateResult(false, "Dit emailadres is al toegekend aan deze nieuwsbrief groep.")); } else { Subscriber.SubscribedGroups.Add(CurrentNewsletterGroup); Subscriber.Save(); } } else { Subscriber = new BitPlate.Domain.Newsletters.NewsletterSubscriber(); Subscriber.Email = Email; Subscriber.SubscribedGroups.Add(CurrentNewsletterGroup); Subscriber.Save(); } return(JsonResult.CreateResult(true, CurrentNewsletterGroup.Subscribers)); }
public JsonResult DeleteFolder(string id, bool deleteAllPages) { BaseService.CheckLoginAndLicense(); CmsPageFolder folder = GetFolder(id, null); CmsPageFolder ParentFolder; if (folder.GetPages().Count > 0 || folder.GetSubFolders().Count > 0) { if (!deleteAllPages) { return(JsonResult.CreateResult(false, "Wilt u deze map inclusief alle subitems van deze map verwijderen?<br />")); } else { ParentFolder = folder.ParentFolder; DeleteFolderRecursief(folder); } } else { ParentFolder = folder.ParentFolder; folder.Delete(); } string ParentFolderId = (ParentFolder == null) ? null : ParentFolder.ID.ToString(); return(JsonResult.CreateResult(true, GetFoldersAndPages(ParentFolderId, "", "", ""))); }
public JsonResult DeleteImportDefinition(Guid id) { bool result = false; if (id != null) { NewsletterImportDefinition definition = BaseObject.GetById <NewsletterImportDefinition>(id); definition.Delete(); result = true; } return(JsonResult.CreateResult(result)); }
public JsonResult DeleteSubscriber(Guid id) { bool result = false; if (id != null) { NewsletterSubscriber subscriber = BaseObject.GetById <NewsletterSubscriber>(id); subscriber.Delete(); result = true; } return(JsonResult.CreateResult(result)); }
public static JsonResult SaveEnvironment(CmsSiteEnvironment obj) { try { obj.Save(); } catch (Exception ex) { return(JsonResult.CreateResult(false, ex.Message)); } return(JsonResult.CreateResult(true, LoadEnvironments())); }
public JsonResult ImportSubscribers(NewsletterImportDefinition obj) { Dictionary <string, object> returnObject = new Dictionary <string, object>(); NewsletterImportDefinition importDef = obj; List <string> log = new List <string>(); log = importDef.Validate(); if (log.Count == 0) { if (importDef.SaveDefinition == true) { importDef.Site = SessionObject.CurrentSite; importDef.IsNew = (importDef.ID == Guid.Empty); importDef.Save(); } if (importDef.DeleteGroupSubscribers == true) { JsonResult result = DeleteSubscriberFromGroup(importDef.Groups); if (result.Success == true) { importDef.EmptyGroups = false; } } if (importDef.EmptyGroups == true) { foreach (NewsletterGroup group in importDef.Groups) { group.Load(); if (group.IsMandatoryGroup != true) { group.Subscribers.Clear(); group.Save(); } } } log = importDef.StartImport(); string importLogFile = importDef.MakeErrorLogFile(log); returnObject.Add("ImportLogFile", importLogFile); returnObject.Add("Log", log); } return(JsonResult.CreateResult(true, "SUCCES", returnObject)); }
public JsonResult DeleteNewsletter(Newsletter obj) { try { if (obj != null) { obj.Delete(); } } catch (Exception ex) { return(JsonResult.CreateResult(false, ex.Message)); } return(JsonResult.CreateResult(true)); }
public JsonResult SaveNewsletter(Newsletter newsletter) { try { newsletter.Site = SessionObject.CurrentSite; newsletter.Save(); //newsletter.Publish(); newsletter.Publish2(); } catch (Exception ex) { return(JsonResult.CreateResult(false, ex.Message, null)); } return(JsonResult.CreateResult(true, LoadNewsletterList())); }
public JsonResult DeleteAbbonementFromGroup(string NewsLetterGroupId, string SubscriberId) { Guid NewsletterGroupID = Guid.Parse(NewsLetterGroupId); Guid SubscriberID = Guid.Parse(SubscriberId); NewsletterSubscriber Subscriber = NewsletterSubscriber.GetById <NewsletterSubscriber>(SubscriberID); NewsletterGroup SubscriberGroup = NewsletterGroup.GetById <NewsletterGroup>(NewsletterGroupID); if (Subscriber.SubscribedGroups.Count > 1) { Subscriber.SubscribedGroups.Remove(SubscriberGroup); Subscriber.Save(); } else { Subscriber.Delete(); } return(JsonResult.CreateResult(true, SubscriberGroup.Subscribers)); }
public JsonResult SaveSubscriber(NewsletterSubscriber obj) { obj.Site = SessionObject.CurrentSite; foreach (NewsletterGroup group in LoadNewsletterGroupList("Name ASC")) { if (group.IsMandatoryGroup && !obj.SubscribedGroups.Contains(group)) { obj.SubscribedGroups.Add(group); } } obj.Save(); return(JsonResult.CreateResult(true)); /* NewsletterSubscriber Subscriber = BaseObject.GetFirst<NewsletterSubscriber>("Name = '" + OldEmail + "'"); * if (Subscriber != null) * { * Subscriber.EmailAdres = Email; * Subscriber.Save(); * Guid NewsletterID = Guid.Parse(NewsLetterGroupId); * return JsonResult.CreateResult(true, NewsletterGroup.GetById<NewsletterGroup>(NewsletterID).Subscribers); * } */ //return JsonResult.CreateResult(false, "Unable to find subscriber."); }
private JsonResult DeleteSubscriberFromGroup(BaseCollection <NewsletterGroup> groups) { //int aantal; if (groups != null) { foreach (NewsletterGroup group in groups) { //aantal = group.Subscribers.Count(); foreach (NewsletterSubscriber subscriber in group.Subscribers) { if (subscriber.RegistrationType == RegistrationTypeEnum.Import) { subscriber.Delete(); } } //group.Subscribers.DeleteAll(); } return(JsonResult.CreateResult(true)); } else { return(JsonResult.CreateResult(false)); } }
public JsonResult DeleteNewsletterGroup(NewsletterGroup obj) { obj.Delete(); return(JsonResult.CreateResult(true, LoadNewsletterGroupList("Name ASC")));// LoadNewsletterGroupList(); }
public static JsonResult DeleteEnvironment(CmsSiteEnvironment obj) { obj.Delete(); return(JsonResult.CreateResult(true, LoadEnvironments())); }