Beispiel #1
0
 protected ProductBrowseQuery GetProductBrowseQuery()
 {
     ProductBrowseQuery entity = new ProductBrowseQuery();
     entity.PageIndex = this.pager.PageIndex;
     entity.PageSize = this.pager.PageSize;
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["keywords"]))
     {
         entity.Keywords = Globals.UrlDecode(this.Page.Request.QueryString["keywords"]);
         this.txtKeywords.Value = entity.Keywords;
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["minSalePrice"]))
     {
         decimal result = 0M;
         if (decimal.TryParse(Globals.UrlDecode(this.Page.Request.QueryString["minSalePrice"]), out result))
         {
             entity.MinSalePrice = new decimal?(result);
             this.txtStartPrice.Value = result.ToString();
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["maxSalePrice"]))
     {
         decimal num2 = 0M;
         if (decimal.TryParse(Globals.UrlDecode(this.Page.Request.QueryString["maxSalePrice"]), out num2))
         {
             entity.MaxSalePrice = new decimal?(num2);
             this.txtEndPrice.Value = num2.ToString();
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["productCode"]))
     {
         entity.ProductCode = Globals.UrlDecode(this.Page.Request.QueryString["productCode"]);
         this.txtSKU.Value = entity.ProductCode;
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sortOrderBy"]))
     {
         entity.SortBy = this.Page.Request.QueryString["sortOrderBy"];
     }
     else
     {
         entity.SortBy = "DisplaySequence";
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sortOrder"]))
     {
         entity.SortOrder = (SortAction) Enum.Parse(typeof(SortAction), this.Page.Request.QueryString["sortOrder"]);
     }
     else
     {
         entity.SortOrder = SortAction.Desc;
     }
     Globals.EntityCoding(entity, true);
     return entity;
 }
Beispiel #2
0
 ProductBrowseQuery GetProductBrowseQuery()
 {
     ProductBrowseQuery query = new ProductBrowseQuery();
     query.PageIndex = this.pager.PageIndex;
     int result = 10;
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["pageSize"]) && int.TryParse(this.Page.Request.QueryString["pageSize"], out result))
     {
         query.PageSize = result;
         return query;
     }
     query.PageSize = 10;
     return query;
 }
Beispiel #3
0
 ProductBrowseQuery GetProductBrowseQuery()
 {
     ProductBrowseQuery query = new ProductBrowseQuery();
     query.IsCount = true;
     query.PageIndex = this.pager.PageIndex;
     query.SortBy = "DisplaySequence";
     query.SortOrder = SortAction.Desc;
     int result = 10;
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["pageSize"]) && int.TryParse(this.Page.Request.QueryString["pageSize"], out result))
     {
         query.PageSize = result;
         return query;
     }
     query.PageSize = 10;
     return query;
 }
Beispiel #4
0
 protected void BindProducts(ProductBrowseQuery query)
 {
     DbQueryResult unSaleProductList = ProductBrowser.GetUnSaleProductList(query);
     this.rptProducts.DataSource = unSaleProductList.Data;
     this.rptProducts.DataBind();
     int totalRecords = unSaleProductList.TotalRecords;
     this.pager.TotalRecords = totalRecords;
     int num2 = 0;
     if ((totalRecords % this.pager.PageSize) > 0)
     {
         num2 = (totalRecords / this.pager.PageSize) + 1;
     }
     else
     {
         num2 = totalRecords / this.pager.PageSize;
     }
     this.litSearchResultPage.Text = string.Format("总共有{0}件商品,{1}件商品为一页,共{2}页第 {3}页", new object[] { totalRecords, this.pager.PageSize, num2, this.pager.PageIndex });
 }
