From 8e62dce8ab48d681ebe05e9caf383f8f9606b95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=98=89=E7=A5=A5=20=E8=A9=B9?= Date: Mon, 9 Sep 2024 01:13:29 +0800 Subject: [PATCH] updates --- Controllers/ApiController.cs | 81 +++++++++ Views/Home/ProjectList.cshtml | 37 +++- Views/Shared/_LooperLayout.cshtml | 3 + wwwroot/assets/javascript/custom/globalJS.js | 2 +- .../assets/javascript/custom/projectlist.js | 171 +++++++++++++++++- 5 files changed, 290 insertions(+), 4 deletions(-) diff --git a/Controllers/ApiController.cs b/Controllers/ApiController.cs index 6082d179..6427a5ac 100644 --- a/Controllers/ApiController.cs +++ b/Controllers/ApiController.cs @@ -28,6 +28,87 @@ namespace QuotationMaker.Controllers } + [Route("getModelQuotation")] + public ActionResult AddEditDelGetModelQuotation(IFormCollection obj) + { + modelQuotationResult ret = new modelQuotationResult(); + + authToken token = new authToken(this._httpContextAccessor); + if (token.user_isLogin == false) + { + HttpContext.Response.Cookies.Delete("token_key"); + ret.ret = "no"; + ret.err_code = "99999"; + ret.message = "非登入狀態!"; + return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); + } + + + + string method = obj["method"].ToString(); + string dept_uid = obj["dept_uid"].ToString(); + string modelProj_uid = obj["modelProj_uid"].ToString(); + string modelQuotation_uid = obj["modelQuotation_uid"].ToString(); + + + if (method == "") + { + ret.ret = "no"; + ret.err_code = "0001"; + ret.message = "沒有method!"; + return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); + } + + + + if (dept_uid.Trim() == "") + { + ret.ret = "no"; + ret.err_code = "0003"; + ret.message = "沒有dept_uid!"; + return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); + } + + if (modelProj_uid.Trim() == "") + { + ret.ret = "no"; + ret.err_code = "0003"; + ret.message = "沒有modelProj_uid!"; + return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); + } + + + + if (modelQuotation_uid.Trim() == "") + { + ret.ret = "no"; + ret.err_code = "0002"; + ret.message = "沒有modelQuotation_uid!"; + return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); + } + + modelQuotation modelQuotation = conn.QueryFirstOrDefault("select * from modelQuotation where modelQuotation_uid = @modelQuotation_uid ", new { modelQuotation_uid = modelQuotation_uid }); + + if (method == "get") + { + if (modelQuotation == null) + { + ret.ret = "no"; + ret.err_code = "0009"; + ret.message = "沒有此modelQuotation_uid資料!"; + return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); + } + + ret.modelQuotationDetails.Add(new modelQuotationDetail(modelQuotation)); + ret.ret = "yes"; + return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); + } + + + + return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); + } + [Route("modalQuotationList")] public ActionResult ModalQuotationList(IFormCollection obj) { diff --git a/Views/Home/ProjectList.cshtml b/Views/Home/ProjectList.cshtml index a54f9108..b2a07b98 100644 --- a/Views/Home/ProjectList.cshtml +++ b/Views/Home/ProjectList.cshtml @@ -315,7 +315,7 @@
- +
@@ -366,13 +366,46 @@
- +
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+ + + +