コード例 #1
0
        public ActionResult CreateWizard([Bind(Include = "Id,ConcurrencyKey,T_RestrictionsFacilityAssociationID,T_Name,T_Description")] T_Restrictions t_restrictions, string UrlReferrer)
        {
            CheckBeforeSave(t_restrictions);
            if (ModelState.IsValid)
            {
                bool customcreate_hasissues = false;
                if (!CustomSaveOnCreate(t_restrictions, out customcreate_hasissues, "Create"))
                {
                    db.T_Restrictionss.Add(t_restrictions);
                    db.SaveChanges();
                }
                if (!customcreate_hasissues)
                {
                    RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_restrictions, "Create", "");
                    if (customRedirectAction != null)
                    {
                        return(customRedirectAction);
                    }
                    if (!string.IsNullOrEmpty(UrlReferrer))
                    {
                        return(Redirect(UrlReferrer));
                    }
                    else
                    {
                        return(RedirectToAction("Index"));
                    }
                }
            }

            LoadViewDataAfterOnCreate(t_restrictions);
            ViewBag.T_RestrictionsIsHiddenRule       = checkHidden("T_Restrictions", "OnCreate", false);
            ViewBag.T_RestrictionsIsGroupsHiddenRule = checkHidden("T_Restrictions", "OnCreate", true);
            ViewBag.T_RestrictionsIsSetValueUIRule   = checkSetValueUIRule("T_Restrictions", "OnCreate");
            return(View(t_restrictions));
        }
コード例 #2
0
 public ActionResult DeleteConfirmed(T_Restrictions t_restrictions, string UrlReferrer)
 {
     if (!User.CanDelete("T_Restrictions"))
     {
         return(RedirectToAction("Index", "Error"));
     }
     if (CheckBeforeDelete(t_restrictions))
     {
         bool customdelete_hasissues = false;
         if (!CustomDelete(t_restrictions, out customdelete_hasissues, "Delete"))
         {
             db.Entry(t_restrictions).State = EntityState.Deleted;
             db.T_Restrictionss.Remove(t_restrictions);
             db.SaveChanges();
         }
         if (!customdelete_hasissues)
         {
             if (!string.IsNullOrEmpty(UrlReferrer))
             {
                 return(Redirect(UrlReferrer));
             }
             if (ViewData["T_RestrictionsParentUrl"] != null)
             {
                 string parentUrl = ViewData["T_RestrictionsParentUrl"].ToString();
                 ViewData["T_RestrictionsParentUrl"] = null;
                 return(Redirect(parentUrl));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
     }
     return(View(t_restrictions));
 }
コード例 #3
0
        private bool CustomSaveOnImport(T_Restrictions t_restrictions, out string customerror, int i)
        {
            var result = false;

            customerror = "";
            return(result);
        }
コード例 #4
0
        private bool CustomSaveOnEdit(T_Restrictions t_restrictions, out bool customsave_hasissues, string command = "")
        {
            var result = false;

            customsave_hasissues = false;
            return(result);
        }
コード例 #5
0
        public ActionResult DeleteBulk(long[] ids, string UrlReferrer)
        {
            if (User != null && (!((CustomPrincipal)User).CanUseVerb("BulkDelete", "T_Restrictions", User) || !User.CanDelete("T_Restrictions")))
            {
                return(RedirectToAction("Index", "Error"));
            }
            bool customdelete_hasissues = false;

            foreach (var id in ids.Where(p => p > 0))
            {
                customdelete_hasissues = false;
                T_Restrictions t_restrictions = db.T_Restrictionss.Find(id);
                if (CheckBeforeDelete(t_restrictions))
                {
                    if (!CustomDelete(t_restrictions, out customdelete_hasissues, "DeleteBulk"))
                    {
                        db.Entry(t_restrictions).State = EntityState.Deleted;
                        db.T_Restrictionss.Remove(t_restrictions);
                        try
                        {
                            db.SaveChanges();
                        }
                        catch { }
                    }
                }
            }
            return(Json("Success", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        private bool CustomDelete(T_Restrictions t_restrictions, out bool customdelete_hasissues, string command = "")
        {
            var result = false;

            customdelete_hasissues = false;
            return(result);
        }
コード例 #7
0
        public ActionResult Details(int?id, string HostingEntityName, string AssociatedType, string defaultview)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (!CustomAuthorizationBeforeDetails(id, HostingEntityName, AssociatedType))
            {
                return(RedirectToAction("Index", "Error"));
            }
            T_Restrictions t_restrictions = db.T_Restrictionss.Find(id);

            if (t_restrictions == null)
            {
                return(HttpNotFound());
            }
            if (string.IsNullOrEmpty(defaultview))
            {
                defaultview = "Details";
            }
            GetTemplatesForDetails(defaultview);
            ViewData["AssociatedType"]    = AssociatedType;
            ViewData["HostingEntityName"] = HostingEntityName;
            LoadViewDataBeforeOnEdit(t_restrictions);
            if (!string.IsNullOrEmpty(AssociatedType))
            {
                LoadViewDataForCount(t_restrictions, AssociatedType);
            }
            ViewBag.T_RestrictionsIsHiddenRule       = checkHidden("T_Restrictions", "OnDetails", false);
            ViewBag.T_RestrictionsIsGroupsHiddenRule = checkHidden("T_Restrictions", "OnDetails", true);
            ViewBag.T_RestrictionsIsSetValueUIRule   = checkSetValueUIRule("T_Restrictions", "OnDetails");
            return(View(ViewBag.TemplatesName, t_restrictions));
        }
コード例 #8
0
        public string CheckBeforeSave(T_Restrictions t_restrictions, string command = "")
        {
            var AlertMsg = "";

            // Write your logic here

            //Make sure to assign AlertMsg with proper message
            //AlertMsg = "Validation Alert - Before Save !! Information not saved.";
            //ModelState.AddModelError("CustomError", AlertMsg);
            //ViewBag.ApplicationError = AlertMsg;
            return(AlertMsg);
        }
コード例 #9
0
        public bool CheckBeforeDelete(T_Restrictions t_restrictions)
        {
            var result = true;

            // Write your logic here

            if (!result)
            {
                var AlertMsg = "Validation Alert - Before Delete !! Information not deleted.";
                ModelState.AddModelError("CustomError", AlertMsg);
                ViewBag.ApplicationError = AlertMsg;
            }
            return(result);
        }
コード例 #10
0
 public ActionResult CreateQuick([Bind(Include = "Id,ConcurrencyKey,T_RestrictionsFacilityAssociationID,T_Name,T_Description")] T_Restrictions t_restrictions, string UrlReferrer, bool?IsAddPop, string AssociatedEntity, string HostingEntityName, string HostingEntityID)
 {
     CheckBeforeSave(t_restrictions);
     if (ModelState.IsValid)
     {
         bool customcreate_hasissues = false;
         if (!CustomSaveOnCreate(t_restrictions, out customcreate_hasissues, "Create"))
         {
             db.T_Restrictionss.Add(t_restrictions);
             db.SaveChanges();
         }
         if (HostingEntityName == "T_EmployeeInjury" && AssociatedEntity == "T_TypeOfRestrictions_T_EmployeeInjury")
         {
             long hostingentityid;
             if (Int64.TryParse(HostingEntityID, out hostingentityid) && hostingentityid > 0)
             {
                 db.T_TypeOfRestrictionss.Add(new T_TypeOfRestrictions {
                     T_EmployeeInjuryID = hostingentityid, T_RestrictionsID = t_restrictions.Id
                 });
                 db.SaveChanges();
             }
         }
         if (!customcreate_hasissues)
         {
             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_restrictions);
     ViewBag.T_RestrictionsIsHiddenRule       = checkHidden("T_Restrictions", "OnCreate", false);
     ViewBag.T_RestrictionsIsGroupsHiddenRule = checkHidden("T_Restrictions", "OnCreate", true);
     ViewBag.T_RestrictionsIsSetValueUIRule   = checkSetValueUIRule("T_Restrictions", "OnCreate");
     if (!string.IsNullOrEmpty(AssociatedEntity))
     {
         LoadViewDataForCount(t_restrictions, AssociatedEntity);
     }
     return(View(t_restrictions));
 }
コード例 #11
0
        public ActionResult Create([Bind(Include = "Id,ConcurrencyKey,T_RestrictionsFacilityAssociationID,T_Name,T_Description")] T_Restrictions t_restrictions, string UrlReferrer, bool?IsDDAdd)
        {
            string command = Request.Form["hdncommand"];

            CheckBeforeSave(t_restrictions, command);

            if (ModelState.IsValid)
            {
                bool customcreate_hasissues = false;
                if (!CustomSaveOnCreate(t_restrictions, out customcreate_hasissues, command))
                {
                    db.T_Restrictionss.Add(t_restrictions);
                    db.SaveChanges();
                }
                if (!customcreate_hasissues)
                {
                    RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_restrictions, "Create", command);
                    if (customRedirectAction != null)
                    {
                        return(customRedirectAction);
                    }
                    if (command == "Create & Continue")
                    {
                        return(RedirectToAction("Edit", new { Id = t_restrictions.Id, UrlReferrer = UrlReferrer }));
                    }
                    if (!string.IsNullOrEmpty(UrlReferrer))
                    {
                        return(Redirect(UrlReferrer));
                    }
                    else
                    {
                        return(RedirectToAction("Index"));
                    }
                }
            }

            if (IsDDAdd != null)
            {
                ViewBag.IsDDAdd = Convert.ToBoolean(IsDDAdd);
            }
            LoadViewDataAfterOnCreate(t_restrictions);
            ViewData["T_RestrictionsParentUrl"]      = UrlReferrer;
            ViewBag.T_RestrictionsIsHiddenRule       = checkHidden("T_Restrictions", "OnCreate", false);
            ViewBag.T_RestrictionsIsGroupsHiddenRule = checkHidden("T_Restrictions", "OnCreate", true);
            ViewBag.T_RestrictionsIsSetValueUIRule   = checkSetValueUIRule("T_Restrictions", "OnCreate");
            return(View(t_restrictions));
        }
コード例 #12
0
        public ActionResult BulkUpdate([Bind(Include = "Id,ConcurrencyKey,T_RestrictionsFacilityAssociationID,T_Name,T_Description")] T_Restrictions t_restrictions, FormCollection collection, string UrlReferrer)
        {
            var bulkIds   = collection["BulkUpdate"].Split(',').ToList();
            var chkUpdate = collection["chkUpdate"];

            if (!string.IsNullOrEmpty(chkUpdate))
            {
                bool customsave_hasissues = false;
                foreach (var id in bulkIds.Where(p => p != string.Empty))
                {
                    long           objId  = long.Parse(id);
                    T_Restrictions target = db.T_Restrictionss.Find(objId);
                    target.setDateTimeToClientTime();
                    EntityCopy.CopyValuesForSameObjectType(t_restrictions, target, chkUpdate);
                    customsave_hasissues = false;
                    CheckBeforeSave(target, "BulkUpdate");
                    if (ValidateModel(target) && !CustomSaveOnEdit(target, out customsave_hasissues, "BulkUpdate"))
                    {
                        db.Entry(target).State = EntityState.Modified;
                        try
                        {
                            if (target.t_restrictionsfacilityassociation != null)
                            {
                                db.Entry(target.t_restrictionsfacilityassociation).State = EntityState.Unchanged;
                            }
                            db.SaveChanges();
                        }
                        catch { }
                    }
                }
            }
            RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_restrictions, "BulkUpdate", "");

            if (customRedirectAction != null)
            {
                return(customRedirectAction);
            }
            if (!string.IsNullOrEmpty(UrlReferrer))
            {
                return(Redirect(UrlReferrer));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
コード例 #13
0
 public ActionResult EditWizard([Bind(Include = "Id,ConcurrencyKey,T_RestrictionsFacilityAssociationID,T_Name,T_Description")] T_Restrictions t_restrictions, string UrlReferrer)
 {
     CheckBeforeSave(t_restrictions);
     if (ModelState.IsValid)
     {
         bool customsave_hasissues = false;
         if (!CustomSaveOnEdit(t_restrictions, out customsave_hasissues, "Save"))
         {
             db.Entry(t_restrictions).State = EntityState.Modified;
             db.SaveChanges();
         }
         if (!customsave_hasissues)
         {
             RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_restrictions, "Edit", "");
             if (customRedirectAction != null)
             {
                 return(customRedirectAction);
             }
             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_restrictions);
     ViewBag.T_RestrictionsIsHiddenRule       = checkHidden("T_Restrictions", "OnEdit", false);
     ViewBag.T_RestrictionsIsGroupsHiddenRule = checkHidden("T_Restrictions", "OnEdit", true);
     ViewBag.T_RestrictionsIsSetValueUIRule   = checkSetValueUIRule("T_Restrictions", "OnEdit");
     return(View(t_restrictions));
 }
コード例 #14
0
        public ActionResult BulkAssociate(long[] ids, string AssociatedType, string HostingEntity, string HostingEntityID)
        {
            var HostingID = Convert.ToInt64(HostingEntityID);

            if (HostingID == 0)
            {
                return(Json("Error", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
            }
            if (HostingEntity == "T_Facility" && AssociatedType == "T_RestrictionsFacilityAssociation")
            {
                foreach (var id in ids.Where(p => p > 0))
                {
                    T_Restrictions obj = db.T_Restrictionss.Find(id);
                    db.Entry(obj).State = EntityState.Modified;
                    obj.T_RestrictionsFacilityAssociationID = HostingID;
                    db.SaveChanges();
                }
            }
            return(Json("Success", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
        }
コード例 #15
0
        public ActionResult EditQuick(int?id, string UrlReferrer, string HostingEntityName, string AssociatedType, string viewtype)
        {
            if (!User.CanEdit("T_Restrictions") || !CustomAuthorizationBeforeEdit(id, HostingEntityName, AssociatedType))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (string.IsNullOrEmpty(viewtype))
            {
                viewtype = "EditQuick";
            }
            GetTemplatesForEditQuick(viewtype);
            T_Restrictions t_restrictions = db.T_Restrictionss.Find(id);

            if (t_restrictions == null)
            {
                return(HttpNotFound());
            }
            if (UrlReferrer != null)
            {
                ViewData["T_RestrictionsParentUrl"] = UrlReferrer;
            }
            if (ViewData["T_RestrictionsParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_Restrictions") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_Restrictions/Edit/" + t_restrictions.Id + "") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_Restrictions/Create"))
            {
                ViewData["T_RestrictionsParentUrl"] = Request.UrlReferrer;
            }
            ViewData["HostingEntityName"] = HostingEntityName;
            ViewData["AssociatedType"]    = AssociatedType;
            LoadViewDataBeforeOnEdit(t_restrictions);
            ViewBag.T_RestrictionsIsHiddenRule       = checkHidden("T_Restrictions", "OnEdit", false);
            ViewBag.T_RestrictionsIsGroupsHiddenRule = checkHidden("T_Restrictions", "OnEdit", true);
            ViewBag.T_RestrictionsIsSetValueUIRule   = checkSetValueUIRule("T_Restrictions", "OnEdit");
            var objT_Restrictions = new List <T_Restrictions>();

            ViewBag.T_RestrictionsDD = new SelectList(objT_Restrictions, "ID", "DisplayValue");
            return(View(t_restrictions));
        }
コード例 #16
0
        public ActionResult EditQuick([Bind(Include = "Id,ConcurrencyKey,T_RestrictionsFacilityAssociationID,T_Name,T_Description")] T_Restrictions t_restrictions, string UrlReferrer, bool?IsAddPop, string AssociatedEntity)
        {
            string command = Request.Form["hdncommand"];

            CheckBeforeSave(t_restrictions, command);

            if (ModelState.IsValid)
            {
                bool customsave_hasissues = false;
                if (!CustomSaveOnEdit(t_restrictions, out customsave_hasissues, command))
                {
                    db.Entry(t_restrictions).State = EntityState.Modified;
                    db.SaveChanges();
                }
                var result = new { Result = "Succeed", UrlRefr = UrlReferrer };
                if (!customsave_hasissues)
                {
                    return(Json(result, "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 + ".  ";
                    }
                }
                var result = new { Result = "fail", UrlRefr = errors };
                return(Json(result, "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
            }

            LoadViewDataAfterOnEdit(t_restrictions);
            ViewBag.T_RestrictionsIsHiddenRule       = checkHidden("T_Restrictions", "OnEdit", false);
            ViewBag.T_RestrictionsIsGroupsHiddenRule = checkHidden("T_Restrictions", "OnEdit", true);
            ViewBag.T_RestrictionsIsSetValueUIRule   = checkSetValueUIRule("T_Restrictions", "OnEdit");
            return(View(t_restrictions));
        }
コード例 #17
0
        // GET: /T_Restrictions/Delete/5
        public ActionResult Delete(int id)
        {
            if (!User.CanDelete("T_Restrictions") || !CustomAuthorizationBeforeDelete(id))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_Restrictions t_restrictions = db.T_Restrictionss.Find(id);

            if (t_restrictions == null)
            {
                throw(new Exception("Deleted"));
            }
            if (ViewData["T_RestrictionsParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_Restrictions"))
            {
                ViewData["T_RestrictionsParentUrl"] = Request.UrlReferrer;
            }
            return(View(t_restrictions));
        }
コード例 #18
0
 public void AfterSave(T_Restrictions t_restrictions)
 {
     // Write your logic here
 }
コード例 #19
0
 public void OnSaving(T_Restrictions t_restrictions, ApplicationContext db)
 {
     // Write your logic here
 }
コード例 #20
0
 public void OnDeleting(T_Restrictions t_restrictions)
 {
     // Write your logic here
 }
コード例 #21
0
 private RedirectToRouteResult CustomRedirectUrl(T_Restrictions t_restrictions, string action, string command = "")
 {
     // Sample Custom implemention below
     // return RedirectToAction("Index", "T_Restrictions");
     return(null);
 }
コード例 #22
0
        public ActionResult Edit(int?id, string UrlReferrer, string HostingEntityName, string AssociatedType, string defaultview)
        {
            if (!User.CanEdit("T_Restrictions") || !CustomAuthorizationBeforeEdit(id, HostingEntityName, AssociatedType))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_Restrictions t_restrictions = db.T_Restrictionss.Find(id);

            // NEXT-PREVIOUS DROP DOWN CODE
            TempData.Keep();
            string json = "";

            if (TempData["T_Restrictionslist"] == null)
            {
                json = Newtonsoft.Json.JsonConvert.SerializeObject(db.T_Restrictionss.Select(z => new { ID = z.Id, DisplayValue = z.DisplayValue }).ToList());
            }
            else
            {
                ViewBag.EntityT_RestrictionsDisplayValueEdit = TempData["T_Restrictionslist"];
                json = Newtonsoft.Json.JsonConvert.SerializeObject(TempData["T_Restrictionslist"]);
            }

            Newtonsoft.Json.JsonSerializerSettings serSettings = new    Newtonsoft.Json.JsonSerializerSettings();
            serSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();
            var lst = Newtonsoft.Json.JsonConvert.DeserializeObject <IEnumerable <object> >(json, serSettings);

            ViewBag.EntityT_RestrictionsDisplayValueEdit = new SelectList(lst, "ID", "DisplayValue");
            //
            if (t_restrictions == null)
            {
                return(HttpNotFound());
            }
            if (string.IsNullOrEmpty(defaultview))
            {
                defaultview = "Edit";
            }
            GetTemplatesForEdit(defaultview);
            // NEXT-PREVIOUS DROP DOWN CODE
            SelectList            selitm  = new SelectList(lst, "ID", "DisplayValue");
            List <SelectListItem> newList = selitm.ToList();

            if (Request.UrlReferrer != null && Request.UrlReferrer.AbsolutePath.EndsWith("/T_Restrictions/Create"))
            {
                newList.Insert(0, (new SelectListItem {
                    Text = t_restrictions.DisplayValue, Value = t_restrictions.Id.ToString()
                }));
                ViewBag.EntityT_RestrictionsDisplayValueEdit = newList;
                TempData["T_Restrictionslist"] = newList.Select(z => new { ID = z.Value, DisplayValue = z.Text });
            }
            else if (!newList.Exists(p => p.Value == Convert.ToString(t_restrictions.Id)))
            {
                if (newList.Count > 0)
                {
                    newList[0].Text  = t_restrictions.DisplayValue;
                    newList[0].Value = t_restrictions.Id.ToString();
                }
                else
                {
                    newList.Insert(0, (new SelectListItem {
                        Text = t_restrictions.DisplayValue, Value = t_restrictions.Id.ToString()
                    }));
                }
                ViewBag.EntityT_RestrictionsDisplayValueEdit = newList;
                TempData["T_Restrictionslist"] = newList.Select(z => new { ID = z.Value, DisplayValue = z.Text });
            }
            //
            if (UrlReferrer != null)
            {
                ViewData["T_RestrictionsParentUrl"] = UrlReferrer;
            }
            if (ViewData["T_RestrictionsParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_Restrictions") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_Restrictions/Edit/" + t_restrictions.Id + "") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_Restrictions/Create"))
            {
                ViewData["T_RestrictionsParentUrl"] = Request.UrlReferrer;
            }
            ViewData["HostingEntityName"] = HostingEntityName;
            ViewData["AssociatedType"]    = AssociatedType;
            LoadViewDataBeforeOnEdit(t_restrictions);
            ViewBag.T_RestrictionsIsHiddenRule       = checkHidden("T_Restrictions", "OnEdit", false);
            ViewBag.T_RestrictionsIsGroupsHiddenRule = checkHidden("T_Restrictions", "OnEdit", true);
            ViewBag.T_RestrictionsIsSetValueUIRule   = checkSetValueUIRule("T_Restrictions", "OnEdit");
            return(View(t_restrictions));
        }
コード例 #23
0
        public ActionResult Edit([Bind(Include = "Id,ConcurrencyKey,T_RestrictionsFacilityAssociationID,T_Name,T_Description")] T_Restrictions t_restrictions, string UrlReferrer)
        {
            string command = Request.Form["hdncommand"];

            CheckBeforeSave(t_restrictions, command);
            if (ModelState.IsValid)
            {
                bool customsave_hasissues = false;
                if (!CustomSaveOnEdit(t_restrictions, out customsave_hasissues, command))
                {
                    db.Entry(t_restrictions).State = EntityState.Modified;
                    db.SaveChanges();
                }
                if (!customsave_hasissues)
                {
                    RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_restrictions, "Edit", command);
                    if (customRedirectAction != null)
                    {
                        return(customRedirectAction);
                    }
                    if (command != "Save")
                    {
                        if (command == "SaveNextPrev")
                        {
                            long NextPreId = Convert.ToInt64(Request.Form["hdnNextPrevId"]);
                            return(RedirectToAction("Edit", new { Id = NextPreId, UrlReferrer = UrlReferrer }));
                        }
                        else
                        {
                            return(RedirectToAction("Edit", new { Id = t_restrictions.Id, UrlReferrer = UrlReferrer }));
                        }
                    }
                    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"));
                    }
                }
            }

            // NEXT-PREVIOUS DROP DOWN CODE
            TempData.Keep();
            string json = "";

            if (TempData["T_Restrictionslist"] == null)
            {
                json = Newtonsoft.Json.JsonConvert.SerializeObject(db.T_Restrictionss.Select(z => new { ID = z.Id, DisplayValue = z.DisplayValue }).ToList());
            }
            else
            {
                ViewBag.EntityT_RestrictionsDisplayValueEdit = TempData["T_Restrictionslist"];
                json = Newtonsoft.Json.JsonConvert.SerializeObject(TempData["T_Restrictionslist"]);
            }

            Newtonsoft.Json.JsonSerializerSettings serSettings = new    Newtonsoft.Json.JsonSerializerSettings();
            serSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();
            var lst = Newtonsoft.Json.JsonConvert.DeserializeObject <IEnumerable <object> >(json, serSettings);

            ViewBag.EntityT_RestrictionsDisplayValueEdit = new SelectList(lst, "ID", "DisplayValue");
            //
            LoadViewDataAfterOnEdit(t_restrictions);
            ViewData["T_RestrictionsParentUrl"]      = UrlReferrer;
            ViewBag.T_RestrictionsIsHiddenRule       = checkHidden("T_Restrictions", "OnEdit", false);
            ViewBag.T_RestrictionsIsGroupsHiddenRule = checkHidden("T_Restrictions", "OnEdit", true);
            ViewBag.T_RestrictionsIsSetValueUIRule   = checkSetValueUIRule("T_Restrictions", "OnEdit");
            return(View(t_restrictions));
        }
コード例 #24
0
 private void CustomLoadViewDataListAfterEdit(T_Restrictions t_restrictions)
 {
 }
コード例 #25
0
 private void CustomLoadViewDataListBeforeEdit(T_Restrictions t_restrictions)
 {
 }
コード例 #26
0
 private void CustomLoadViewDataListAfterOnCreate(T_Restrictions t_restrictions)
 {
 }