Пример #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 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));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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());
        }
Пример #5
0
        public void SignIn(string userName, string userId, bool createPersistentCookie)
        {
            if (String.IsNullOrEmpty(userName))
            {
                throw new ArgumentException("Value cannot be null or empty.", "userName");
            }
            if (String.IsNullOrEmpty(userId))
            {
                throw new ArgumentException("Value cannot be null or empty.", "userId");
            }

            HttpContext.Current.Session["UserName"] = ContentHelpers.Encode(userName);
            HttpContext.Current.Session["UserID"]   = ContentHelpers.Encode(userId);
            FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
        }
Пример #6
0
        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());
        }
Пример #7
0
        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());
        }