public HttpResponseBase QueryVendorProductList() { string json = string.Empty; try { VenderProductList query = new VenderProductList(); #region 查询条件填充 query.IsPage = true; query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); if (!string.IsNullOrEmpty(Request.Form["limit"])) { query.Limit = Convert.ToInt32(Request.Form["limit"]); } query.price_check = true;//價格進階查詢 #region 站台條件(暫設) query.site_id = 1;//站台預設為gigade query.user_level = 1;//一般會員 query.user_id = 0; #endregion if (!string.IsNullOrEmpty(Request.Form["brand_id"])) //品牌 { query.brand_id = uint.Parse(Request.Form["brand_id"]); } if (!string.IsNullOrEmpty(Request.Form["combination"])) //商品類型 { query.combination = int.Parse(Request.Form["combination"]); } if (!string.IsNullOrEmpty(Request.Form["product_status"])) //商品狀態 { query.product_status = int.Parse(Request.Form["product_status"]); } if (!string.IsNullOrEmpty(Request.Form["product_freight_set"])) //運送方式 { query.freight = uint.Parse(Request.Form["product_freight_set"]); } if (!string.IsNullOrEmpty(Request.Form["product_mode"])) //出貨方式 { query.mode = uint.Parse(Request.Form["product_mode"]); } query.date_type = Request.Form["date_type"] ?? ""; //日期條件 if (!string.IsNullOrEmpty(Request.Form["time_start"])) { query.time_start = CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Form["time_start"]).ToString("yyyy/MM/dd 00:00:00")).ToString(); } if (!string.IsNullOrEmpty(Request.Form["time_end"])) { query.time_end = CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Form["time_end"]).ToString("yyyy/MM/dd 23:59:59")).ToString(); } query.name_number = Request.Form["key"] ?? ""; //名稱/編號搜尋 //品牌下拉選單只能看到該供應商品牌。 query.vendor_id = Convert.ToUInt32((Session["vendor"] as BLL.gigade.Model.Vendor).vendor_id); #endregion _productMgr = new ProductMgr(connectionString); int totalCount = 0; List<VenderProductListCustom> pros = _productMgr.GetVendorProduct(query, out totalCount); foreach (var item in pros) { if (item.product_image != "") { item.product_image = imgServerPath + prod50Path + GetDetailFolder(item.product_image) + item.product_image; } else { item.product_image = defaultImg; } } json = "{succes:true,totalCount:" + totalCount + ",item:" + JsonConvert.SerializeObject(pros) + "}"; } 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 = "{succes:true,totalCount:0,item:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }