public HttpResponseBase GetProItems() { string json = string.Empty; try { if (!string.IsNullOrEmpty(Request.Form["ProductId"]) && !string.IsNullOrEmpty(Request.Form["SiteId"])) { //item_price } else if (!string.IsNullOrEmpty(Request.Form["ProductId"])) { //product_item _productItemMgr = new ProductItemMgr(connectionString); List<ProductItem> proItem = _productItemMgr.QueryPrice(new ProductItem { Product_Id = Convert.ToUInt32(Request.Form["ProductId"]) }); json = JsonConvert.SerializeObject(proItem); } else { //product_item_temp int writerId = (Session["caller"] as Caller).user_id; ProductItemTemp query = new ProductItemTemp { Writer_Id = writerId }; if (!string.IsNullOrEmpty(Request.Form["OldProductId"])) { query.Product_Id = Request.Form["OldProductId"]; } _productItemTempMgr = new ProductItemTempMgr(connectionString); List<ProductItemTemp> proItemTemp = _productItemTempMgr.Query(query); json = JsonConvert.SerializeObject(proItemTemp); } } 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); } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase GetProItems() { string json = string.Empty; uint productID = 0; try { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int writerID = (int)vendorModel.vendor_id; if (!string.IsNullOrEmpty(Request.Form["ProductId"])) { if (uint.TryParse(Request.Form["ProductId"].ToString(), out productID)) {//商品列表中正式表商品的詳細資料 //product_item _productItemMgr = new ProductItemMgr(connectionString); List<ProductItem> proItem = _productItemMgr.QueryPrice(new ProductItem { Product_Id = Convert.ToUInt32(Request.Form["ProductId"]) }); json = JsonConvert.SerializeObject(proItem); } else { //product_item ProductItemTemp query = new ProductItemTemp(); query.Product_Id = Request.Form["ProductId"].ToString(); query.Writer_Id = writerID; _productItemTempMgr = new ProductItemTempMgr(connectionString); List<ProductItemTemp> proItemTemp = _productItemTempMgr.QueryByVendor(query); json = JsonConvert.SerializeObject(proItemTemp); } } } 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); } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }