Ejemplo n.º 1
0
        public ActionResult CreateWizard([Bind(Include = "Id,ConcurrencyKey,T_OrgCode,T_CodeDescription")] T_OrgCodes t_orgcodes, string UrlReferrer)
        {
            CheckBeforeSave(t_orgcodes);
            if (ModelState.IsValid)
            {
                bool customcreate_hasissues = false;
                if (!CustomSaveOnCreate(t_orgcodes, out customcreate_hasissues, "Create"))
                {
                    db.T_OrgCodess.Add(t_orgcodes);
                    db.SaveChanges();
                }
                if (!customcreate_hasissues)
                {
                    RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_orgcodes, "Create", "");
                    if (customRedirectAction != null)
                    {
                        return(customRedirectAction);
                    }
                    if (!string.IsNullOrEmpty(UrlReferrer))
                    {
                        return(Redirect(UrlReferrer));
                    }
                    else
                    {
                        return(RedirectToAction("Index"));
                    }
                }
            }

            LoadViewDataAfterOnCreate(t_orgcodes);
            ViewBag.T_OrgCodesIsHiddenRule       = checkHidden("T_OrgCodes", "OnCreate", false);
            ViewBag.T_OrgCodesIsGroupsHiddenRule = checkHidden("T_OrgCodes", "OnCreate", true);
            ViewBag.T_OrgCodesIsSetValueUIRule   = checkSetValueUIRule("T_OrgCodes", "OnCreate");
            return(View(t_orgcodes));
        }
