public ActionResult BulkUpdate([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringFrequency t_recurringfrequency, 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_RecurringFrequency target = db.T_RecurringFrequencys.Find(objId); EntityCopy.CopyValuesForSameObjectType(t_recurringfrequency, target, chkUpdate); db.Entry(target).State = EntityState.Modified; try { db.SaveChanges(); } catch { } } } if (!string.IsNullOrEmpty(UrlReferrer)) { return(Redirect(UrlReferrer)); } else { return(RedirectToAction("Index")); } }
public ActionResult DeleteConfirmed(T_RecurringFrequency t_recurringfrequency, string UrlReferrer) { if (!User.CanDelete("T_RecurringFrequency")) { return(RedirectToAction("Index", "Error")); } if (CheckBeforeDelete(t_recurringfrequency)) { //Delete Document db.Entry(t_recurringfrequency).State = EntityState.Deleted; db.T_RecurringFrequencys.Remove(t_recurringfrequency); db.SaveChanges(); if (!string.IsNullOrEmpty(UrlReferrer)) { return(Redirect(UrlReferrer)); } if (ViewData["T_RecurringFrequencyParentUrl"] != null) { string parentUrl = ViewData["T_RecurringFrequencyParentUrl"].ToString(); ViewData["T_RecurringFrequencyParentUrl"] = null; return(Redirect(parentUrl)); } else { return(RedirectToAction("Index")); } } return(View(t_recurringfrequency)); }
public ActionResult EditWizard([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringFrequency t_recurringfrequency, string UrlReferrer) { CheckBeforeSave(t_recurringfrequency); if (ModelState.IsValid) { db.Entry(t_recurringfrequency).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_recurringfrequency); return(View(t_recurringfrequency)); }
// GET: /T_RecurringFrequency/Edit/5 public ActionResult Edit(int?id, string UrlReferrer, string HostingEntityName, string AssociatedType) { if (!User.CanEdit("T_RecurringFrequency")) { return(RedirectToAction("Index", "Error")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_RecurringFrequency t_recurringfrequency = db.T_RecurringFrequencys.Find(id); if (t_recurringfrequency == null) { return(HttpNotFound()); } if (UrlReferrer != null) { ViewData["T_RecurringFrequencyParentUrl"] = UrlReferrer; } if (ViewData["T_RecurringFrequencyParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringFrequency") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringFrequency/Edit/" + t_recurringfrequency.Id + "") && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringFrequency/Create")) { ViewData["T_RecurringFrequencyParentUrl"] = Request.UrlReferrer; } ViewData["HostingEntityName"] = HostingEntityName; ViewData["AssociatedType"] = AssociatedType; LoadViewDataBeforeOnEdit(t_recurringfrequency); ViewBag.T_RecurringFrequencyIsHiddenRule = checkHidden("T_RecurringFrequency", "OnEdit"); return(View(t_recurringfrequency)); }
// GET: /T_RecurringFrequency/EditWizard/5 public ActionResult EditWizard(int?id, string UrlReferrer) { if (!User.CanEdit("T_RecurringFrequency")) { return(RedirectToAction("Index", "Error")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_RecurringFrequency t_recurringfrequency = db.T_RecurringFrequencys.Find(id); if (t_recurringfrequency == null) { return(HttpNotFound()); } if (UrlReferrer != null) { ViewData["T_RecurringFrequencyParentUrl"] = UrlReferrer; } if (ViewData["T_RecurringFrequencyParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringFrequency")) { ViewData["T_RecurringFrequencyParentUrl"] = Request.UrlReferrer; } LoadViewDataBeforeOnEdit(t_recurringfrequency); ViewBag.T_RecurringFrequencyIsHiddenRule = checkHidden("T_RecurringFrequency", "OnEdit"); return(View(t_recurringfrequency)); }
public ActionResult EditQuick([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringFrequency t_recurringfrequency, string UrlReferrer, bool?IsAddPop, string AssociatedEntity) { CheckBeforeSave(t_recurringfrequency); if (ModelState.IsValid) { string command = Request.Form["hdncommand"]; db.Entry(t_recurringfrequency).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_recurringfrequency); return(View(t_recurringfrequency)); }
public ActionResult Create([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringFrequency t_recurringfrequency, string UrlReferrer, bool?IsDDAdd) { CheckBeforeSave(t_recurringfrequency); if (ModelState.IsValid) { string command = Request.Form["hdncommand"]; db.T_RecurringFrequencys.Add(t_recurringfrequency); db.SaveChanges(); if (command == "Create & Continue") { return(RedirectToAction("Edit", new { Id = t_recurringfrequency.Id, UrlReferrer = UrlReferrer })); } if (!string.IsNullOrEmpty(UrlReferrer)) { return(Redirect(UrlReferrer)); } else { return(RedirectToAction("Index")); } } if (IsDDAdd != null) { ViewBag.IsDDAdd = Convert.ToBoolean(IsDDAdd); } LoadViewDataAfterOnCreate(t_recurringfrequency); return(View(t_recurringfrequency)); }
public ActionResult CreateQuick([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringFrequency t_recurringfrequency, string UrlReferrer, bool?IsAddPop, string AssociatedEntity) { CheckBeforeSave(t_recurringfrequency); if (ModelState.IsValid) { db.T_RecurringFrequencys.Add(t_recurringfrequency); 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_recurringfrequency); if (!string.IsNullOrEmpty(AssociatedEntity)) { LoadViewDataForCount(t_recurringfrequency, AssociatedEntity); } return(View(t_recurringfrequency)); }
public ActionResult DeleteBulk(long[] ids, string UrlReferrer) { foreach (var id in ids.Where(p => p > 0)) { T_RecurringFrequency t_recurringfrequency = db.T_RecurringFrequencys.Find(id); db.Entry(t_recurringfrequency).State = EntityState.Deleted; db.T_RecurringFrequencys.Remove(t_recurringfrequency); try { db.SaveChanges(); } catch { } } return(Json("Success", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet)); }
public ActionResult CreateWizard([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_RecurringFrequency t_recurringfrequency, string UrlReferrer) { CheckBeforeSave(t_recurringfrequency); if (ModelState.IsValid) { db.T_RecurringFrequencys.Add(t_recurringfrequency); db.SaveChanges(); if (!string.IsNullOrEmpty(UrlReferrer)) { return(Redirect(UrlReferrer)); } else { return(RedirectToAction("Index")); } } LoadViewDataAfterOnCreate(t_recurringfrequency); return(View(t_recurringfrequency)); }
// GET: /T_RecurringFrequency/Delete/5 public ActionResult Delete(int id) { if (!User.CanDelete("T_RecurringFrequency")) { return(RedirectToAction("Index", "Error")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_RecurringFrequency t_recurringfrequency = db.T_RecurringFrequencys.Find(id); if (t_recurringfrequency == null) { throw(new Exception("Deleted")); } if (ViewData["T_RecurringFrequencyParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_RecurringFrequency")) { ViewData["T_RecurringFrequencyParentUrl"] = Request.UrlReferrer; } return(View(t_recurringfrequency)); }
// GET: /T_RecurringFrequency/Details/5 public ActionResult Details(int?id, string HostingEntityName, string AssociatedType) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_RecurringFrequency t_recurringfrequency = db.T_RecurringFrequencys.Find(id); if (t_recurringfrequency == null) { return(HttpNotFound()); } GetTemplatesForDetails(); ViewData["AssociatedType"] = AssociatedType; ViewData["HostingEntityName"] = HostingEntityName; LoadViewDataBeforeOnEdit(t_recurringfrequency); if (!string.IsNullOrEmpty(AssociatedType)) { LoadViewDataForCount(t_recurringfrequency, AssociatedType); } ViewBag.T_RecurringFrequencyIsHiddenRule = checkHidden("T_RecurringFrequency", "OnDetails"); return(View(ViewBag.TemplatesName, t_recurringfrequency)); }