public ActionResult BulkUpdate([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_MonthlyRepeatType t_monthlyrepeattype, 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_MonthlyRepeatType target = db.T_MonthlyRepeatTypes.Find(objId);
                    EntityCopy.CopyValuesForSameObjectType(t_monthlyrepeattype, 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_MonthlyRepeatType t_monthlyrepeattype, string UrlReferrer)
 {
     if (!User.CanDelete("T_MonthlyRepeatType"))
     {
         return(RedirectToAction("Index", "Error"));
     }
     if (CheckBeforeDelete(t_monthlyrepeattype))
     {
         //Delete Document
         db.Entry(t_monthlyrepeattype).State = EntityState.Deleted;
         db.T_MonthlyRepeatTypes.Remove(t_monthlyrepeattype);
         db.SaveChanges();
         if (!string.IsNullOrEmpty(UrlReferrer))
         {
             return(Redirect(UrlReferrer));
         }
         if (ViewData["T_MonthlyRepeatTypeParentUrl"] != null)
         {
             string parentUrl = ViewData["T_MonthlyRepeatTypeParentUrl"].ToString();
             ViewData["T_MonthlyRepeatTypeParentUrl"] = null;
             return(Redirect(parentUrl));
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(t_monthlyrepeattype));
 }
 public ActionResult EditWizard([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_MonthlyRepeatType t_monthlyrepeattype, string UrlReferrer)
 {
     CheckBeforeSave(t_monthlyrepeattype);
     if (ModelState.IsValid)
     {
         db.Entry(t_monthlyrepeattype).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_monthlyrepeattype);
     return(View(t_monthlyrepeattype));
 }
        public ActionResult EditQuick([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_MonthlyRepeatType t_monthlyrepeattype, string UrlReferrer, bool?IsAddPop, string AssociatedEntity)
        {
            CheckBeforeSave(t_monthlyrepeattype);
            if (ModelState.IsValid)
            {
                string command = Request.Form["hdncommand"];
                db.Entry(t_monthlyrepeattype).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_monthlyrepeattype);
            return(View(t_monthlyrepeattype));
        }
        // GET: /T_MonthlyRepeatType/EditWizard/5
        public ActionResult EditWizard(int?id, string UrlReferrer)
        {
            if (!User.CanEdit("T_MonthlyRepeatType"))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_MonthlyRepeatType t_monthlyrepeattype = db.T_MonthlyRepeatTypes.Find(id);

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

            if (UrlReferrer != null)
            {
                ViewData["T_MonthlyRepeatTypeParentUrl"] = UrlReferrer;
            }
            if (ViewData["T_MonthlyRepeatTypeParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_MonthlyRepeatType"))
            {
                ViewData["T_MonthlyRepeatTypeParentUrl"] = Request.UrlReferrer;
            }
            LoadViewDataBeforeOnEdit(t_monthlyrepeattype);
            ViewBag.T_MonthlyRepeatTypeIsHiddenRule = checkHidden("T_MonthlyRepeatType", "OnEdit");
            return(View(t_monthlyrepeattype));
        }
        // GET: /T_MonthlyRepeatType/Edit/5
        public ActionResult EditQuick(int?id, string UrlReferrer, string HostingEntityName, string AssociatedType)
        {
            if (!User.CanEdit("T_MonthlyRepeatType"))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_MonthlyRepeatType t_monthlyrepeattype = db.T_MonthlyRepeatTypes.Find(id);

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

            if (IsDDAdd != null)
            {
                ViewBag.IsDDAdd = Convert.ToBoolean(IsDDAdd);
            }
            LoadViewDataAfterOnCreate(t_monthlyrepeattype);
            return(View(t_monthlyrepeattype));
        }
 public ActionResult CreateQuick([Bind(Include = "Id,ConcurrencyKey,T_Name,T_Description")] T_MonthlyRepeatType t_monthlyrepeattype, string UrlReferrer, bool?IsAddPop, string AssociatedEntity)
 {
     CheckBeforeSave(t_monthlyrepeattype);
     if (ModelState.IsValid)
     {
         db.T_MonthlyRepeatTypes.Add(t_monthlyrepeattype);
         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_monthlyrepeattype);
     if (!string.IsNullOrEmpty(AssociatedEntity))
     {
         LoadViewDataForCount(t_monthlyrepeattype, AssociatedEntity);
     }
     return(View(t_monthlyrepeattype));
 }
 public ActionResult DeleteBulk(long[] ids, string UrlReferrer)
 {
     foreach (var id in ids.Where(p => p > 0))
     {
         T_MonthlyRepeatType t_monthlyrepeattype = db.T_MonthlyRepeatTypes.Find(id);
         db.Entry(t_monthlyrepeattype).State = EntityState.Deleted;
         db.T_MonthlyRepeatTypes.Remove(t_monthlyrepeattype);
         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_MonthlyRepeatType t_monthlyrepeattype, string UrlReferrer)
        {
            CheckBeforeSave(t_monthlyrepeattype);
            if (ModelState.IsValid)
            {
                db.T_MonthlyRepeatTypes.Add(t_monthlyrepeattype);
                db.SaveChanges();

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

            LoadViewDataAfterOnCreate(t_monthlyrepeattype);
            return(View(t_monthlyrepeattype));
        }
        // GET: /T_MonthlyRepeatType/Delete/5
        public ActionResult Delete(int id)
        {
            if (!User.CanDelete("T_MonthlyRepeatType"))
            {
                return(RedirectToAction("Index", "Error"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_MonthlyRepeatType t_monthlyrepeattype = db.T_MonthlyRepeatTypes.Find(id);

            if (t_monthlyrepeattype == null)
            {
                throw(new Exception("Deleted"));
            }
            if (ViewData["T_MonthlyRepeatTypeParentUrl"] == null && Request.UrlReferrer != null && !Request.UrlReferrer.AbsolutePath.EndsWith("/T_MonthlyRepeatType"))
            {
                ViewData["T_MonthlyRepeatTypeParentUrl"] = Request.UrlReferrer;
            }
            return(View(t_monthlyrepeattype));
        }
        // GET: /T_MonthlyRepeatType/Details/5
        public ActionResult Details(int?id, string HostingEntityName, string AssociatedType)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_MonthlyRepeatType t_monthlyrepeattype = db.T_MonthlyRepeatTypes.Find(id);

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