protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["supplierId"], out supplierId)) { base.GotoResourceNotFound(); return; } SupplierInfo shipper = SupplierHelper.GetSupplier(this.supplierId); if (shipper == null) { base.GotoResourceNotFound(); return; } this.rptProducts = (ThemedTemplatedRepeater)this.FindControl("rptProducts"); this.hotSale = (Common_GoodsList_HotSale)this.FindControl("list_Common_GoodsList_HotSale");//销售排行 this.pager = (Pager)this.FindControl("pager"); this.litSearchResultPage = (System.Web.UI.WebControls.Literal) this.FindControl("litSearchResultPage"); if (!this.Page.IsPostBack) { this.BindSearch(); } }
protected override void AttachChildControls() { this.litBrandName = (System.Web.UI.WebControls.Literal) this.FindControl("litBrandName"); this.litBrandRemark = (System.Web.UI.WebControls.Literal) this.FindControl("litBrandRemark"); this.rptProducts = (ThemedTemplatedRepeater)this.FindControl("rptProducts"); this.pager = (Pager)this.FindControl("pager"); this.cutdownSearch = (Common_CutdownSearch)this.FindControl("search_Common_CutdownSearch"); this.btnSortPrice = (Common_Search_SortPrice)this.FindControl("btn_Common_Search_SortPrice"); this.btnSortTime = (Common_Search_SortTime)this.FindControl("btn_Common_Search_SortTime"); this.btnSortPopularity = (Common_Search_SortPopularity)this.FindControl("btn_Common_Search_SortPopularity"); this.btnSortSaleCounts = (Common_Search_SortSaleCounts)this.FindControl("btn_Common_Search_SortSaleCounts"); this.cutdownSearch.ReSearch += new Common_CutdownSearch.ReSearchEventHandler(this.cutdownSearch_ReSearch); this.btnSortPrice.Sorting += new Common_Search_SortTime.SortingHandler(this.btnSortPrice_Sorting); this.btnSortTime.Sorting += new Common_Search_SortTime.SortingHandler(this.btnSortTime_Sorting); this.hotSale = (Common_GoodsList_HotSale)this.FindControl("list_Common_GoodsList_HotSale");//销售排行 this.litSearchResultPage = (System.Web.UI.WebControls.Literal) this.FindControl("litSearchResultPage"); if (this.btnSortPopularity != null) { this.btnSortPopularity.Sorting += new Common_Search_SortPopularity.SortingHandler(this.btnSortPopularity_Sorting); } if (this.btnSortSaleCounts != null) { this.btnSortSaleCounts.Sorting += new Common_Search_SortSaleCounts.SortingHandler(this.btnSortSaleCounts_Sorting); } if (this.hotSale != null) { int cid = 0; int brandId = 0; if (!string.IsNullOrEmpty(this.Page.Request.QueryString["categoryId"])) { int.TryParse(this.Page.Request.QueryString["categoryId"], out cid); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["brand"])) { int.TryParse(this.Page.Request.QueryString["brand"], out brandId); } this.hotSale.DataSource = ProductBrowser.GetBrowseHotProductList(cid, brandId).DBHotSale; this.hotSale.DataBind(); } if (!this.Page.IsPostBack) { BrandCategoryInfo brandCategory = CategoryBrowser.GetBrandCategory(this.brandId); if (brandCategory == null) { this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该品牌已经不存在")); return; } this.LoadCategoryHead(brandCategory); this.litBrandName.Text = brandCategory.BrandName; this.litBrandRemark.Text = brandCategory.Description; PageTitle.AddSiteNameTitle(brandCategory.BrandName); this.BindBrandProduct(); } }
protected override void AttachChildControls() { if (HiContext.Current.User.UserRole == UserRole.Member && ((Member)HiContext.Current.User).ReferralStatus == 2 && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"])) { this.Page.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString() + "&ReferralUserId=" + HiContext.Current.User.UserId); return; } if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId)) { base.GotoResourceNotFound(); } this.hiddenpid = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddenpid"); this.hiddeSkuId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeSkuId"); this.hiddeCategoryId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeCategoryId"); this.hiddeCategoryName = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeCategoryName"); this.hidCartQuantity = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txCartQuantity"); this.hiddeProductCode = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeProductCode"); this.hiddeUserId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeUserId"); this.hiddeProductName = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeProductName"); this.buyCardinality = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("buyCardinality"); this.hiddenpid.Value = this.productId.ToString(); this.promote = (ProductPromote)this.FindControl("ProductPromote"); this.common_Location = (Common_Location)this.FindControl("common_Location"); this.litProductName = (System.Web.UI.WebControls.Literal) this.FindControl("litProductName"); this.lblProductCode = (System.Web.UI.WebControls.Literal) this.FindControl("lblProductCode"); this.lblSku = (SkuLabel)this.FindControl("lblSku"); this.lblStock = (StockLabel)this.FindControl("lblStock"); this.litUnit = (System.Web.UI.WebControls.Literal) this.FindControl("litUnit"); this.litBuyCardinality = (System.Web.UI.WebControls.Literal) this.FindControl("litBuyCardinality"); this.litWeight = (System.Web.UI.WebControls.Label) this.FindControl("litWeight"); this.litBrosedNum = (System.Web.UI.WebControls.Literal) this.FindControl("litBrosedNum"); this.litBrand = (System.Web.UI.WebControls.Literal) this.FindControl("litBrand"); this.litSaleCounts = (System.Web.UI.WebControls.Literal) this.FindControl("litSaleCounts"); this.lblMarkerPrice = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice"); this.lblBuyPrice = (System.Web.UI.WebControls.Label) this.FindControl("lblBuyPrice"); this.lblsmalltitle = (System.Web.UI.WebControls.Label) this.FindControl("lblsmalltitle"); this.lblTotalPrice = (TotalLabel)this.FindControl("lblTotalPrice"); this.litDescription = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription"); this.litShortDescription = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription"); this.btnBuy = (BuyButton)this.FindControl("btnBuy"); this.btnaddgouwu = (AddCartButton)this.FindControl("btnaddgouwu"); this.hpkProductConsultations = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductConsultations"); this.hpkProductReviews = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductReviews"); this.hpkProductSales = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductSales"); this.litReviewCount = (System.Web.UI.WebControls.Literal) this.FindControl("litReviewCount"); this.litItemNumber = (System.Web.UI.WebControls.Literal) this.FindControl("litItemNumber"); this.images = (Common_ProductImages)this.FindControl("common_ProductImages"); //this.rptExpandAttributes = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes"); this.expandAttributes = (Common_ExpandAttributes1)this.FindControl("expandAttributes"); this.skuSelector = (SKUSelector)this.FindControl("SKUSelector"); this.reviews = (Common_ProductReview)this.FindControl("list_Common_ProductReview"); this.consultations = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations"); this.correlative = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative"); this.lbUserProductRefer = (UserProductReferLabel)this.FindControl("lbUserProductRefer"); this.hidden_skus = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skus"); this.hidden_skuItem = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skuItem"); this.litTaxRate = (System.Web.UI.WebControls.Literal) this.FindControl("litTaxRate"); this.imgIcon = (HiImage)this.FindControl("imgIcon"); this.litCnArea = (System.Web.UI.WebControls.Literal) this.FindControl("litCnArea"); this.litShipping = (System.Web.UI.WebControls.Literal) this.FindControl("litShipping"); this.hotSale = (Common_GoodsList_HotSale)this.FindControl("list_Common_GoodsList_HotSale"); //销售排行 this.litCategoryNotes3 = (System.Web.UI.WebControls.Literal) this.FindControl("litCategoryNotes3"); this.productImg = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("productImg"); //二维码图片 this.nowBuyBtn = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("nowBuyBtn"); this.litviewcount = (System.Web.UI.WebControls.Literal) this.FindControl("litviewcount"); this.hiddensupplierid = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddensupplierid"); this.litMarkPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litMarkPrice"); this.txtBuyAmount = (BuyAmountBox)this.FindControl("txtBuyAmount"); if (!this.Page.IsPostBack) { ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, new int?(this.reviews.MaxNum), new int?(this.consultations.MaxNum)); if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete) { this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品已经被管理员删除")); return; } if (this.hidCartQuantity != null) { this.hidCartQuantity.Value = this.GetQuantity_Product(productBrowseInfo.Product.ProductId); } System.Collections.IEnumerable value = from item in productBrowseInfo.Product.Skus select item.Value; if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null) { this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs); } if (this.hidden_skus != null) { this.hidden_skus.Value = JsonConvert.SerializeObject(value); } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale) { this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("unproductdetails", new object[] { this.Page.Request.QueryString["productId"] })); } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock) { this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库")); return; } if (productBrowseInfo.cIsDisable == 1) { this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库")); return; } this.LoadPageSearch(productBrowseInfo.Product); if (this.lbUserProductRefer != null) { this.lbUserProductRefer.product = productBrowseInfo.Product; } this.hpkProductReviews.Text = "查看全部" + productBrowseInfo.ReviewCount.ToString() + "条评论"; this.litviewcount.Text = productBrowseInfo.ReviewCount.ToString(); this.hpkProductConsultations.Text = "查看全部" + productBrowseInfo.ConsultationCount.ToString() + "条咨询"; string count = ProductBrowser.GetLineItemNumber(this.productId).ToString(); //this.hpkProductSales.Text = "查看全部" + count + "条成交记录"; int countt = ProductBrowser.GetLineItemCount(this.productId); if (countt > 0) { this.hpkProductSales.Text = "查看全部" + countt + "条成交记录"; this.hpkProductSales.NavigateUrl = string.Format("LookLineItems.aspx?productId={0}", this.productId); } else { this.hpkProductSales.Text = "暂无成交记录"; } this.litReviewCount.Text = productBrowseInfo.ReviewCount.ToString(); this.litItemNumber.Text = countt.ToString(); this.hpkProductConsultations.NavigateUrl = string.Format("ProductConsultationsAndReplay.aspx?productId={0}", this.productId); this.hpkProductReviews.NavigateUrl = string.Format("LookProductReviews.aspx?productId={0}", this.productId); //this.hpkProductSales.NavigateUrl = string.Format("LookLineItems.aspx?productId={0}", this.productId); this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName); this.hiddeCategoryId.Value = productBrowseInfo.CategoryId; this.hiddeCategoryName.Value = productBrowseInfo.CategoryName; this.hiddeProductName.Value = productBrowseInfo.Product.ProductName; this.hiddeProductCode.Value = productBrowseInfo.Product.ProductCode; this.hiddeUserId.Value = HiContext.Current.User.UserId.ToString(); this.btnBuy.Stock = productBrowseInfo.Product.Stock; this.txtBuyAmount.Quantity = productBrowseInfo.Product.BuyCardinality; this.btnaddgouwu.Stock = productBrowseInfo.Product.Stock; BrowsedProductQueue.EnQueue(this.productId); this.images.ImageInfo = productBrowseInfo.Product; if (this.promote != null) { this.promote.ProductId = this.productId; } if (productBrowseInfo.DbAttribute != null) { this.expandAttributes.DbAttribute = productBrowseInfo.DbAttribute;//商品扩展属性 //this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute; //this.rptExpandAttributes.DataBind(); } if (productBrowseInfo.DbSKUs != null) { this.skuSelector.ProductId = this.productId; this.skuSelector.DataSource = productBrowseInfo.DbSKUs; } if (productBrowseInfo.DBReviews != null) { this.reviews.DataSource = productBrowseInfo.DBReviews; this.reviews.DataBind(); } if (productBrowseInfo.DBConsultations != null) { this.consultations.DataSource = productBrowseInfo.DBConsultations; this.consultations.DataBind(); } if (productBrowseInfo.DbCorrelatives != null) { this.correlative.DataSource = productBrowseInfo.DbCorrelatives;//推荐 ,捆绑或同类型下的商品 this.correlative.DataBind(); } if (productBrowseInfo.DBHotSale != null) { this.hotSale.DataSource = productBrowseInfo.DBHotSale; this.hotSale.DataBind(); } if (this.productImg != null) { if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.QRcode)) { this.productImg.Src = productBrowseInfo.Product.QRcode; } //else //{ // //this.productImg.Attributes.Add("display", "none"); //} } this.litCategoryNotes3.Text = productBrowseInfo.CategoryNote3; } }
protected override void AttachChildControls() { this.serach_text = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("search_text"); this.search_Subtext = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("search_Subtext"); this.common_attributeslist = (Common_AttributesList)this.FindControl("common_attributeslist"); this.litLeadBuy = (System.Web.UI.WebControls.Literal) this.FindControl("litLeadBuy"); this.litHotGood = (System.Web.UI.WebControls.Literal) this.FindControl("litHotGood"); this.common_Location = (Common_Location)this.FindControl("common_Location"); this.rptProducts = (ThemedTemplatedRepeater)this.FindControl("rptProducts"); this.pager = (Pager)this.FindControl("pager"); this.litSearchResultPage = (System.Web.UI.WebControls.Literal) this.FindControl("litSearchResultPage"); this.btnSortPrice = (Common_Search_SortPrice)this.FindControl("btn_Common_Search_SortPrice"); this.btnSortTime = (Common_Search_SortTime)this.FindControl("btn_Common_Search_SortTime"); this.btnSortPopularity = (Common_Search_SortPopularity)this.FindControl("btn_Common_Search_SortPopularity"); this.btnSortSaleCounts = (Common_Search_SortSaleCounts)this.FindControl("btn_Common_Search_SortSaleCounts"); this.hotSale = (Common_GoodsList_HotSale)this.FindControl("list_Common_GoodsList_HotSale");//销售排行 if (this.btnSortPrice != null) { this.btnSortPrice.Sorting += new Common_Search_SortTime.SortingHandler(this.btnSortPrice_Sorting); } if (this.btnSortTime != null) { this.btnSortTime.Sorting += new Common_Search_SortTime.SortingHandler(this.btnSortTime_Sorting); } if (this.btnSortPopularity != null) { this.btnSortPopularity.Sorting += new Common_Search_SortPopularity.SortingHandler(this.btnSortPopularity_Sorting); } if (this.btnSortSaleCounts != null) { this.btnSortSaleCounts.Sorting += new Common_Search_SortSaleCounts.SortingHandler(this.btnSortSaleCounts_Sorting); } if (this.hotSale != null) { int cid = 0; int brandId = 0; if (!string.IsNullOrEmpty(this.Page.Request.QueryString["categoryId"])) { int.TryParse(this.Page.Request.QueryString["categoryId"], out cid); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["brand"])) { int.TryParse(this.Page.Request.QueryString["brand"], out brandId); } this.hotSale.DataSource = ProductBrowser.GetBrowseHotProductList(cid, brandId).DBHotSale; this.hotSale.DataBind(); } this.cutdownSearch = (Common_CutdownSearch)this.FindControl("search_Common_CutdownSearch"); if (this.cutdownSearch != null) { this.cutdownSearch.ReSearch += new Common_CutdownSearch.ReSearchEventHandler(this.cutdownSearch_ReSearch); } if (!this.Page.IsPostBack) { CategoryInfo category = CategoryBrowser.GetCategory(this.categoryId); if (category != null) { if (this.common_Location != null) { this.common_Location.CateGoryPath = category.Path; } if (this.litLeadBuy != null) { this.litLeadBuy.Text = category.Notes1; } if (this.litHotGood != null) { this.litHotGood.Text = category.Notes2; } this.LoadPageSearch(category); } this.BindSearch(); } }
protected void BindSearch() { ProductBrowseQuery productBrowseQuery = this.GetCurrProductBrowseQuery(); if (this.serach_text != null) { this.serach_text.Value = productBrowseQuery.Keywords; } if (search_Subtext != null) { search_Subtext.Value = productBrowseQuery.SubKeywords; } DbQueryResult browseProductList = ProductBrowser.GetCurrBrowseProductList(productBrowseQuery); this.rptProducts.DataSource = browseProductList.Data; this.rptProducts.DataBind(); #region 获取控件品牌、产地过滤条件 List <string> search_BrandStr = new List <string>(); List <string> search_ProducingStr = new List <string>(); if (common_attributeslist != null) { DataTable dt = ProductBrowser.GetBrowseProductImportSourceIdAndBrandIdList(productBrowseQuery); foreach (DataRow r in dt.Rows) { string str = r["BrandId"].ToString(); if (!search_BrandStr.Contains(str) && !string.IsNullOrWhiteSpace(str)) { search_BrandStr.Add(str); } str = r["ImportSourceId"].ToString(); if (!search_ProducingStr.Contains(str) && !string.IsNullOrWhiteSpace(str) && !str.Equals("0")) { search_ProducingStr.Add(str); } } //更新品牌、产地控件显示值 this.common_attributeslist.search_BrandStr = search_BrandStr; this.common_attributeslist.search_ProducingStr = search_ProducingStr; } #endregion this.hotSale = (Common_GoodsList_HotSale)this.FindControl("list_Common_GoodsList_HotSale");//销售排行 if (this.hotSale != null) { int cid = 0; int brandId = 0; if (!string.IsNullOrEmpty(this.Page.Request.QueryString["categoryId"])) { int.TryParse(this.Page.Request.QueryString["categoryId"], out cid); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["brand"])) { int.TryParse(this.Page.Request.QueryString["brand"], out brandId); } this.hotSale.DataSource = ProductBrowser.GetBrowseHotProductList(cid, brandId).DBHotSale; this.hotSale.DataBind(); } this.pager.TotalRecords = browseProductList.TotalRecords; int pageCount = browseProductList.TotalRecords / this.pager.PageSize; if (browseProductList.TotalRecords % this.pager.PageSize > 0) { pageCount++; } if (pageCount <= 1) { //this.litSearchResultPage.Text = string.Format("共<span>{0}</span>件商品<span class=\"pager\"><<span class=\"cur-page\">{1}</span>/<span class=\"total-page\">{1}</span>></span>", browseProductList.TotalRecords, pageCount); this.litSearchResultPage.Text = string.Format("<span class=\"fb\">共<span class=\"total-count\">{0}</span>件商品</span><span class=\"pager\"><span class=\"cur-page\">{1}</span>/<span class=\"total-page\">{1}页</span></span>", browseProductList.TotalRecords, pageCount); return; } #region 分页控件代码 int pageIndex = 1; if (!string.IsNullOrEmpty(this.Page.Request.QueryString["pageindex"])) { int.TryParse(this.Page.Request.QueryString["pageindex"], out pageIndex); } if (browseProductList.TotalRecords <= 0) { pageIndex = 0; } string previousPager = ""; string nextPager = ""; Regex regex = new Regex(@"(pageindex=\d+)"); MatchCollection tempMatches = regex.Matches(this.Page.Request.RawUrl); if (tempMatches.Count == 0) { previousPager = this.Page.Request.RawUrl + (this.Page.Request.RawUrl.Contains("?") ? "&" : "?") + "pageindex=1"; if (pageCount > 1) { nextPager = this.Page.Request.RawUrl + (this.Page.Request.RawUrl.Contains("?") ? "&" : "?") + "pageindex=2"; } else { nextPager = previousPager; } } if (tempMatches.Count == 1) { foreach (Match item in tempMatches) { string pagerInfo = item.Value; if (pageIndex <= pageCount) { if ((pageIndex - 1) > 0) { previousPager = this.Page.Request.RawUrl.Replace(pagerInfo, "") + "pageindex=" + (pageIndex - 1); } else { previousPager = this.Page.Request.RawUrl.Replace(pagerInfo, "") + "pageindex=1"; } if ((pageIndex + 1) <= pageCount) { nextPager = this.Page.Request.RawUrl.Replace(pagerInfo, "") + "pageindex=" + (pageIndex + 1); } else { nextPager = this.Page.Request.RawUrl.Replace(pagerInfo, "") + "pageindex=" + pageCount; } } } } #endregion if (pageCount > 1 && pageIndex == 1) { this.litSearchResultPage.Text = string.Format("<span class=\"fb\">共<span>{0}</span>件商品</span><span class=\"pager\"><span class=\"cur-page\">{2}</span>/<span class=\"total-page\">{3}页</span><a class=\"prev-page disabled\" href=\"{1}\">上一页</a><a class=\"next-page\" href=\"{4}\">下一页</a></span>", new object[] { browseProductList.TotalRecords, previousPager, pageIndex, pageCount, nextPager }); } else { this.litSearchResultPage.Text = string.Format("<span class=\"fb\">共<span>{0}</span>件商品</span><span class=\"pager\"><span class=\"cur-page\">{2}</span>/<span class=\"total-page\">{3}页</span><a class=\"prev-page\" href=\"{1}\">上一页</a><a class=\"next-page\" href=\"{4}\">下一页</a></span>", new object[] { browseProductList.TotalRecords, previousPager, pageIndex, pageCount, nextPager }); } }