Exemple #1
0
        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));
        }
Exemple #2
0
        public ActionResult IndexRegions()
        {
            ViewBag.AllowAdd    = this.HasPermission(ControllerName.Setups + "-CreateRegions");
            ViewBag.AllowEdit   = this.HasPermission(ControllerName.Setups + "-EditRegions");
            ViewBag.AllowDelete = this.HasPermission(ControllerName.Setups + "-DeleteRegions");

            Regions eRegions = new Regions();

            eRegions.dtRegion = RegionsBI.GetRegions();
            return(View(eRegions));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        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));
        }