Beispiel #1
0
        public ActionResult BulkUpdate([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringEndType t_recurringendtype, FormCollection collection, string UrlReferrer)
        {
            var bulkIds   = collection["BulkUpdate"].Split(',').ToList();
            var chkUpdate = collection["chkUpdate"];

            if (!string.IsNullOrEmpty(chkUpdate))
            {
                foreach (var id in bulkIds.Where(p => p != string.Empty))
                {
                    long objId = long.Parse(id);
                    T_RecurringEndType target = db.T_RecurringEndTypes.Find(objId);
                    EntityCopy.CopyValuesForSameObjectType(t_recurringendtype, target, chkUpdate);
                    db.Entry(target).State = EntityState.Modified;
                    try
                    {
                        db.SaveChanges();
                    }
                    catch { }
                }
            }
            if (!string.IsNullOrEmpty(UrlReferrer))
            {
                return(Redirect(UrlReferrer));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Beispiel #2
0
 public ActionResult DeleteConfirmed(T_RecurringEndType t_recurringendtype, string UrlReferrer)
 {
     if (!User.CanDelete("T_RecurringEndType"))
     {
         return(RedirectToAction("Index", "Error"));
     }
     if (CheckBeforeDelete(t_recurringendtype))
     {
         //Delete Document
         db.Entry(t_recurringendtype).State = EntityState.Deleted;
         db.T_RecurringEndTypes.Remove(t_recurringendtype);
         db.SaveChanges();
         if (!string.IsNullOrEmpty(UrlReferrer))
         {
             return(Redirect(UrlReferrer));
         }
         if (ViewData["T_RecurringEndTypeParentUrl"] != null)
         {
             string parentUrl = ViewData["T_RecurringEndTypeParentUrl"].ToString();
             ViewData["T_RecurringEndTypeParentUrl"] = null;
             return(Redirect(parentUrl));
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(t_recurringendtype));
 }
Beispiel #3
0
 public ActionResult EditWizard([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringEndType t_recurringendtype, string UrlReferrer)
 {
     CheckBeforeSave(t_recurringendtype);
     if (ModelState.IsValid)
     {
         db.Entry(t_recurringendtype).State = EntityState.Modified;
         db.SaveChanges();
         if (!string.IsNullOrEmpty(UrlReferrer))
         {
             var uri   = new Uri(UrlReferrer);
             var query = HttpUtility.ParseQueryString(uri.Query);
             if (Convert.ToBoolean(query.Get("IsFilter")) == true)
             {
                 return(RedirectToAction("Index"));
             }
             else
             {
                 return(Redirect(UrlReferrer));
             }
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     LoadViewDataAfterOnEdit(t_recurringendtype);
     return(View(t_recurringendtype));
 }
Beispiel #4
0
        public ActionResult EditQuick([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringEndType t_recurringendtype, string UrlReferrer, bool?IsAddPop, string AssociatedEntity)
        {
            CheckBeforeSave(t_recurringendtype);
            if (ModelState.IsValid)
            {
                string command = Request.Form["hdncommand"];
                db.Entry(t_recurringendtype).State = EntityState.Modified;
                db.SaveChanges();

                return(Json(UrlReferrer, "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var errors = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        errors += error.ErrorMessage + ".  ";
                    }
                }
                return(Json(errors, "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
            }

            LoadViewDataAfterOnEdit(t_recurringendtype);
            return(View(t_recurringendtype));
        }
Beispiel #5
0
        // GET: /T_RecurringEndType/EditWizard/5
        public ActionResult EditWizard(int?id, string UrlReferrer)
        {
            if (!User.CanEdit("T_RecurringEndType"))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_RecurringEndType t_recurringendtype = db.T_RecurringEndTypes.Find(id);

            if (t_recurringendtype == null)
            {
                return(HttpNotFound());
            }

            if (UrlReferrer != null)
            {
                ViewData["T_RecurringEndTypeParentUrl"] = UrlReferrer;
            }
            if (ViewData["T_RecurringEndTypeParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringEndType"))
            {
                ViewData["T_RecurringEndTypeParentUrl"] = Request.UrlReferrer;
            }
            LoadViewDataBeforeOnEdit(t_recurringendtype);
            ViewBag.T_RecurringEndTypeIsHiddenRule = checkHidden("T_RecurringEndType", "OnEdit");
            return(View(t_recurringendtype));
        }
Beispiel #6
0
        // GET: /T_RecurringEndType/Edit/5
        public ActionResult EditQuick(int?id, string UrlReferrer, string HostingEntityName, string AssociatedType)
        {
            if (!User.CanEdit("T_RecurringEndType"))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_RecurringEndType t_recurringendtype = db.T_RecurringEndTypes.Find(id);

            if (t_recurringendtype == null)
            {
                return(HttpNotFound());
            }
            if (UrlReferrer != null)
            {
                ViewData["T_RecurringEndTypeParentUrl"] = UrlReferrer;
            }
            if (ViewData["T_RecurringEndTypeParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringEndType") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringEndType/Edit/" + t_recurringendtype.Id + "") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringEndType/Create"))
            {
                ViewData["T_RecurringEndTypeParentUrl"] = Request.UrlReferrer;
            }
            ViewData["HostingEntityName"] = HostingEntityName;
            ViewData["AssociatedType"]    = AssociatedType;
            LoadViewDataBeforeOnEdit(t_recurringendtype);
            ViewBag.T_RecurringEndTypeIsHiddenRule = checkHidden("T_RecurringEndType", "OnEdit");
            return(View(t_recurringendtype));
        }
Beispiel #7
0
        public ActionResult Create([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringEndType t_recurringendtype, string UrlReferrer, bool?IsDDAdd)
        {
            CheckBeforeSave(t_recurringendtype);
            if (ModelState.IsValid)
            {
                string command = Request.Form["hdncommand"];
                db.T_RecurringEndTypes.Add(t_recurringendtype);
                db.SaveChanges();
                if (command == "Create & Continue")
                {
                    return(RedirectToAction("Edit", new { Id = t_recurringendtype.Id, UrlReferrer = UrlReferrer }));
                }
                if (!string.IsNullOrEmpty(UrlReferrer))
                {
                    return(Redirect(UrlReferrer));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }

            if (IsDDAdd != null)
            {
                ViewBag.IsDDAdd = Convert.ToBoolean(IsDDAdd);
            }
            LoadViewDataAfterOnCreate(t_recurringendtype);
            return(View(t_recurringendtype));
        }
Beispiel #8
0
 public ActionResult CreateQuick([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringEndType t_recurringendtype, string UrlReferrer, bool?IsAddPop, string AssociatedEntity)
 {
     CheckBeforeSave(t_recurringendtype);
     if (ModelState.IsValid)
     {
         db.T_RecurringEndTypes.Add(t_recurringendtype);
         db.SaveChanges();
         return(Json("FROMPOPUP", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
     }
     else
     {
         var errors = "";
         foreach (ModelState modelState in ViewData.ModelState.Values)
         {
             foreach (ModelError error in modelState.Errors)
             {
                 errors += error.ErrorMessage + ".  ";
             }
         }
         return(Json(errors, "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
     }
     LoadViewDataAfterOnCreate(t_recurringendtype);
     if (!string.IsNullOrEmpty(AssociatedEntity))
     {
         LoadViewDataForCount(t_recurringendtype, AssociatedEntity);
     }
     return(View(t_recurringendtype));
 }
Beispiel #9
0
 public ActionResult DeleteBulk(long[] ids, string UrlReferrer)
 {
     foreach (var id in ids.Where(p => p > 0))
     {
         T_RecurringEndType t_recurringendtype = db.T_RecurringEndTypes.Find(id);
         db.Entry(t_recurringendtype).State = EntityState.Deleted;
         db.T_RecurringEndTypes.Remove(t_recurringendtype);
         try
         {
             db.SaveChanges();
         }
         catch { }
     }
     return(Json("Success", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
 }
Beispiel #10
0
        public ActionResult CreateWizard([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringEndType t_recurringendtype, string UrlReferrer)
        {
            CheckBeforeSave(t_recurringendtype);
            if (ModelState.IsValid)
            {
                db.T_RecurringEndTypes.Add(t_recurringendtype);
                db.SaveChanges();

                if (!string.IsNullOrEmpty(UrlReferrer))
                {
                    return(Redirect(UrlReferrer));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }

            LoadViewDataAfterOnCreate(t_recurringendtype);
            return(View(t_recurringendtype));
        }
Beispiel #11
0
        // GET: /T_RecurringEndType/Delete/5
        public ActionResult Delete(int id)
        {
            if (!User.CanDelete("T_RecurringEndType"))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_RecurringEndType t_recurringendtype = db.T_RecurringEndTypes.Find(id);

            if (t_recurringendtype == null)
            {
                throw(new Exception("Deleted"));
            }
            if (ViewData["T_RecurringEndTypeParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringEndType"))
            {
                ViewData["T_RecurringEndTypeParentUrl"] = Request.UrlReferrer;
            }
            return(View(t_recurringendtype));
        }
Beispiel #12
0
        // GET: /T_RecurringEndType/Details/5
        public ActionResult Details(int?id, string HostingEntityName, string AssociatedType)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_RecurringEndType t_recurringendtype = db.T_RecurringEndTypes.Find(id);

            if (t_recurringendtype == null)
            {
                return(HttpNotFound());
            }
            GetTemplatesForDetails();
            ViewData["AssociatedType"]    = AssociatedType;
            ViewData["HostingEntityName"] = HostingEntityName;
            LoadViewDataBeforeOnEdit(t_recurringendtype);
            if (!string.IsNullOrEmpty(AssociatedType))
            {
                LoadViewDataForCount(t_recurringendtype, AssociatedType);
            }
            ViewBag.T_RecurringEndTypeIsHiddenRule = checkHidden("T_RecurringEndType", "OnDetails");
            return(View(ViewBag.TemplatesName, t_recurringendtype));
        }