Ejemplo n.º 2
0
 public ActionResult DeleteConfirmed(T_OrgCodes t_orgcodes, string UrlReferrer)
 {
     if (!User.CanDelete("T_OrgCodes"))
     {
         return(RedirectToAction("Index", "Error"));
     }
     if (CheckBeforeDelete(t_orgcodes))
     {
         bool customdelete_hasissues = false;
         if (!CustomDelete(t_orgcodes, out customdelete_hasissues, "Delete"))
         {
             db.Entry(t_orgcodes).State = EntityState.Deleted;
             db.T_OrgCodess.Remove(t_orgcodes);
             db.SaveChanges();
         }
         if (!customdelete_hasissues)
         {
             if (!string.IsNullOrEmpty(UrlReferrer))
             {
                 return(Redirect(UrlReferrer));
             }
             if (ViewData["T_OrgCodesParentUrl"] != null)
             {
                 string parentUrl = ViewData["T_OrgCodesParentUrl"].ToString();
                 ViewData["T_OrgCodesParentUrl"] = null;
                 return(Redirect(parentUrl));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
     }
     return(View(t_orgcodes));
 }
Ejemplo n.º 3
0
        private bool CustomSaveOnEdit(T_OrgCodes t_orgcodes, out bool customsave_hasissues, string command = "")
        {
            var result = false;

            customsave_hasissues = false;
            return(result);
        }
Ejemplo n.º 4
0
        private bool CustomDelete(T_OrgCodes t_orgcodes, out bool customdelete_hasissues, string command = "")
        {
            var result = false;

            customdelete_hasissues = false;
            return(result);
        }
Ejemplo n.º 5
0
        private bool CustomSaveOnImport(T_OrgCodes t_orgcodes, out string customerror, int i)
        {
            var result = false;

            customerror = "";
            return(result);
        }
Ejemplo n.º 6
0
        public ActionResult DeleteBulk(long[] ids, string UrlReferrer)
        {
            if (User != null && (!((CustomPrincipal)User).CanUseVerb("BulkDelete", "T_OrgCodes", User) || !User.CanDelete("T_OrgCodes")))
            {
                return(RedirectToAction("Index", "Error"));
            }
            bool customdelete_hasissues = false;

            foreach (var id in ids.Where(p => p > 0))
            {
                customdelete_hasissues = false;
                T_OrgCodes t_orgcodes = db.T_OrgCodess.Find(id);
                if (CheckBeforeDelete(t_orgcodes))
                {
                    if (!CustomDelete(t_orgcodes, out customdelete_hasissues, "DeleteBulk"))
                    {
                        db.Entry(t_orgcodes).State = EntityState.Deleted;
                        db.T_OrgCodess.Remove(t_orgcodes);
                        try
                        {
                            db.SaveChanges();
                        }
                        catch { }
                    }
                }
            }
            return(Json("Success", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 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_OrgCodes t_orgcodes = db.T_OrgCodess.Find(id);

            if (t_orgcodes == null)
            {
                return(HttpNotFound());
            }
            if (string.IsNullOrEmpty(defaultview))
            {
                defaultview = "Details";
            }
            GetTemplatesForDetails(defaultview);
            ViewData["AssociatedType"]    = AssociatedType;
            ViewData["HostingEntityName"] = HostingEntityName;
            LoadViewDataBeforeOnEdit(t_orgcodes);
            if (!string.IsNullOrEmpty(AssociatedType))
            {
                LoadViewDataForCount(t_orgcodes, AssociatedType);
            }
            ViewBag.T_OrgCodesIsHiddenRule       = checkHidden("T_OrgCodes", "OnDetails", false);
            ViewBag.T_OrgCodesIsGroupsHiddenRule = checkHidden("T_OrgCodes", "OnDetails", true);
            ViewBag.T_OrgCodesIsSetValueUIRule   = checkSetValueUIRule("T_OrgCodes", "OnDetails");
            return(View(ViewBag.TemplatesName, t_orgcodes));
        }
Ejemplo n.º 8
0
        public string CheckBeforeSave(T_OrgCodes t_orgcodes, 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);
        }
Ejemplo n.º 9
0
        public bool CheckBeforeDelete(T_OrgCodes t_orgcodes)
        {
            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);
        }
Ejemplo n.º 10
0
        public ActionResult Create([Bind(Include = "Id,ConcurrencyKey,T_OrgCode,T_CodeDescription")] T_OrgCodes t_orgcodes, string UrlReferrer, bool?IsDDAdd)
        {
            string command = Request.Form["hdncommand"];

            CheckBeforeSave(t_orgcodes, command);

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

            if (IsDDAdd != null)
            {
                ViewBag.IsDDAdd = Convert.ToBoolean(IsDDAdd);
            }
            LoadViewDataAfterOnCreate(t_orgcodes);
            ViewData["T_OrgCodesParentUrl"]      = UrlReferrer;
            ViewBag.T_OrgCodesIsHiddenRule       = checkHidden("T_OrgCodes", "OnCreate", false);
            ViewBag.T_OrgCodesIsGroupsHiddenRule = checkHidden("T_OrgCodes", "OnCreate", true);
            ViewBag.T_OrgCodesIsSetValueUIRule   = checkSetValueUIRule("T_OrgCodes", "OnCreate");
            return(View(t_orgcodes));
        }
Ejemplo n.º 11
0
 public ActionResult EditWizard([Bind(Include = "Id,ConcurrencyKey,T_OrgCode,T_CodeDescription")] T_OrgCodes t_orgcodes, string UrlReferrer)
 {
     CheckBeforeSave(t_orgcodes);
     if (ModelState.IsValid)
     {
         bool customsave_hasissues = false;
         if (!CustomSaveOnEdit(t_orgcodes, out customsave_hasissues, "Save"))
         {
             db.Entry(t_orgcodes).State = EntityState.Modified;
             db.SaveChanges();
         }
         if (!customsave_hasissues)
         {
             RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_orgcodes, "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_orgcodes);
     ViewBag.T_OrgCodesIsHiddenRule       = checkHidden("T_OrgCodes", "OnEdit", false);
     ViewBag.T_OrgCodesIsGroupsHiddenRule = checkHidden("T_OrgCodes", "OnEdit", true);
     ViewBag.T_OrgCodesIsSetValueUIRule   = checkSetValueUIRule("T_OrgCodes", "OnEdit");
     return(View(t_orgcodes));
 }
Ejemplo n.º 12
0
        public ActionResult BulkUpdate([Bind(Include = "Id,ConcurrencyKey,T_OrgCode,T_CodeDescription")] T_OrgCodes t_orgcodes, 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_OrgCodes target = db.T_OrgCodess.Find(objId);
                    target.setDateTimeToClientTime();
                    EntityCopy.CopyValuesForSameObjectType(t_orgcodes, target, chkUpdate);
                    customsave_hasissues = false;
                    CheckBeforeSave(target, "BulkUpdate");
                    if (ValidateModel(target) && !CustomSaveOnEdit(target, out customsave_hasissues, "BulkUpdate"))
                    {
                        db.Entry(target).State = EntityState.Modified;
                        try
                        {
                            db.SaveChanges();
                        }
                        catch { }
                    }
                }
            }
            RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_orgcodes, "BulkUpdate", "");

            if (customRedirectAction != null)
            {
                return(customRedirectAction);
            }
            if (!string.IsNullOrEmpty(UrlReferrer))
            {
                return(Redirect(UrlReferrer));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Ejemplo n.º 13
0
        public ActionResult EditQuick([Bind(Include = "Id,ConcurrencyKey,T_OrgCode,T_CodeDescription")] T_OrgCodes t_orgcodes, string UrlReferrer, bool?IsAddPop, string AssociatedEntity)
        {
            string command = Request.Form["hdncommand"];

            CheckBeforeSave(t_orgcodes, command);

            if (ModelState.IsValid)
            {
                bool customsave_hasissues = false;
                if (!CustomSaveOnEdit(t_orgcodes, out customsave_hasissues, command))
                {
                    db.Entry(t_orgcodes).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_orgcodes);
            ViewBag.T_OrgCodesIsHiddenRule       = checkHidden("T_OrgCodes", "OnEdit", false);
            ViewBag.T_OrgCodesIsGroupsHiddenRule = checkHidden("T_OrgCodes", "OnEdit", true);
            ViewBag.T_OrgCodesIsSetValueUIRule   = checkSetValueUIRule("T_OrgCodes", "OnEdit");
            return(View(t_orgcodes));
        }
Ejemplo n.º 14
0
        public ActionResult EditQuick(int?id, string UrlReferrer, string HostingEntityName, string AssociatedType, string viewtype)
        {
            if (!User.CanEdit("T_OrgCodes") || !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_OrgCodes t_orgcodes = db.T_OrgCodess.Find(id);

            if (t_orgcodes == null)
            {
                return(HttpNotFound());
            }
            if (UrlReferrer != null)
            {
                ViewData["T_OrgCodesParentUrl"] = UrlReferrer;
            }
            if (ViewData["T_OrgCodesParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_OrgCodes") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_OrgCodes/Edit/" + t_orgcodes.Id + "") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_OrgCodes/Create"))
            {
                ViewData["T_OrgCodesParentUrl"] = Request.UrlReferrer;
            }
            ViewData["HostingEntityName"] = HostingEntityName;
            ViewData["AssociatedType"]    = AssociatedType;
            LoadViewDataBeforeOnEdit(t_orgcodes);
            ViewBag.T_OrgCodesIsHiddenRule       = checkHidden("T_OrgCodes", "OnEdit", false);
            ViewBag.T_OrgCodesIsGroupsHiddenRule = checkHidden("T_OrgCodes", "OnEdit", true);
            ViewBag.T_OrgCodesIsSetValueUIRule   = checkSetValueUIRule("T_OrgCodes", "OnEdit");
            var objT_OrgCodes = new List <T_OrgCodes>();

            ViewBag.T_OrgCodesDD = new SelectList(objT_OrgCodes, "ID", "DisplayValue");
            return(View(t_orgcodes));
        }
Ejemplo n.º 15
0
        // GET: /T_OrgCodes/Delete/5
        public ActionResult Delete(int id)
        {
            if (!User.CanDelete("T_OrgCodes") || !CustomAuthorizationBeforeDelete(id))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_OrgCodes t_orgcodes = db.T_OrgCodess.Find(id);

            if (t_orgcodes == null)
            {
                throw(new Exception("Deleted"));
            }
            if (ViewData["T_OrgCodesParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_OrgCodes"))
            {
                ViewData["T_OrgCodesParentUrl"] = Request.UrlReferrer;
            }
            return(View(t_orgcodes));
        }
Ejemplo n.º 16
0
 public ActionResult CreateQuick([Bind(Include = "Id,ConcurrencyKey,T_OrgCode,T_CodeDescription")] T_OrgCodes t_orgcodes, string UrlReferrer, bool?IsAddPop, string AssociatedEntity, string HostingEntityName, string HostingEntityID)
 {
     CheckBeforeSave(t_orgcodes);
     if (ModelState.IsValid)
     {
         bool customcreate_hasissues = false;
         if (!CustomSaveOnCreate(t_orgcodes, out customcreate_hasissues, "Create"))
         {
             db.T_OrgCodess.Add(t_orgcodes);
             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_orgcodes);
     ViewBag.T_OrgCodesIsHiddenRule       = checkHidden("T_OrgCodes", "OnCreate", false);
     ViewBag.T_OrgCodesIsGroupsHiddenRule = checkHidden("T_OrgCodes", "OnCreate", true);
     ViewBag.T_OrgCodesIsSetValueUIRule   = checkSetValueUIRule("T_OrgCodes", "OnCreate");
     if (!string.IsNullOrEmpty(AssociatedEntity))
     {
         LoadViewDataForCount(t_orgcodes, AssociatedEntity);
     }
     return(View(t_orgcodes));
 }
Ejemplo n.º 17
0
 public void AfterSave(T_OrgCodes t_orgcodes)
 {
     // Write your logic here
 }
Ejemplo n.º 18
0
 public void OnSaving(T_OrgCodes t_orgcodes, ApplicationContext db)
 {
     // Write your logic here
 }
Ejemplo n.º 19
0
 public void OnDeleting(T_OrgCodes t_orgcodes)
 {
     // Write your logic here
 }
Ejemplo n.º 20
0
 private RedirectToRouteResult CustomRedirectUrl(T_OrgCodes t_orgcodes, string action, string command = "")
 {
     // Sample Custom implemention below
     // return RedirectToAction("Index", "T_OrgCodes");
     return(null);
 }
Ejemplo n.º 21
0
        public ActionResult Edit(int?id, string UrlReferrer, string HostingEntityName, string AssociatedType, string defaultview)
        {
            if (!User.CanEdit("T_OrgCodes") || !CustomAuthorizationBeforeEdit(id, HostingEntityName, AssociatedType))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_OrgCodes t_orgcodes = db.T_OrgCodess.Find(id);

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

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

            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_OrgCodesDisplayValueEdit = new SelectList(lst, "ID", "DisplayValue");
            //
            if (t_orgcodes == 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_OrgCodes/Create"))
            {
                newList.Insert(0, (new SelectListItem {
                    Text = t_orgcodes.DisplayValue, Value = t_orgcodes.Id.ToString()
                }));
                ViewBag.EntityT_OrgCodesDisplayValueEdit = newList;
                TempData["T_OrgCodeslist"] = newList.Select(z => new { ID = z.Value, DisplayValue = z.Text });
            }
            else if (!newList.Exists(p => p.Value == Convert.ToString(t_orgcodes.Id)))
            {
                if (newList.Count > 0)
                {
                    newList[0].Text  = t_orgcodes.DisplayValue;
                    newList[0].Value = t_orgcodes.Id.ToString();
                }
                else
                {
                    newList.Insert(0, (new SelectListItem {
                        Text = t_orgcodes.DisplayValue, Value = t_orgcodes.Id.ToString()
                    }));
                }
                ViewBag.EntityT_OrgCodesDisplayValueEdit = newList;
                TempData["T_OrgCodeslist"] = newList.Select(z => new { ID = z.Value, DisplayValue = z.Text });
            }
            //
            if (UrlReferrer != null)
            {
                ViewData["T_OrgCodesParentUrl"] = UrlReferrer;
            }
            if (ViewData["T_OrgCodesParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_OrgCodes") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_OrgCodes/Edit/" + t_orgcodes.Id + "") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_OrgCodes/Create"))
            {
                ViewData["T_OrgCodesParentUrl"] = Request.UrlReferrer;
            }
            ViewData["HostingEntityName"] = HostingEntityName;
            ViewData["AssociatedType"]    = AssociatedType;
            LoadViewDataBeforeOnEdit(t_orgcodes);
            ViewBag.T_OrgCodesIsHiddenRule       = checkHidden("T_OrgCodes", "OnEdit", false);
            ViewBag.T_OrgCodesIsGroupsHiddenRule = checkHidden("T_OrgCodes", "OnEdit", true);
            ViewBag.T_OrgCodesIsSetValueUIRule   = checkSetValueUIRule("T_OrgCodes", "OnEdit");
            return(View(t_orgcodes));
        }
Ejemplo n.º 22
0
        public ActionResult Edit([Bind(Include = "Id,ConcurrencyKey,T_OrgCode,T_CodeDescription")] T_OrgCodes t_orgcodes, string UrlReferrer)
        {
            string command = Request.Form["hdncommand"];

            CheckBeforeSave(t_orgcodes, command);
            if (ModelState.IsValid)
            {
                bool customsave_hasissues = false;
                if (!CustomSaveOnEdit(t_orgcodes, out customsave_hasissues, command))
                {
                    db.Entry(t_orgcodes).State = EntityState.Modified;
                    db.SaveChanges();
                }
                if (!customsave_hasissues)
                {
                    RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_orgcodes, "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_orgcodes.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_OrgCodeslist"] == null)
            {
                json = Newtonsoft.Json.JsonConvert.SerializeObject(db.T_OrgCodess.Select(z => new { ID = z.Id, DisplayValue = z.DisplayValue }).ToList());
            }
            else
            {
                ViewBag.EntityT_OrgCodesDisplayValueEdit = TempData["T_OrgCodeslist"];
                json = Newtonsoft.Json.JsonConvert.SerializeObject(TempData["T_OrgCodeslist"]);
            }

            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_OrgCodesDisplayValueEdit = new SelectList(lst, "ID", "DisplayValue");
            //
            LoadViewDataAfterOnEdit(t_orgcodes);
            ViewData["T_OrgCodesParentUrl"]      = UrlReferrer;
            ViewBag.T_OrgCodesIsHiddenRule       = checkHidden("T_OrgCodes", "OnEdit", false);
            ViewBag.T_OrgCodesIsGroupsHiddenRule = checkHidden("T_OrgCodes", "OnEdit", true);
            ViewBag.T_OrgCodesIsSetValueUIRule   = checkSetValueUIRule("T_OrgCodes", "OnEdit");
            return(View(t_orgcodes));
        }
Ejemplo n.º 23
0
 private void CustomLoadViewDataListAfterEdit(T_OrgCodes t_orgcodes)
 {
 }
Ejemplo n.º 24
0
 private void CustomLoadViewDataListBeforeEdit(T_OrgCodes t_orgcodes)
 {
 }
Ejemplo n.º 25
0
 private void CustomLoadViewDataListAfterOnCreate(T_OrgCodes t_orgcodes)
 {
 }