예제 #1
0
        public ActionResult ManageAssetDoc(AppraisalDetailModel model, string appraisalManageType)//เอกสารสิทธิ์
        {
            try
            {
                TempData["appraisalManageType"] = appraisalManageType != string.Empty ? appraisalManageType : "";
                getAppraisalAssetCode(model.appraisal_assets_id);
                setAssetDoc();

                if (ModelState.IsValid && model.type_of_document_id != 0)
                {
                    string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"]));
                    var    process  = AppraisalService.MngAppraisalDetail(model, userName);
                    if (process)
                    {
                        List <AppraisalDetailModel> modelList = AppraisalService.GetAppraisalDetail(model.assets_detail_id, 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(
                                       "ManageAssetDocPic",
                                       new RouteValueDictionary(new
                            {
                                appraisalID = ContentHelpers.Encode(model.appraisal_assets_id.ToString()),
                                appraisalManageType = appraisalManageType
                            })
                                       ));
                        }
                    }
                    else
                    {
                        ViewData["alert"] = ContentHelpers.getAlertBox(DataInfo.AlertStatusId.ERROR, "จัดการข้อมูลไม่สำเร็จ!");
                    }
                }
                else
                {
                    if (model.type_of_document_id == 0)
                    {
                        ViewData["type_of_document_id"] = "false";
                    }
                }
            }
            catch (ArgumentException ae)
            {
                ModelState.AddModelError(String.Empty, ae.Message);
            }
            catch (Exception e)
            {
                ModelState.AddModelError(String.Empty, e.Message);
            }

            return(View(model));
        }
예제 #2
0
        public ActionResult ManageAssetDoc(string appraisalID, string appraisalManageType)//เอกสารสิทธิ์
        {
            AppraisalDetailModel model = new AppraisalDetailModel();
            //model.appraisal_assets_id = Convert.ToInt32(TempData["AppraisalID"]);
            //TempData["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
            {
                setAssetDoc();

                if (ContentHelpers.IsNotnull(thisID) && thisID > 0)
                {
                    List <AppraisalDetailModel> modelList = AppraisalService.GetAppraisalDetail(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));
        }