public ActionResult ManageAssetDocPic(string appraisalID, string appraisalManageType)//รูปเอกสารสิทธิ์ { int thisID = Convert.ToInt32(ContentHelpers.Decode(appraisalID)); getAppraisalAssetCode(thisID); string thisManageType = ContentHelpers.Decode(appraisalManageType); TempData["appraisalManageType"] = appraisalManageType != string.Empty ? ContentHelpers.Decode(appraisalManageType) : ""; string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"])); List <UploadPictureAssetModel> listImages = AppraisalService.GetUploadPictureAsset(0, 1, thisID, userName); if (listImages == null) { listImages = new List <UploadPictureAssetModel>(); for (int i = 0; i < 3; i++) { UploadPictureAssetModel image = new UploadPictureAssetModel(); image.appraisal_assets_id = thisID; listImages.Add(image); } } return(View(listImages)); }
protected AppraisalJobModel LoadAssetDetail(int appraisalID, string username) { AppraisalJobModel model = new AppraisalJobModel(); if (appraisalID > 0) { List <AppraisalJobModel> listJob = AppraisalService.GetAppraisalJob(appraisalID, "", username); if (listJob != null) { foreach (AppraisalJobModel job in listJob) { model.appraisal_assets_id = job.appraisal_assets_id; model.appraisal_assets_code = job.appraisal_assets_code; model.village = job.village; model.alley = job.alley; model.road = job.road; model.district_id = job.district_id; model.amphur_id = job.amphur_id; model.province_id = job.province_id; model.detailed_location = job.detailed_location; model.asset_type_id = job.asset_type_id; model.assessment_methods_id = job.assessment_methods_id; model.rights_of_access_id = job.rights_of_access_id; model.paint_the_town_id = job.paint_the_town_id; } } } return(model); }
public ActionResult ManageAssetMap(string appraisalID, string appraisalManageType)//แผนที่ { int thisID = Convert.ToInt32(ContentHelpers.Decode(appraisalID)); getAppraisalAssetCode(thisID); string thisManageType = ContentHelpers.Decode(appraisalManageType); TempData["appraisalManageType"] = appraisalManageType != string.Empty ? ContentHelpers.Decode(appraisalManageType) : ""; string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"])); MapAssetModel model = new MapAssetModel(); List <MapAssetModel> listMap = AppraisalService.GetMapAsset(0, thisID, userName); if (listMap != null) { foreach (MapAssetModel map in listMap) { model.map_assets_id = map.map_assets_id; model.latitude = map.latitude; model.longitude = map.longitude; } } model.appraisal_assets_id = thisID; return(View(model)); }
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)); }
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)); }
public void getAppraisalAssetCode(int appraisalAssetID) { string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"])); List <AppraisalJobModel> listJob = AppraisalService.GetAppraisalJob(appraisalAssetID, null, userName); foreach (AppraisalJobModel model in listJob) { TempData["appraisalAssetCode"] = model.appraisal_assets_code; } }
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)); }
protected override void Initialize(RequestContext requestContext) { if (AppraisalService == null) { AppraisalService = new AppraisalService(); } if (ConditionService == null) { ConditionService = new ConditionService(); } base.Initialize(requestContext); }
public ActionResult ManageAssetDetail(AppraisalJobModel model, string appraisalManageType)//ข้อมูลที่ตั้งทรัพย์สิน { try { TempData["appraisalManageType"] = appraisalManageType != string.Empty ? appraisalManageType : ""; if (ModelState.IsValid) { string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"])); Hashtable process = AppraisalService.MngAppraisalJob(model, userName); if (Convert.ToBoolean(process["Status"])) { if (process["appraisalID"] != null) { string _appraisalManageType = ContentHelpers.Decode(appraisalManageType); string thisManageType = _appraisalManageType; if (_appraisalManageType != "u") { appraisalManageType = ContentHelpers.Encode(appraisalManageType); } //ระบุ id user, job code, ความสามารถ update/view ของ user ลง Tempdata setManageDetail(Convert.ToInt32(process["appraisalID"]), appraisalManageType); return(RedirectToAction( "ManageAssetMap", new RouteValueDictionary(new { appraisalID = ContentHelpers.Encode(process["appraisalID"].ToString()), appraisalManageType = appraisalManageType }) )); } } else { TempData["AppraisalManageType"] = appraisalManageType; ViewData["alert"] = ContentHelpers.getAlertBox(DataInfo.AlertStatusId.ERROR, "จัดการข้อมูลไม่สำเร็จ!"); } } } catch (Exception e) { ModelState.AddModelError(String.Empty, e.Message); } setAssetDetail(); return(View()); }
public Boolean removeImgDB(int imageAssetId) { Boolean result = false; string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"])); List <UploadPictureAssetModel> listImages = AppraisalService.GetUploadPictureAsset(imageAssetId, 0, 0, userName); foreach (UploadPictureAssetModel model in listImages) { model.image_path = null; model.file_name = null; result = AppraisalService.MngUploadPicture(model, userName); } return(result); }
public ActionResult ManageCompareAsset(string appraisalID, string appraisalManageType)//ตารางเปรียบเทียบ { List <CompareAssetModel> modelList = new List <CompareAssetModel>(); // 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 { setCompareAsset(); /* if (ContentHelpers.IsNotnull(thisID) && Convert.ToInt32(thisID) > 0) * { * modelList = AppraisalService.GetCompareAsset(0, thisID, ""); * } * else * {*/ modelList = AppraisalService.GetCompareAsset(0, thisID, ""); if (modelList == null) { modelList = new List <CompareAssetModel>(); for (int i = 1; i < 5; i++) { CompareAssetModel compare = new CompareAssetModel(); compare.appraisal_assets_id = thisID; compare.sequence = i; modelList.Add(compare); } } //} } catch (ArgumentException ae) { ModelState.AddModelError(String.Empty, ae.Message); } catch (Exception e) { ModelState.AddModelError(String.Empty, e.Message); } return(View(modelList)); }
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)); }
public ActionResult ManageAssetMap(MapAssetModel model, string appraisalManageType)//แผนที่ { try { TempData["appraisalManageType"] = appraisalManageType != string.Empty ? appraisalManageType : ""; getAppraisalAssetCode(model.appraisal_assets_id); if (ModelState.IsValid) { string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"])); // Attempt to register the user Boolean process = AppraisalService.MngMapAsset(model, userName); if (Convert.ToBoolean(process)) { string _appraisalManageType = ContentHelpers.Decode(appraisalManageType); string thisManageType = _appraisalManageType; if (_appraisalManageType != "u") { appraisalManageType = ContentHelpers.Encode(appraisalManageType); } return(RedirectToAction( "ManageAssetDoc", new RouteValueDictionary(new { appraisalID = ContentHelpers.Encode(model.appraisal_assets_id.ToString()), appraisalManageType = appraisalManageType }) )); } else { ViewData["alert"] = ContentHelpers.getAlertBox(DataInfo.AlertStatusId.ERROR, "จัดการข้อมูลไม่สำเร็จ!"); } } } catch (Exception e) { ModelState.AddModelError(String.Empty, e.Message); } getAppraisalAssetCode(model.appraisal_assets_id); return(View()); }
public List <AppraisalListsModel> searchResult(FormCollection val) { List <AppraisalListsModel> searchList = new List <AppraisalListsModel>(); string appraisalCode = val["appraisalCode"]; int districtId = val["districtId"] == null ? 38 : Convert.ToInt32(val["districtId"]); int amphurId = val["amphurId"] == null ? 581 : Convert.ToInt32(val["amphurId"]); string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"])); AppraisalService serv = new AppraisalService(); searchList = serv.GetAppraisalLists(appraisalCode, districtId, amphurId, userName, true); if (ContentHelpers.Isnull(searchList) || searchList.Count <= 0) { ModelState.AddModelError("", "Search data not found."); } return(searchList); }
public ActionResult ManagePrice(string appraisalID, string appraisalManageType)//สรุปราคา { int thisID = Convert.ToInt32(ContentHelpers.Decode(appraisalID)); getAppraisalAssetCode(thisID); string thisManageType = ContentHelpers.Decode(appraisalManageType); TempData["appraisalManageType"] = appraisalManageType != string.Empty ? ContentHelpers.Decode(appraisalManageType) : ""; string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"])); ManagePriceModel model = new ManagePriceModel(); List <ManagePriceModel> listPrice = AppraisalService.GetManagePrice(thisID); if (listPrice != null) { foreach (ManagePriceModel price in listPrice) { model.appraisal_assets_id = price.appraisal_assets_id; model.appraisal_assets_code = price.appraisal_assets_code; model.village = price.village; model.alley = price.alley; model.road = price.road; model.district_name = price.district_name; model.amphur_name = price.amphur_name; model.province_name = price.province_name; model.detailed_location = price.detailed_location; model.asset_type = price.asset_type; model.assessment_methods = price.assessment_methods; model.rights_of_access = price.rights_of_access; model.paint_the_town = price.paint_the_town; model.land_value = price.land_value; model.building_value = price.building_value; } } else { model.appraisal_assets_id = thisID; } return(View(model)); }
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)); }
public ActionResult ManageCompareAssetPic(List <UploadPictureAssetModel> models, HttpPostedFileBase[] MultipleFiles, string appraisalManageType)//รูปข้อมูลเทียบ { string userName = ContentHelpers.Decode(Convert.ToString(Session["UserName"])); Boolean process = true; int count = 0; string pathPic = ""; string fileName = ""; string savePath = ""; int appraisalID = 0; TempData["appraisalManageType"] = appraisalManageType != string.Empty ? appraisalManageType : ""; getAppraisalAssetCode(models[0].appraisal_assets_id); foreach (UploadPictureAssetModel model in models) { pathPic = ""; fileName = ""; savePath = ""; appraisalID = model.appraisal_assets_id; if (MultipleFiles[count] != null && MultipleFiles[count].ContentLength > 0) { try { string path = Server.MapPath("~/Images/Compare/" + model.appraisal_assets_id); fileName = MultipleFiles[count].FileName; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } savePath = Path.Combine(path, Path.GetFileName(MultipleFiles[count].FileName)); MultipleFiles[count].SaveAs(savePath); pathPic = "~/Images/Compare/" + model.appraisal_assets_id + "/" + fileName; } catch (Exception ex) { ModelState.AddModelError(String.Empty, ex.Message); } } count++; if (model.image_assets_id == 0 || pathPic != "") { process = false; model.image_path = pathPic; model.file_name = fileName; model.upload_type_id = 3; //รูปภาพเปรียบเทียบ model.sequence = count; process = AppraisalService.MngUploadPicture(model, userName); } } if (Convert.ToBoolean(process)) { string _appraisalManageType = ContentHelpers.Decode(appraisalManageType); string thisManageType = _appraisalManageType; if (_appraisalManageType != "u") { appraisalManageType = ContentHelpers.Encode(appraisalManageType); } return(RedirectToAction( "ManageOtherDetail", new RouteValueDictionary(new { appraisalID = ContentHelpers.Encode(appraisalID.ToString()), appraisalManageType = appraisalManageType }) )); } else { ViewData["alert"] = ContentHelpers.getAlertBox(DataInfo.AlertStatusId.ERROR, "จัดการข้อมูลไม่สำเร็จ!"); } return(View()); }