Example #1
0
        public virtual ActionResult Create(string[] folderName, SendingSetting sendingSetting, string @return)
        {
            if (folderName == null || folderName.Length == 0)
            {
                ModelState.AddModelError("FolderName", "Folder name is required.".Localize());
            }
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                if (ModelState.IsValid)
                {
                    foreach (var item in folderName)
                    {
                        if (Manager.Get(Repository, item) == null)
                        {
                            sendingSetting.FolderName = item;
                            Manager.Add(Repository, sendingSetting);
                        }

                    }
                    resultData.RedirectUrl = @return;
                }
            });
            return Json(data);
        }
Example #2
0
        public virtual ActionResult Create(SendingSetting sendingSetting)
        {
            var entry = new JsonResultEntry();
            try
            {
                if (ModelState.IsValid)
                {
                    Manager.Add(Repository, sendingSetting);

                    entry.SetSuccess();
                }
                else
                {
                    entry.AddModelState(ModelState);
                }
            }
            catch (Exception e)
            {
                entry.AddException(e);
            }
            return Json(entry);
        }
Example #3
0
        public virtual ActionResult Edit(SendingSetting @new, string @return)
        {
            var data = new JsonResultData(ModelState);

            data.RunWithTry((resultData) =>
            {
                if (ModelState.IsValid)
                {
                    @new.Repository = Repository;
                    Manager.Update(Repository, @new, @new);
                    resultData.RedirectUrl = @return;
                }
            });

            return Json(data);
        }
Example #4
0
 public virtual ActionResult Delete(SendingSetting[] Model)
 {
     var data = new JsonResultData(ModelState);
     data.RunWithTry((resultData) =>
     {
         if (Model != null)
         {
             foreach (var m in Model)
             {
                 m.Repository = Repository;
                 Manager.Remove(Repository, m);
             }
         }
         resultData.ReloadPage = true;
     });
     return Json(data);
 }
 protected virtual bool AllowSendingSetting(TextContent content, SendingSetting sendingSetting, ContentEventContext eventContext)
 {
     if (!string.IsNullOrEmpty(sendingSetting.FolderName) && !sendingSetting.FolderName.Equals(content.FolderName, StringComparison.CurrentCultureIgnoreCase))
     {
         return false;
     }
     if (!string.IsNullOrEmpty(content.OriginalUUID))
     {
         if (content.IsLocalized == null || content.IsLocalized.Value == false)
         {
             if ((sendingSetting.SendReceived == null || sendingSetting.SendReceived.Value == false))
             {
                 return false;
             }
         }
     }
     return true;
 }
Example #6
0
 public virtual ActionResult Delete(SendingSetting[] Model)
 {
     var entry = new JsonResultEntry();
     try
     {
         if (Model != null)
         {
             foreach (var m in Model)
             {
                 m.Repository = Repository;
                 Manager.Remove(Repository, m);
             }
         }
         entry.SetSuccess();
     }
     catch (Exception e)
     {
         entry.AddException(e);
     }
     return Json(entry);
 }
Example #7
0
 public virtual ActionResult Edit(SendingSetting @new)
 {
     var entry = new JsonResultEntry();
     try
     {
         if (ModelState.IsValid)
         {
             @new.Repository = Repository;
             Manager.Update(Repository, @new, @new);
             entry.SetSuccess();
         }
         else
         {
             entry.AddModelState(ModelState);
         }
     }
     catch (Exception e)
     {
         entry.AddException(e);
     }
     return Json(entry);
 }