コード例 #1
0
ファイル: ManageController.cs プロジェクト: pumpz/GHB_TEAM
        public ActionResult ManageMaterial(LocationAssetModel model, string appraisalManageType)//สิ่งปลูกสร้าง
        {
            try
            {
                TempData["appraisalManageType"] = appraisalManageType != string.Empty ? appraisalManageType : "";
                getAppraisalAssetCode(model.appraisal_assets_id);
                setMaterial();

                if (ModelState.IsValid)
                {
                    string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"]));
                    var    process  = AppraisalService.MngLocationAsset(model, userName);
                    if (process)
                    {
                        List <LocationAssetModel> modelList = AppraisalService.GetLocationAsset(0, model.appraisal_assets_id, userName);
                        if (ContentHelpers.IsNotnull(modelList) && modelList.Count > 0)
                        {
                            model = modelList[0];

                            string _appraisalManageType = ContentHelpers.Decode(appraisalManageType);
                            string thisManageType       = _appraisalManageType;
                            if (_appraisalManageType != "u")
                            {
                                appraisalManageType = ContentHelpers.Encode(appraisalManageType);
                            }

                            return(RedirectToAction(
                                       "ManageCompareAsset",
                                       new RouteValueDictionary(new
                            {
                                appraisalID = ContentHelpers.Encode(model.appraisal_assets_id.ToString()),
                                appraisalManageType = appraisalManageType
                            })
                                       ));
                        }
                    }
                    else
                    {
                        ViewData["alert"] = ContentHelpers.getAlertBox(DataInfo.AlertStatusId.ERROR, "จัดการข้อมูลไม่สำเร็จ!");
                    }
                }
            }
            catch (ArgumentException ae)
            {
                ModelState.AddModelError(String.Empty, ae.Message);
            }
            catch (Exception e)
            {
                ModelState.AddModelError(String.Empty, e.Message);
            }
            return(View(model));
        }
コード例 #2
0
ファイル: ManageController.cs プロジェクト: pumpz/GHB_TEAM
        public ActionResult ManageMaterial(string appraisalID, string appraisalManageType)//สิ่งปลูกสร้าง
        {
            LocationAssetModel model = new LocationAssetModel();
            //model.appraisal_assets_id = Convert.ToInt32(TempData["AppraisalID"]);
            //sTempData["AppraisalCode"] = Convert.ToInt32(TempData["AppraisalCode"]);

            int thisID = Convert.ToInt32(ContentHelpers.Decode(appraisalID));

            model.appraisal_assets_id = thisID;
            getAppraisalAssetCode(thisID);
            string thisManageType = ContentHelpers.Decode(appraisalManageType);

            TempData["appraisalManageType"] = appraisalManageType != string.Empty ? ContentHelpers.Decode(appraisalManageType) : "";

            try
            {
                setMaterial();

                if (ContentHelpers.IsNotnull(thisID) && thisID > 0)
                {
                    List <LocationAssetModel> modelList = AppraisalService.GetLocationAsset(0, thisID, "");
                    if (ContentHelpers.IsNotnull(modelList) && modelList.Count > 0)
                    {
                        model = modelList[0];
                    }
                }
            }
            catch (ArgumentException ae)
            {
                ModelState.AddModelError(String.Empty, ae.Message);
            }
            catch (Exception e)
            {
                ModelState.AddModelError(String.Empty, e.Message);
            }
            return(View(model));
        }