コード例 #1
0
ファイル: SetupsController.cs プロジェクト: ponest/FASM
        // GET: Setups
        #region Categories
        public ActionResult IndexCategories()
        {
            ViewBag.AllowAdd    = this.HasPermission(ControllerName.Setups + "-CreateCategory");
            ViewBag.AllowEdit   = this.HasPermission(ControllerName.Setups + "-EditCategory");
            ViewBag.AllowDelete = this.HasPermission(ControllerName.Setups + "-DeleteCategory");

            Categories eCategory = new Categories();

            eCategory.dtCategory = CategoriesBI.GetCategories();
            return(View(eCategory));
        }
コード例 #2
0
        public ActionResult EditAssetDefinition(AssetDefinition eAssetDefinition)
        {
            if (eAssetDefinition.isLoad == false)
            {
                DataTable dtCategory = CategoriesBI.GetCategories();
                ViewData["CategoryName"] = General.DataTableToSelectList(dtCategory, "CategoryId", "CategoryName", "0", TopEmptyItem: new SelectListItem {
                    Value = "0", Text = ""
                });

                DataTable dtDepreciationMethods = General.GetDepreciationMethods();
                ViewData["DepreciationMethods"] = General.DataTableToSelectList(dtDepreciationMethods, "Value", "Text", "0", TopEmptyItem: new SelectListItem {
                    Value = "0", Text = ""
                });

                eAssetDefinition.AssetDefinitionId = Convert.ToInt32(Request.Params["AssetDefinitionId"]);
                AssetDefinitionBI.LoadAssetDefinition(ref eAssetDefinition);
                return(PartialView(eAssetDefinition));
            }
            else
            {
                string message = "";
                if (ModelState.IsValid)
                {
                    try
                    {
                        FASM_Enums.InfoMessages Results = AssetDefinitionBI.SaveAssetDefinition(ref eAssetDefinition);

                        switch (Results)
                        {
                        case FASM_Enums.InfoMessages.Success:
                            message = FASM_Msg.Updated;
                            break;

                        case FASM_Enums.InfoMessages.AlreadyExist:
                            message = "Sorry! the Asset Name already exist";
                            break;
                        }
                        return(Json(new { msg = message, JsonRequestBehavior.AllowGet }));
                    }
                    catch (Exception ex)
                    {
                        ViewBag.CatchedMsg = ex.Message;
                    }
                }
            }

            return(View(eAssetDefinition));
        }
コード例 #3
0
        public ActionResult CreateAssetDefinition(AssetDefinition eAssetDefinition)
        {
            string message = "";

            if (ModelState.IsValid)
            {
                try
                {
                    DataTable dtCategory = CategoriesBI.GetCategories();
                    ViewData["CategoryName"] = General.DataTableToSelectList(dtCategory, "CategoryId", "CategoryName", "0", TopEmptyItem: new SelectListItem {
                        Value = "0", Text = ""
                    });

                    DataTable dtDepreciationMethods = General.GetDepreciationMethods();
                    ViewData["DepreciationMethods"] = General.DataTableToSelectList(dtDepreciationMethods, "Value", "Text", "0", TopEmptyItem: new SelectListItem {
                        Value = "0", Text = ""
                    });

                    FASM_Enums.InfoMessages SaveResult = AssetDefinitionBI.SaveAssetDefinition(ref eAssetDefinition);
                    switch (SaveResult)
                    {
                    case FASM_Enums.InfoMessages.Success:
                        message = FASM_Msg.SuccessfulSaved;
                        break;

                    case FASM_Enums.InfoMessages.AlreadyExist:
                        message = "Asset Name already exist";
                        break;
                    }
                    return(Json(new { msg = message, JsonRequestBehavior.AllowGet }));
                }
                catch (Exception ex)
                {
                    ViewBag.CatchedMsg = ex.Message;
                }
            }

            return(View(eAssetDefinition));
        }
コード例 #4
0
        public ActionResult IndexAssetDefinition()
        {
            ViewBag.AllowAdd    = this.HasPermission(ControllerName.AssetManagement + "-CreateAssetDefinition");
            ViewBag.AllowEdit   = this.HasPermission(ControllerName.AssetManagement + "-EditAssetDefinition");
            ViewBag.AllowDelete = this.HasPermission(ControllerName.AssetManagement + "-DeleteAssetDefinition");

            DataTable dtCategory = CategoriesBI.GetCategories();

            ViewData["CategoryName"] = General.DataTableToSelectList(dtCategory, "CategoryId", "CategoryName", "0", TopEmptyItem: new SelectListItem {
                Value = "0", Text = ""
            });

            DataTable dtDepreciationMethods = General.GetDepreciationMethods();

            ViewData["DepreciationMethods"] = General.DataTableToSelectList(dtDepreciationMethods, "Value", "Text", "0", TopEmptyItem: new SelectListItem {
                Value = "0", Text = ""
            });

            AssetDefinition eAssetDefinition = new AssetDefinition();

            eAssetDefinition.dtAssetDefinition = AssetDefinitionBI.GetAssetDefinition();
            return(View(eAssetDefinition));
        }