Exemplo n.º 1
0
        public ActionResult ManageOtherDetail(List <CompareDescriptionModel> modelList, string appraisalManageType)//รายละเอียดเพิ่มเติม
        {
            try
            {
                TempData["appraisalManageType"] = appraisalManageType != string.Empty ? appraisalManageType : "";
                getAppraisalAssetCode(modelList[0].appraisal_assets_id);

                if (ModelState.IsValid)
                {
                    string userName         = ContentHelpers.Decode(Convert.ToString(Session["UserName"]));
                    bool   process          = false;
                    int    appraisalAssetId = 0;
                    foreach (var model in modelList)
                    {
                        appraisalAssetId = model.appraisal_assets_id;
                        process          = AppraisalService.MngCompareDescription(model);
                    }

                    if (process)
                    {
                        if (appraisalAssetId > 0)
                        {
                            modelList = AppraisalService.GetCompareDescription(0, appraisalAssetId, userName);

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

                            return(RedirectToAction(
                                       "ManagePrice",
                                       new RouteValueDictionary(new
                            {
                                appraisalID = ContentHelpers.Encode(appraisalAssetId.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(modelList));
        }
Exemplo n.º 2
0
        public ActionResult ManageOtherDetail(string appraisalID, string appraisalManageType)//รายละเอียดเพิ่มเติม
        {
            List <CompareDescriptionModel> modelList = new List <CompareDescriptionModel>();

            // TempData["AppraisalCode"] = Convert.ToInt32(TempData["AppraisalCode"]);

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

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

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

            try
            {
                if (ContentHelpers.IsNotnull(thisID) && thisID > 0)
                {
                    modelList = AppraisalService.GetCompareDescription(0, thisID, "");
                }
                else
                {
                    if (modelList == null)
                    {
                        modelList = new List <CompareDescriptionModel>();
                        for (int i = 1; i < 5; i++)
                        {
                            CompareDescriptionModel compareDesc = new CompareDescriptionModel();
                            compareDesc.appraisal_assets_id = thisID;
                            compareDesc.sequence            = i;
                            modelList.Add(compareDesc);
                        }
                    }
                }
            }
            catch (ArgumentException ae)
            {
                ModelState.AddModelError(String.Empty, ae.Message);
            }
            catch (Exception e)
            {
                ModelState.AddModelError(String.Empty, e.Message);
            }
            return(View(modelList));
        }