///// <summary> ///// To get selected record details or empty form ///// </summary> ///// <param name="ID">ID of record to fetch</param> ///// <returns>pre-filled view</returns> //public ActionResult Edit(int ID = 0) //{ // try // { // if (ID != 0) // { // Edit mode // var data = BusinessObject.Get(ID); // Get the record from DB // return View(data); // } // else // { // Create mode // var data = new TblAWC(); // return View(data); // return view with appropriate data // } // } // catch (CustomException ex) // { // LogManager.Instance.Error(ex); // return Content(ex.Message); // } // catch (Exception ex) // { // LogManager.Instance.Error(ex); // return Content(Constants.Error); // } //} ///// <summary> ///// To save or update the record ///// </summary> ///// <param name="AWC">AWC object to save or update</param> ///// <returns>status</returns> //[HttpPost] //public ActionResult Edit(TblAWC data) //{ // try // { // if (data == null || !ModelState.IsValid) // validate data // throw new CustomException("Invalid Data", null); // var status = BusinessObject.Save(data); // save data // return Json(status.ToString(), JsonRequestBehavior.AllowGet); // return status of the operation // } // catch (CustomException ex) // { // LogManager.Instance.Error(ex); // return Content(ex.Message); // } // catch (Exception ex) // { // LogManager.Instance.Error(ex); // return Content(Constants.Error); // } //} ///// <summary> ///// To toggle Active state of a record ///// </summary> ///// <param name="ID">ID of the record to toggle</param> ///// <returns>status</returns> //[HttpPost] //public ActionResult ToggleActive(int ID) //{ // try // { // var status = BusinessObject.ToggleActive(ID); // Toggle active / inactive for record // return Content(status.ToString()); // return status of the operation // } // catch (CustomException ex) // { // LogManager.Instance.Error(ex); // return Content(ex.Message); // } // catch (Exception ex) // { // LogManager.Instance.Error(ex); // return Content(Constants.Error); // } //} ///// <summary> ///// To delete a record ///// </summary> ///// <param name="ID">ID of the record to delete</param> ///// <returns>status</returns> //[HttpPost] //public ActionResult Delete(int ID) //{ // try // { // var status = BusinessObject.Delete(ID); // Delete the selected record // return Content(status.ToString()); // return status of the operation // } // catch (CustomException ex) // { // LogManager.Instance.Error(ex); // return Content(ex.Message); // } // catch (Exception ex) // { // LogManager.Instance.Error(ex); // return Content(Constants.Error); // } //} public ActionResult CreateAWC() { try { string userType = Convert.ToString(Session["UserTypeID"]); if (string.IsNullOrEmpty(userType)) { return(RedirectToAction("MainIndex", "Login")); } var ResultData = Common.GetUserRights(userType, "/" + Request.RequestContext.RouteData.Values["Controller"].ToString() + "/" + Request.RequestContext.RouteData.Values["Action"].ToString()); if (ResultData.Count != 0) { List <SpGetStates_Result> States = _loginBuss.GetStates().ToList(); States.Insert(0, new SpGetStates_Result { StateCode = "0", StateName = "--Select State--" }); ViewBag.States = States.Select(m => new SelectListItem() { Text = m.StateName.ToString(), Value = m.StateCode.ToString() }); return(View()); } else { return(RedirectToAction("Index", "Login")); } } catch (Exception ex) { return(Content(ex.Message.ToString())); } }
public ActionResult MasterIndex(string Dist, string Proje, string Sector, string Center) { string userType = Convert.ToString(Session["UserTypeID"]); string UserCenterType = Convert.ToString(Session["UserCenterType"]); if (string.IsNullOrEmpty(userType)) { return(RedirectToAction("MainIndex", "Login")); } var ResultData = Common.GetUserRights(userType, "/" + Request.RequestContext.RouteData.Values["Controller"].ToString() + "/" + Request.RequestContext.RouteData.Values["Action"].ToString()); if (ResultData.Count != 0) { List <SpGetStates_Result> States = _loginBuss.GetStates().ToList(); States.Insert(0, new SpGetStates_Result { StateCode = "0", StateName = "--Select State--" }); ViewBag.States = States.Select(m => new SelectListItem() { Text = m.StateName.ToString(), Value = m.StateCode.ToString() }); ViewBag.statecode = Session["UserState"].ToString(); //Months Binding Dictionary <int, string> dDur = new Dictionary <int, string>(); dDur.Add(0, "--Select Month--"); for (int i = 1; i <= 12; i++) { dDur.Add(i, CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i)); } ViewBag.Months = dDur.Select(item => new SelectListItem { Value = item.Key.ToString(), Text = item.Value }); var Data = _loginBuss.GetBeneType(); ViewBag.BeneType = Data.AsEnumerable().Select(m => new SelectListItem() { Text = m.BeneType, Value = m.BeneTypeID.ToString() }); //Get Center Types List <SPGetCentersType_Result> CenterTypes = _loginBuss.GetCenterTypes(UserCenterType).ToList(); ViewBag.CenterType = CenterTypes.Select(m => new SelectListItem() { Text = m.CenterType.ToString(), Value = m.CenterTypeID.ToString() }); return(View()); } else { return(RedirectToAction("Index", "Login")); } }
public ActionResult ProjectMaster() { string UserCenterType = Convert.ToString(Session["UserCenterType"]); string userType = Convert.ToString(Session["UserTypeID"]); if (string.IsNullOrEmpty(userType)) { return(RedirectToAction("MainIndex", "Login")); } List <SpGetStates_Result> States = _loginBuss.GetStates().ToList(); States.Insert(0, new SpGetStates_Result { StateCode = "0", StateName = "--Select State--" }); ViewBag.States = States.Select(m => new SelectListItem() { Text = m.StateName.ToString(), Value = m.StateCode.ToString() }); //Get Center Types List <SPGetCentersType_Result> CenterTypes = _loginBuss.GetCenterTypes(UserCenterType).ToList(); ViewBag.CenterType = CenterTypes.Select(m => new SelectListItem() { Text = m.CenterType.ToString(), Value = m.CenterTypeID.ToString() }); return(View()); }
public ActionResult SectorMaster() { string userType = Convert.ToString(Session["UserTypeID"]); string UserCenterType = Convert.ToString(Session["UserCenterType"]); if (string.IsNullOrEmpty(userType)) { return(RedirectToAction("MainIndex", "Login")); } var ResultData = Common.GetUserRights(userType, "/" + Request.RequestContext.RouteData.Values["Controller"].ToString() + "/" + Request.RequestContext.RouteData.Values["Action"].ToString()); if (ResultData.Count != 0) { List <SpGetStates_Result> States = _loginBuss.GetStates().ToList(); States.Insert(0, new SpGetStates_Result { StateCode = "0", StateName = "--Select State--" }); ViewBag.States = States.Select(m => new SelectListItem() { Text = m.StateName.ToString(), Value = m.StateCode.ToString() }); //Get Center Types List <SPGetCentersType_Result> CenterTypes = _loginBuss.GetCenterTypes(UserCenterType).ToList(); ViewBag.CenterType = CenterTypes.Select(m => new SelectListItem() { Text = m.CenterType.ToString(), Value = m.CenterTypeID.ToString() }); return(View()); } else { return(RedirectToAction("Index", "Login")); } }