Пример #1
0
        public HttpResponseBase QueryProList(string priceMasterIds)
        {
            string json = string.Empty;
            try
            {
                _prodMgr = new ProductMgr(connectionString);
                int totalCount = 0;
                List<QueryandVerifyCustom> pros = _prodMgr.QueryByProSite(priceMasterIds);
                totalCount = pros.Count;

                json = new JObject(
                    new JProperty("succes", true),
                    new JProperty("totalCount", totalCount),
                    new JProperty("item", new JArray(
                       from p in pros
                       select new JObject(
                           new JProperty("price_master_id", p.price_master_id),
                           new JProperty("product_image", p.product_image != "" ? (imgServerPath + prod50Path + GetDetailFolder(p.product_image) + p.product_image) : defaultImg),
                           new JProperty("product_id", p.product_id),
                           new JProperty("brand_name", p.brand_name),
                           new JProperty("product_name", p.product_name),
                           new JProperty("prod_sz", p.prod_sz),
                           new JProperty("combination", p.combination),
                           new JProperty("combination_id", p.combination_id),
                           new JProperty("price_type", p.price_type),
                           new JProperty("price_type_id", p.price_type_id),
                           new JProperty("product_status", p.product_status),
                           new JProperty("site_name", p.site_name),
                           new JProperty("user_level", p.user_level),
                           new JProperty("price", p.price),
                           new JProperty("cost", p.cost),
                           new JProperty("event_price", p.event_price),
                           new JProperty("event_cost", p.event_cost),
                           new JProperty("event_start", CommonFunction.GetNetTime(p.event_start).ToString("yyyy/MM/dd HH:mm:ss")),
                           new JProperty("event_end", CommonFunction.GetNetTime(p.event_end).ToString("yyyy/MM/dd HH:mm:ss")),
                           new JProperty("prepaid", p.prepaid)
                           )))
                    ).ToString();
                // 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;
        }
Пример #2
0
        public HttpResponseBase QueryProList()
        {
            string json = string.Empty;
            try
            {
                QueryVerifyCondition query = new QueryVerifyCondition();
                #region 查询条件填充

                query.IsPage = true;
                query.Start = int.Parse(Request.Form["start"] ?? "0");
                if (!string.IsNullOrEmpty(Request.Form["limit"]))
                {
                    query.Limit = Convert.ToInt32(Request.Form["limit"]);
                }
                query.price_check = (Request.Form["price_check"] ?? "") == "true";
                if (!string.IsNullOrEmpty(Request.Form["brand_id"]))
                {
                    query.brand_id = uint.Parse(Request.Form["brand_id"]);
                }
                //庫存類型
                if (!string.IsNullOrEmpty(Request.Form["stockStatus"]))
                {
                    query.StockStatus = int.Parse(Request.Form["stockStatus"]);
                }
                if (!string.IsNullOrEmpty(Request.Form["comboProCate_hide"]))
                {
                    query.cate_id = Request.Form["comboProCate_hide"].Trim();
                }
                if (!string.IsNullOrEmpty(Request.Form["comboFrontCage_hide"]))
                {
                    query.category_id = uint.Parse(Request.Form["comboFrontCage_hide"]);
                    query.category_id = query.category_id == 2 ? 0 : query.category_id;
                }
                if (!string.IsNullOrEmpty(Request.Form["combination"]))
                {
                    query.combination = int.Parse(Request.Form["combination"]);
                }
                if (!string.IsNullOrEmpty(Request.Form["outofstock_time_days"]))//add by dongya 2015/10/22
                {
                    query.outofstock_days_stopselling = int.Parse(Request.Form["outofstock_time_days"]);
                }
                
                if (!string.IsNullOrEmpty(Request.Form["product_status"]))
                {
                    query.product_status = int.Parse(Request.Form["product_status"]);
                }
                if (!string.IsNullOrEmpty(Request.Form["product_type"]))//add 2015/06/01
                {
                    query.product_type = int.Parse(Request.Form["product_type"]);
                }
                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"]);
                }
                if (!string.IsNullOrEmpty(Request.Form["tax_type"]))
                {
                    query.tax_type = uint.Parse(Request.Form["tax_type"]);
                }
                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 HH:mm:ss")).ToString();
                }
                if (!string.IsNullOrEmpty(Request.Form["time_end"]))
                {
                    query.time_end = CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Form["time_end"]).ToString("yyyy/MM/dd HH:mm:ss")).ToString();
                }
                query.name_number = Request.Form["key"] ?? "";
                if (query.price_check)
                {
                    if (!string.IsNullOrEmpty(Request.Form["site_id"]))
                    {
                        query.site_id = uint.Parse(Request.Form["site_id"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Form["user_level"]))
                    {
                        query.user_level = uint.Parse(Request.Form["user_level"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Form["price_status"]))
                    {
                        query.price_status = uint.Parse(Request.Form["price_status"]);
                    }
                }
                //增加查詢值  按鈕選中  add by zhuoqin0830w  2015/02/10
                if (!string.IsNullOrEmpty(Request.Form["priceCondition"]))
                {
                    query.priceCondition = int.Parse(Request.Form["priceCondition"]);
                }
                //add by zhuoqin0830w  2015/03/11  已買斷商品的篩選功能
                if (!string.IsNullOrEmpty(Request.Form["productPrepaid"]))
                {
                    query.Prepaid = int.Parse(Request.Form["productPrepaid"]);
                }
                //add by zhuoqin0830w  2015/06/30  失格商品篩選
                if (!string.IsNullOrEmpty(Request.Form["off_grade"]))
                {
                    query.off_grade = int.Parse(Request.Form["off_grade"]);
                }
                //add by guodong1130w 2015/09/16 預購商品篩選
                if (!string.IsNullOrEmpty(Request.Form["purchase_in_advance"]))
                {
                    query.purchase_in_advance = int.Parse(Request.Form["purchase_in_advance"]);
                }
                #endregion

                _prodMgr = new ProductMgr(connectionString);
                int totalCount = 0;
                List<QueryandVerifyCustom> pros = _prodMgr.QueryByProSite(query, out totalCount);
                foreach (var item in pros)
                {
                    if ((item.product_image != "" && item.product_image!="-1"))
                    {
                        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;
        }