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 @@
- +
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+ + + +