Beispiel #5
0
 public override DbQueryResult GetBrowseProductList(ProductBrowseQuery query)
 {
     string filter = ProductMasterProvider.BuildProductBrowseQuerySearch(query);
     string selectFields = "ProductId,ProductName,ProductCode, SaleCounts, ShortDescription, ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,MarketPrice, SalePrice,Stock";
     if (HiContext.Current.User.UserRole == UserRole.Member)
     {
         Member user = HiContext.Current.User as Member;
         int memberDiscount = MemberProvider.Instance().GetMemberDiscount(user.GradeId);
         selectFields = selectFields + string.Format(",CASE WHEN (SELECT COUNT(*) FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) = 1 ", user.GradeId) + string.Format("THEN (SELECT MemberSalePrice FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) ELSE SalePrice*{1}/100 END AS RankPrice", user.GradeId, memberDiscount);
     }
     else
     {
         selectFields = selectFields + ",SalePrice as RankPrice";
     }
     return DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_Hishop_BrowseProductList p", "ProductId", filter, selectFields);
 }
Beispiel #6
0
 public override DataSet GetGroupByProductList(ProductBrowseQuery query, out int TotalGroupBuyProducts)
 {
     DbCommand storedProcCommand = this.database.GetStoredProcCommand("ss_GroupBuyProducts_Get");
     string str = string.Format("SELECT GroupBuyId,ProductId,EndDate FROM Hishop_GroupBuy WHERE EndDate>'{0}' AND Status={1}", DateTime.Now, 1) + string.Format(" AND ProductId IN(SELECT ProductId FROM Hishop_Products WHERE SaleStatus={0}) ORDER BY DisplaySequence DESC", 1);
     this.database.AddInParameter(storedProcCommand, "PageIndex", DbType.Int32, query.PageIndex);
     this.database.AddInParameter(storedProcCommand, "PageSize", DbType.Int32, query.PageSize);
     this.database.AddInParameter(storedProcCommand, "IsCount", DbType.Boolean, query.IsCount);
     this.database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, str);
     this.database.AddOutParameter(storedProcCommand, "TotalGroupBuyProducts", DbType.Int32, 4);
     DataSet set = this.database.ExecuteDataSet(storedProcCommand);
     TotalGroupBuyProducts = (int) this.database.GetParameterValue(storedProcCommand, "TotalGroupBuyProducts");
     return set;
 }
Beispiel #7
0
 public override DbQueryResult GetCountDownProductList(ProductBrowseQuery query)
 {
     string filter = string.Format(" EndDate>'{0}' AND ProductId IN(SELECT ProductId FROM Hishop_Products WHERE SaleStatus={1})", DateTime.Now, 1);
     return DataHelper.PagingByTopsort(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_Hishop_CountDown", "CountDownId", filter, "*");
 }
 protected static string BuildProductBrowseQuerySearch(ProductBrowseQuery query)
 {
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("SaleStatus = {0}", 1);
     if (!string.IsNullOrEmpty(query.ProductCode))
     {
         builder.AppendFormat(" AND LOWER(ProductCode) Like  '%{0}%'", DataHelper.CleanSearchString(query.ProductCode).ToLower());
     }
     if (query.AttributeValues.Count > 0)
     {
         foreach (AttributeValueInfo info in query.AttributeValues)
         {
             builder.AppendFormat(" AND ProductId IN ( SELECT ProductId FROM Hishop_ProductAttributes WHERE AttributeId={0} And ValueId={1}) ", info.AttributeId, info.ValueId);
         }
     }
     if (query.BrandId.HasValue)
     {
         if (query.BrandId.Value == 0)
         {
             builder.Append(" AND BrandId IS NOT NULL");
         }
         else
         {
             builder.AppendFormat(" AND BrandId = {0}", query.BrandId.Value);
         }
     }
     if (query.MinSalePrice.HasValue)
     {
         builder.AppendFormat(" AND SalePrice >= {0}", query.MinSalePrice.Value);
     }
     if (query.MaxSalePrice.HasValue)
     {
         builder.AppendFormat(" AND SalePrice <= {0}", query.MaxSalePrice.Value);
     }
     if (!string.IsNullOrEmpty(query.Keywords) && (query.Keywords.Trim().Length > 0))
     {
         if (!query.IsPrecise)
         {
             query.Keywords = DataHelper.CleanSearchString(query.Keywords);
             string[] strArray = Regex.Split(query.Keywords.Trim(), @"\s+");
             StringBuilder builder2 = new StringBuilder();
             builder2.AppendFormat(" OR (LOWER(ProductCode) LIKE '%{0}%'", DataHelper.CleanSearchString(strArray[0]));
             builder.AppendFormat(" AND ((ProductName LIKE '%{0}%'", DataHelper.CleanSearchString(strArray[0]));
             for (int i = 1; (i < strArray.Length) && (i <= 4); i++)
             {
                 builder.AppendFormat(" AND ProductName LIKE '%{0}%'", DataHelper.CleanSearchString(strArray[i]));
                 builder2.AppendFormat(" AND LOWER(ProductCode)  LIKE '%{0}%'", DataHelper.CleanSearchString(strArray[i]));
             }
             builder.Append(")" + builder2.ToString() + "))");
         }
         else
         {
             builder.AppendFormat(" AND (ProductName = '{0}' or LOWER(ProductCode)='{0}')", DataHelper.CleanSearchString(query.Keywords));
         }
     }
     if (query.CategoryId.HasValue)
     {
         CategoryInfo category = CategoryBrowser.GetCategory(query.CategoryId.Value);
         if (category != null)
         {
             builder.AppendFormat(" AND ( MainCategoryPath LIKE '{0}|%' OR ExtendCategoryPath LIKE '{0}|%') ", category.Path);
         }
     }
     if (!string.IsNullOrEmpty(query.SubjectType))
     {
         builder.AppendFormat(" AND ProductId IN(SELECT ProductId FROM distro_SubjectProducts WHERE SubjectType = {0} AND DistributorUserId={1})", (int) Enum.Parse(typeof(SubjectType), query.SubjectType), HiContext.Current.SiteSettings.UserId);
     }
     return builder.ToString();
 }
Beispiel #9
0
 public override DbQueryResult GetBrowseProductList(ProductBrowseQuery query)
 {
     int num = HiContext.Current.SiteSettings.UserId.Value;
     string filter = ProductSubsiteProvider.BuildProductBrowseQuerySearch(query) + string.Format(" AND DistributorUserId = {0} ", HiContext.Current.SiteSettings.UserId.Value);
     string selectFields = "ProductId,ProductName,ProductCode,SaleCounts,ShortDescription,MarketPrice,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,Stock";
     if (HiContext.Current.User.UserRole == UserRole.Underling)
     {
         Member user = HiContext.Current.User as Member;
         int memberDiscount = MemberProvider.Instance().GetMemberDiscount(user.GradeId);
         selectFields = (selectFields + string.Format(",(SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0}) AS SalePrice", num) + string.Format(",CASE WHEN (SELECT COUNT(*) FROM distro_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0} AND DistributoruserId = {1}) = 1 ", user.GradeId, num)) + string.Format(" THEN (SELECT MemberSalePrice FROM distro_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0} AND DistributoruserId = {1})", user.GradeId, num) + string.Format(" ELSE (SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0})*{1}/100 END AS RankPrice", num, memberDiscount);
     }
     else
     {
         selectFields = selectFields + string.Format(",(SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0}) AS SalePrice", num) + " , 0 AS RankPrice";
     }
     return DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_distro_BrowseProductList p", "ProductId", filter, selectFields);
 }
Beispiel #10
0
 void SearchProducts()
 {
     decimal num;
     decimal num2;
     ProductBrowseQuery query = new ProductBrowseQuery();
     if (!string.IsNullOrEmpty(this.txtKeywords.Value.Trim()))
     {
         query.Keywords = this.txtKeywords.Value.Trim().Replace("'", "").Replace("\"", "");
     }
     if (!string.IsNullOrEmpty(this.txtStartPrice.Value.Trim()) && decimal.TryParse(this.txtStartPrice.Value.Trim(), out num))
     {
         query.MinSalePrice = new decimal?(num);
     }
     if (!string.IsNullOrEmpty(this.txtEndPrice.Value.Trim()) && decimal.TryParse(this.txtEndPrice.Value.Trim(), out num2))
     {
         query.MaxSalePrice = new decimal?(num2);
     }
     if (!string.IsNullOrEmpty(this.txtSKU.Value.Trim()))
     {
         query.ProductCode = Globals.UrlEncode(this.txtSKU.Value);
     }
     query.PageIndex = 1;
     query.PageSize = 10;
     this.BindProducts(query);
 }
Beispiel #11
0
 public static DataSet GetGroupByProductList(ProductBrowseQuery query, out int count)
 {
     return ProductProvider.Instance().GetGroupByProductList(query, out count);
 }
Beispiel #12
0
 public abstract DbQueryResult GetUnSaleProductList(ProductBrowseQuery query);
Beispiel #13
0
 public abstract DataSet GetGroupByProductList(ProductBrowseQuery query, out int count);
Beispiel #14
0
 public abstract DbQueryResult GetCountDownProductList(ProductBrowseQuery query);
Beispiel #15
0
 ProductBrowseQuery GetProductBrowseQuery()
 {
     ProductBrowseQuery entity = new ProductBrowseQuery();
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["keywords"]))
     {
         entity.Keywords = Globals.UrlDecode(this.Page.Request.QueryString["keywords"]);
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["minSalePrice"]))
     {
         decimal num = 0M;
         if (decimal.TryParse(Globals.UrlDecode(this.Page.Request.QueryString["minSalePrice"]), out num))
         {
             entity.MinSalePrice = new decimal?(num);
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["maxSalePrice"]))
     {
         decimal num2 = 0M;
         if (decimal.TryParse(Globals.UrlDecode(this.Page.Request.QueryString["maxSalePrice"]), out num2))
         {
             entity.MaxSalePrice = new decimal?(num2);
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["productCode"]))
     {
         entity.ProductCode = Globals.UrlDecode(this.Page.Request.QueryString["productCode"]);
     }
     entity.PageIndex = this.pager.PageIndex;
     int result = 20;
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["pageSize"]) && int.TryParse(this.Page.Request.QueryString["pageSize"], out result))
     {
         entity.PageSize = result;
     }
     else
     {
         entity.PageSize = 20;
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sortOrderBy"]))
     {
         entity.SortBy = this.Page.Request.QueryString["sortOrderBy"];
     }
     else
     {
         entity.SortBy = "DisplaySequence";
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sortOrder"]))
     {
         entity.SortOrder = (SortAction) Enum.Parse(typeof(SortAction), this.Page.Request.QueryString["sortOrder"]);
     }
     else
     {
         entity.SortOrder = SortAction.Desc;
     }
     Globals.EntityCoding(entity, true);
     return entity;
 }
Beispiel #16
0
 public static DbQueryResult GetCountDownProductList(ProductBrowseQuery query)
 {
     return ProductProvider.Instance().GetCountDownProductList(query);
 }
Beispiel #17
0
 public override DbQueryResult GetCountDownProductList(ProductBrowseQuery query)
 {
     string filter = string.Format(" EndDate>'{0}' AND DistributorUserId={1} AND ProductId IN(SELECT ProductId FROM distro_Products WHERE SaleStatus=1 AND DistributorUserId={2})", DateTime.Now, HiContext.Current.SiteSettings.UserId.Value, HiContext.Current.SiteSettings.UserId.Value);
     return DataHelper.PagingByTopsort(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_distro_CountDown", "CountDownId", filter, "*");
 }
 protected ProductBrowseQuery GetProductBrowseQuery()
 {
     int num2;
     ProductBrowseQuery entity = new ProductBrowseQuery();
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["categoryId"]))
     {
         int result = 0;
         if (int.TryParse(this.Page.Request.QueryString["categoryId"], out result))
         {
             entity.CategoryId = new int?(result);
         }
     }
     if (int.TryParse(this.Page.Request.QueryString["brand"], out num2))
     {
         entity.BrandId = new int?(num2);
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["valueStr"]))
     {
         IList<AttributeValueInfo> list = new List<AttributeValueInfo>();
         string str = Globals.HtmlEncode(Globals.UrlDecode(this.Page.Request.QueryString["valueStr"]));
         string[] strArray = str.Split(new char[] { '-' });
         if (!string.IsNullOrEmpty(str))
         {
             for (int i = 0; i < strArray.Length; i++)
             {
                 string[] strArray2 = strArray[i].Split(new char[] { '_' });
                 if (((strArray2.Length > 0) && !string.IsNullOrEmpty(strArray2[1])) && (strArray2[1] != "0"))
                 {
                     AttributeValueInfo item = new AttributeValueInfo();
                     item.AttributeId = Convert.ToInt32(strArray2[0]);
                     item.ValueId = Convert.ToInt32(strArray2[1]);
                     list.Add(item);
                 }
             }
         }
         entity.AttributeValues = list;
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["isPrecise"]))
     {
         entity.IsPrecise = bool.Parse(Globals.UrlDecode(this.Page.Request.QueryString["isPrecise"]));
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["keywords"]))
     {
         entity.Keywords = Globals.HtmlEncode(Globals.UrlDecode(this.Page.Request.QueryString["keywords"]));
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["minSalePrice"]))
     {
         decimal num4 = 0M;
         if (decimal.TryParse(Globals.UrlDecode(this.Page.Request.QueryString["minSalePrice"]), out num4))
         {
             entity.MinSalePrice = new decimal?(num4);
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["maxSalePrice"]))
     {
         decimal num5 = 0M;
         if (decimal.TryParse(Globals.UrlDecode(this.Page.Request.QueryString["maxSalePrice"]), out num5))
         {
             entity.MaxSalePrice = new decimal?(num5);
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["productCode"]))
     {
         entity.ProductCode = Globals.HtmlEncode(Globals.UrlDecode(this.Page.Request.QueryString["productCode"]));
     }
     entity.PageIndex = this.pager.PageIndex;
     entity.PageSize = this.rptProducts.PageSize;
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sortOrderBy"]))
     {
         entity.SortBy = Globals.HtmlEncode(this.Page.Request.QueryString["sortOrderBy"]);
     }
     else
     {
         entity.SortBy = "DisplaySequence";
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sortOrder"]))
     {
         entity.SortOrder = (SortAction) Enum.Parse(typeof(SortAction), Globals.HtmlEncode(this.Page.Request.QueryString["sortOrder"]));
     }
     else
     {
         entity.SortOrder = SortAction.Desc;
     }
     Globals.EntityCoding(entity, true);
     return entity;
 }
Beispiel #19
0
 public override DataSet GetGroupByProductList(ProductBrowseQuery query, out int count)
 {
     DbCommand storedProcCommand = this.database.GetStoredProcCommand("ss_distro_GroupBuyProducts_Get");
     string str = string.Format("SELECT GroupBuyId,ProductId,EndDate FROM distro_GroupBuy WHERE EndDate>'{0}' AND Status={1} AND DistributorUserId={2} AND ProductId IN(SELECT ProductId FROM distro_Products WHERE SaleStatus=1 AND DistributorUserId={2}) ORDER BY DisplaySequence DESC", DateTime.Now, 1, HiContext.Current.SiteSettings.UserId.Value);
     this.database.AddInParameter(storedProcCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value);
     this.database.AddInParameter(storedProcCommand, "PageIndex", DbType.Int32, query.PageIndex);
     this.database.AddInParameter(storedProcCommand, "PageSize", DbType.Int32, query.PageSize);
     this.database.AddInParameter(storedProcCommand, "IsCount", DbType.Boolean, query.IsCount);
     this.database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, str);
     this.database.AddOutParameter(storedProcCommand, "TotalGroupBuyProducts", DbType.Int32, 4);
     DataSet set = this.database.ExecuteDataSet(storedProcCommand);
     count = (int) this.database.GetParameterValue(storedProcCommand, "TotalGroupBuyProducts");
     return set;
 }