//根據upcid獲取item_id
        public HttpResponseBase GetItemidByUpcid()
        {
            string json = string.Empty;
            _IiupcMgr = new IupcMgr(mySqlConnectionString);
            _iproductitemMgr = new ProductItemMgr(mySqlConnectionString);
            Iupc m = new Iupc();
            DataTable dt = new DataTable();
            bool isUpc = true;
            try
            {
                //獲取條碼
                if (!string.IsNullOrEmpty(Request.Params["upc_id"]))
                {
                    m.upc_id = Request.Params["upc_id"].ToString().Trim();
                    //6位整數時先判斷輸入的是否為item_id
                    Regex reg = new Regex("^\\d{6}$");
                    if (reg.IsMatch(m.upc_id))
                    {
                        ProductItemQuery query = new ProductItemQuery();
                        query.Item_Id = Convert.ToUInt32(m.upc_id);
                        List<ProductItemQuery> store = _iproductitemMgr.GetProductItemByID(query);
                        if (store.Count == 0)
                        {
                            isUpc = true;
                        }
                        else if (store.Count > 1)
                        {
                            isUpc = true;
                        }
                        else
                        {
                            json = "{success:true,msg:1,itemid:" + query.Item_Id + "}";
                            isUpc = false;
                        }
                    }
                    if (isUpc)
                    {
                        dt = _IiupcMgr.upcid(m);
                        if (dt.Rows.Count == 0)
                        {
                            json = "{success:false,msg:0}";
                        }
                        else if (dt.Rows.Count > 1)
                        {
                            json = "{success:false,msg:2}";
                        }
                        else
                        {
                            json = "{success:true,msg:1,itemid:" + dt.Rows[0]["item_id"].ToString() + "}";
                        }
                    }

                }
            }
            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 this.Response;
        }
        /// <summary>
        /// 商品點擊信息列表
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase BrowseDataList()
        {
            string json = string.Empty;
            DataTable dtBrowseData = new DataTable();
            int totalCount = 0;
            BrowseDataQuery query = new BrowseDataQuery();

            string type=Request.Params["type"];
            string searchContent = Request.Params["searchContent"];
            if (!string.IsNullOrEmpty(type))
            {
                query.type = Convert.ToInt32(type);
            }
            if (!string.IsNullOrEmpty(searchContent))
            {
                query.SearchCondition = searchContent;
            }
            if (!string.IsNullOrEmpty(Request.Params["true"]))
            {
                if (Request.Params["true"] == "true")
                {
                    query.isSecret = true;
                }
                else
                {
                    query.isSecret = false;
                }
            }
            if (!string.IsNullOrEmpty(Request.Params["searchType"]))
            {
                query.SearchType = Convert.ToInt32(Request.Params["searchType"]);
            }
            query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
            query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");

            _IBrowseDataMgr = new BrowseDataMgr(mySqlConnectionString);
            _IProductItemMgr=new ProductItemMgr(mySqlConnectionString);
            _IOrderMasterMgr = new OrderMasterMgr(mySqlConnectionString);

            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
            //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            try
            {
                dtBrowseData = _IBrowseDataMgr.GetBrowseDataList(query, out totalCount);
                if (dtBrowseData.Rows.Count>0)
                {
                    dtBrowseData.Columns.Add("buyCount");
                    for (int i = 0; i < dtBrowseData.Rows.Count; i++)
                    {
                        string user_id = dtBrowseData.Rows[i]["user_id"].ToString();
                        string product_id = dtBrowseData.Rows[i]["product_id"].ToString();
                        string item_id = string.Empty;
                        if (query.isSecret)
                        {
                            dtBrowseData.Rows[i]["user_name"] = dtBrowseData.Rows[i]["user_name"].ToString().Substring(0, 1) + "**";
                        }
                        List<ProductItem> listProductItem = _IProductItemMgr.GetProductItemByID(Convert.ToInt32(product_id));
                        if (listProductItem.Count > 0)
                        {
                            item_id = listProductItem[0].Item_Id.ToString();
                        }
                        OrderMasterQuery orderMasterQuery = new OrderMasterQuery
                        {
                            User_Id = Convert.ToUInt32(dtBrowseData.Rows[i]["user_id"]),
                            Item_Id = Convert.ToInt32(item_id)
                        };
                        dtBrowseData.Rows[i]["buyCount"] = _IOrderMasterMgr.GetBuyCount(orderMasterQuery);
                    }
                    json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(dtBrowseData, Formatting.Indented, timeConverter) + "}";

                }
                else
                {
                    json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(dtBrowseData, Formatting.Indented, timeConverter) + "}";
                    //json = "{success:false,msg:0}";
                }

            }
            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:0}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }