public string QueryStock() { string json = string.Empty; if (string.IsNullOrEmpty(Request.Params["product_id"])) { //查找臨時表是否有記錄 _productItemTempMgr = new ProductItemTempMgr(connectionString); int writeId = (Session["caller"] as Caller).user_id; ProductItemTemp query = new ProductItemTemp { Writer_Id = writeId }; if (!string.IsNullOrEmpty(Request.Form["OldProductId"])) { query.Product_Id = Request.Form["OldProductId"]; } json = _productItemTempMgr.QueryStock(query); } else { //從正式表讀取數據 _productItemMgr = new ProductItemMgr(connectionString); ProductItem pItem = new ProductItem(); pItem.Product_Id = uint.Parse(Request.Params["product_id"]); _productItemMgr.Query(pItem); json = _productItemMgr.QueryStock(pItem); } return json; }
public string QueryStock() { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; string json = string.Empty; int writerID = (int)vendorModel.vendor_id; uint pid = 0; try { ProductItemTemp query = new ProductItemTemp(); if (!string.IsNullOrEmpty(Request.Params["product_id"])) { if (uint.TryParse(Request.Params["product_id"].ToString(), out pid)) {//查詢商品列表中正式表的詳細資料 _productItemMgr = new ProductItemMgr(connectionString); ProductItem pItem = new ProductItem(); pItem.Product_Id = uint.Parse(Request.Params["product_id"]); _productItemMgr.Query(pItem); json = _productItemMgr.QueryStock(pItem); } else { query.Product_Id = Request.Params["product_id"].ToString(); query.Writer_Id = writerID; //查找臨時表是否有記錄 _productItemTempMgr = new ProductItemTempMgr(connectionString); json = _productItemTempMgr.QueryStockByVendor(query); } } else { json = "{success:false,msg:'" + Resources.VendorProduct.NOTFOUNTKEY + "'}"; } } 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); json = "{success:false,msg:'" + ex.Message + "'}"; } return json; }