public void ExportCSV()// yachao1120j 2015-9-10 匯出商品庫存查詢記錄
        {
            ProductItemQuery query = new ProductItemQuery();
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["vendor_name_full_OR_vendor_id"]))
                {
                    query.vendor_name_full_OR_vendor_id = Request.Params["vendor_name_full_OR_vendor_id"];//供应商名称/编号
                }
                if (!string.IsNullOrEmpty(Request.Params["product_id_OR_product_name"]))
                {
                    query.product_id_OR_product_name = Request.Params["product_id_OR_product_name"];//商品编号/名称
                }
                if (!string.IsNullOrEmpty(Request.Params["brand_id_OR_brand_name"]))
                {
                    query.brand_id_OR_brand_name = Request.Params["brand_id_OR_brand_name"];//品牌编号/名称
                }
                if (!string.IsNullOrEmpty(Request.Params["product_status"]))
                {
                    query.product_status = Convert.ToUInt32(Request.Params["product_status"]);//商品状态
                }
                if (!string.IsNullOrEmpty(Request.Params["sale_status"]))
                {
                    query.sale_status = Convert.ToUInt32(Request.Params["sale_status"]);//商品販售狀態
                }
                if (!string.IsNullOrEmpty(Request.Params["item_stock_start"]) && Request.Params["item_stock_start"] != "null")
                {
                    query.item_stock_start = Convert.ToInt32(Request.Params["item_stock_start"]);//库存数量--开始
                }
                else 
                {
                    query.item_stock_start = 0;
                }
                if (!string.IsNullOrEmpty(Request.Params["item_stock_end"]) && Request.Params["item_stock_end"] != "null")
                {
                    query.item_stock_end = Convert.ToInt32(Request.Params["item_stock_end"]);//库存数量--结束
                }
                else
                {
                    query.item_stock_end = 0;
                }
                if (!string.IsNullOrEmpty(Request.Params["ignore_stockRdo"]))
                {
                    query.ignore_stock = Convert.ToInt32(Request.Params["ignore_stockRdo"]);//补货中停止贩售
                }
                DataTable dtHZ = new DataTable();
                int totalcount = 0;
                query.IsPage = false;
                string newExcelName = string.Empty;
                dtHZ.Columns.Add("供應商編號", typeof(String));
                dtHZ.Columns.Add("供應商名稱", typeof(String));
                dtHZ.Columns.Add("品牌編號", typeof(String));
                dtHZ.Columns.Add("品牌名稱", typeof(String));
                dtHZ.Columns.Add("商品編號", typeof(String));
                dtHZ.Columns.Add("商品名稱", typeof(String));
                dtHZ.Columns.Add("商品細項編號", typeof(String));
                dtHZ.Columns.Add("商品規格", typeof(String));
                dtHZ.Columns.Add("商品狀態", typeof(String));
                dtHZ.Columns.Add("商品販售狀態", typeof(String));
                dtHZ.Columns.Add("庫存為0時是否還能販售", typeof(String));
                dtHZ.Columns.Add("庫存數量", typeof(String));
                List<ProductItemQuery> list = new List<ProductItemQuery>();
                productitemMgr = new ProductItemMgr(connectionString);
                list = productitemMgr.GetInventoryQueryList(query, out totalcount);
                if (list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        DataRow dr = dtHZ.NewRow();

                        dr[0] = list[i].vendor_id;
                        dr[1] = list[i].vendor_name_full;
                        dr[2] = list[i].brand_id;
                        dr[3] = list[i].brand_name;
                        dr[4] = list[i].Product_Id;
                        dr[5] = list[i].product_name;
                        dr[6] = list[i].Item_Id;
                        dr[7] = list[i].product_spec;
                        dr[8] = list[i].product_status_string;
                        dr[9] = list[i].sale_status_string;
                        dr[10] = list[i].ignore_stock_string;
                        dr[11] = list[i].Item_Stock;
                        dtHZ.Rows.Add(dr);
                    }
                    string fileName = "product_stock_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                    MemoryStream ms = ExcelHelperXhf.ExportDT(dtHZ, "");
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
                    Response.BinaryWrite(ms.ToArray());
                }
                else
                {
                    Response.Clear();
                    this.Response.Write("無數據存在<br/>");
                }
            }
            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);
            }


        }
        public HttpResponseBase GetInventoryQueryList()// yachoa1120j 2015-9-10 商品庫存查詢
        {

            string json = string.Empty;
            int totalcount = 0;
            try
            {
                ProductItemQuery query = new ProductItemQuery();
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
                productitemMgr = new ProductItemMgr(connectionString);
                if (!string.IsNullOrEmpty(Request.Params["vendor_name_full_OR_vendor_id"]))
                {
                    query.vendor_name_full_OR_vendor_id = Request.Params["vendor_name_full_OR_vendor_id"];//供应商名称/编号
                }
                if (!string.IsNullOrEmpty(Request.Params["product_id_OR_product_name"]))
                {
                    query.product_id_OR_product_name = Request.Params["product_id_OR_product_name"];//商品编号/名称/商品細項編號
                }
                if (!string.IsNullOrEmpty(Request.Params["brand_id_OR_brand_name"]))
                {
                    query.brand_id_OR_brand_name = Request.Params["brand_id_OR_brand_name"];//品牌编号/名称
                }
                if (!string.IsNullOrEmpty(Request.Params["product_status"]))
                {
                    query.product_status = Convert.ToUInt32(Request.Params["product_status"]);//商品状态
                }
                if (!string.IsNullOrEmpty(Request.Params["sale_status"]))
                {
                    query.sale_status = Convert.ToUInt32(Request.Params["sale_status"]);//商品販售狀態
                }
                if (!string.IsNullOrEmpty(Request.Params["item_stock_start"]))
                {
                    query.item_stock_start = Convert.ToInt32(Request.Params["item_stock_start"]);//库存数量--开始
                }
                if (!string.IsNullOrEmpty(Request.Params["item_stock_end"]))
                {
                    query.item_stock_end = Convert.ToInt32(Request.Params["item_stock_end"]);//库存数量--结束
                }
                if (!string.IsNullOrEmpty(Request.Params["ignore_stockRdo"]))
                {
                    query.ignore_stock = Convert.ToInt32(Request.Params["ignore_stockRdo"]);//庫存為0時是否還能販售
                }
                List<ProductItemQuery> list = productitemMgr.GetInventoryQueryList(query, out totalcount);
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                timeConverter.DateTimeFormat = "yyyy-MM-dd";
                json = "{success:true,totalCount:" + totalcount + ",data:" + JsonConvert.SerializeObject(list, Formatting.Indented, timeConverter) + "}";
            }
            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}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return Response;
        }