/// <summary> /// 查詢當前 /// </summary> /// <returns></returns> public HttpResponseBase SelectIpoCountByIpo() { string jsonStr = String.Empty; try { string str = Request.Params["po_id"]; _ipoMgr = new IpoMgr(mySqlConnectionString); int count = _ipoMgr.SelectIpoCountByIpo(str); jsonStr = "{success:true,count:" + count + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); jsonStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; }
/// <summary> /// 保存採購單單頭 /// </summary> /// <returns></returns> public HttpResponseBase IpoAddOrEdit() { string jsonStr = String.Empty; try { IpoQuery m = new IpoQuery(); _ipoMgr = new IpoMgr(mySqlConnectionString); m.po_id = Request.Params["po_id"]; m.vend_id = Request.Params["vend_id"]; m.buyer = Request.Params["buyer"]; m.po_type = Request.Params["po_type"]; m.po_type_desc = Request.Params["po_type_desc"]; m.sched_rcpt_dt = Convert.ToDateTime(Request.Params["sched_rcpt_dt"]); m.msg1 = Request.Params["msg1"]; m.msg2 = Request.Params["msg2"]; m.msg3 = Request.Params["msg3"]; if (String.IsNullOrEmpty(Request.Params["row_id"])) { m.create_dtim = DateTime.Now; //創建時間 m.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; m.change_dtim = DateTime.Now; //編輯時間 m.change_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; m.status = 1; if (_ipoMgr.SelectIpoCountByIpo(m.po_id) > 0) { jsonStr = "{success:true,msg:\"" + "此採購單已存在!" + "\"}"; } else { if (_ipoMgr.AddIpo(m) > 0) { jsonStr = "{success:true}"; } else { jsonStr = "{success:false}"; } } } else { m.row_id = Convert.ToInt32(Request.Params["row_id"]); m.change_dtim = DateTime.Now; m.change_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; if (_ipoMgr.UpdateIpo(m) > 0) { jsonStr = "{success:true}";//返回json數據 } else { jsonStr = "{success:false}";//返回json數據 } } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); jsonStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; }