public ActionResult IndexSuppliers() { ViewBag.AllowAdd = this.HasPermission(ControllerName.Setups + "-CreateSuppliers"); ViewBag.AllowEdit = this.HasPermission(ControllerName.Setups + "-EditSuppliers"); ViewBag.AllowLoadEdit = this.HasPermission(ControllerName.Setups + "-LoadEditSuppliers"); ViewBag.AllowDelete = this.HasPermission(ControllerName.Setups + "-DeleteSuppliers"); DataTable dtRegion = RegionsBI.GetRegions(); ViewData["RegionName"] = General.DataTableToSelectList(dtRegion, "RegionId", "RegionName", "0", TopEmptyItem: new SelectListItem { Value = "0", Text = "" }); DataTable dtDistrict = DistrictsBI.GetDistricts(); ViewData["DistrictName"] = General.DataTableToSelectList(dtDistrict, "DistrictId", "DistrictName", "0", TopEmptyItem: new SelectListItem { Value = "0", Text = "" }); Suppliers eSuppliers = new Suppliers(); eSuppliers.dtSuppliers = SuppliersBI.GetSuppliers(); return(View(eSuppliers)); }
public ActionResult DeleteDistrict(Districts eDistricts) { string message = ""; try { if (eDistricts.DistrictId > 0) { FASM_Enums.InfoMessages DeleteResult = DistrictsBI.DeleteDistricts(eDistricts.DistrictId); switch (DeleteResult) { case FASM_Enums.InfoMessages.Success: message = "Successfully Deleted!"; break; case FASM_Enums.InfoMessages.Failed: message = "Still in Use!"; break; } return(new JsonResult { Data = message, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } } catch (Exception ex) { ViewBag.CatchedMsg = ex.Message; } return(View()); }
public ActionResult CreateDistrict(Districts eDistricts) { string message = ""; if (ModelState.IsValid) { try { FASM_Enums.InfoMessages SaveResult = DistrictsBI.SaveDistricts(ref eDistricts); switch (SaveResult) { case FASM_Enums.InfoMessages.Success: message = FASM_Msg.SuccessfulSaved; break; case FASM_Enums.InfoMessages.AlreadyExist: message = "Sorry! the district name already exist"; break; } return(Json(new { msg = message, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { ViewBag.CatchedMsg = ex.Message; } } return(View(eDistricts)); }
public ActionResult IndexDistrict() { ViewBag.AllowAdd = this.HasPermission(ControllerName.Setups + "-CreateDistrict"); ViewBag.AllowEdit = this.HasPermission(ControllerName.Setups + "-EditDistrict"); ViewBag.AllowDelete = this.HasPermission(ControllerName.Setups + "-DeleteDistrict"); Districts eDistricts = new Districts(); eDistricts.dtDistricts = DistrictsBI.GetDistricts(); return(View(eDistricts)); }
public ActionResult EditSuppliers(Suppliers eSuppliers) { if (eSuppliers.isLoad == false) { DataTable dtRegion = RegionsBI.GetRegions(); ViewData["RegionName"] = General.DataTableToSelectList(dtRegion, "RegionId", "RegionName", "0", TopEmptyItem: new SelectListItem { Value = "0", Text = "" }); DataTable dtDistrict = DistrictsBI.GetDistricts(); ViewData["DistrictName"] = General.DataTableToSelectList(dtDistrict, "DistrictId", "DistrictName", "0", TopEmptyItem: new SelectListItem { Value = "0", Text = "" }); eSuppliers.SupplierId = Convert.ToInt32(Request.Params["SupplierId"]); SuppliersBI.LoadSuppliers(ref eSuppliers); return(PartialView(eSuppliers)); } else { string message = ""; if (ModelState.IsValid) { try { FASM_Enums.InfoMessages Results = SuppliersBI.SaveSuppliers(ref eSuppliers); switch (Results) { case FASM_Enums.InfoMessages.Success: message = FASM_Msg.Updated; break; case FASM_Enums.InfoMessages.AlreadyExist: message = "Sorry! the Email " + eSuppliers.Email + " " + FASM_Msg.AlreadyExist; break; } return(Json(new { msg = message, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { ViewBag.CatchedMsg = ex.Message; } } } return(View(eSuppliers)); }
public ActionResult CreateSuppliers(Suppliers eSuppliers) { string message = ""; if (ModelState.IsValid) { try { DataTable dtRegion = RegionsBI.GetRegions(); ViewData["RegionName"] = General.DataTableToSelectList(dtRegion, "RegionId", "RegionName", "0", TopEmptyItem: new SelectListItem { Value = "0", Text = "" }); DataTable dtDistrict = DistrictsBI.GetDistricts(); ViewData["DistrictName"] = General.DataTableToSelectList(dtDistrict, "DistrictId", "DistrictName", "0", TopEmptyItem: new SelectListItem { Value = "0", Text = "" }); FASM_Enums.InfoMessages SaveResult = SuppliersBI.SaveSuppliers(ref eSuppliers); switch (SaveResult) { case FASM_Enums.InfoMessages.Success: message = FASM_Msg.SuccessfulSaved; break; case FASM_Enums.InfoMessages.AlreadyExist: message = FASM_Msg.AlreadyExist; break; } return(Json(new { msg = message, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { ViewBag.CatchedMsg = ex.Message; } } return(View(eSuppliers)); }
public ActionResult EditDistrict(Districts eDistricts) { if (eDistricts.isLoad == false) { eDistricts.DistrictId = Convert.ToInt32(Request.Params["DistrictId"]); DistrictsBI.LoadDistricts(ref eDistricts); return(PartialView(eDistricts)); } else { string message = ""; if (ModelState.IsValid) { try { FASM_Enums.InfoMessages Results = DistrictsBI.SaveDistricts(ref eDistricts); switch (Results) { case FASM_Enums.InfoMessages.Success: message = FASM_Msg.Updated; break; case FASM_Enums.InfoMessages.AlreadyExist: message = "Sorry! the district name already exist"; break; } return(Json(new { msg = message, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { ViewBag.CatchedMsg = ex.Message; } } } return(View(eDistricts)); }