protected override void AttachChildControls() { if (!int.TryParse(Page.Request.QueryString["productId"], out productId)) { base.GotoResourceNotFound(); } common_Location = (Common_Location)FindControl("common_Location"); litProductName = (Literal)FindControl("litProductName"); lblProductCode = (Literal)FindControl("lblProductCode"); lblSku = (SkuLabel)FindControl("lblSku"); lblStock = (StockLabel)FindControl("lblStock"); litUnit = (Literal)FindControl("litUnit"); litWeight = (WeightLabel)FindControl("litWeight"); litBrosedNum = (Literal)FindControl("litBrosedNum"); litBrand = (Literal)FindControl("litBrand"); litSaleCounts = (Literal)FindControl("litSaleCounts"); lblMarkerPrice = (FormatedMoneyLabel)FindControl("lblMarkerPrice"); lblBuyPrice = (Label)FindControl("lblBuyPrice"); lblTotalPrice = (TotalLabel)FindControl("lblTotalPrice"); litDescription = (Literal)FindControl("litDescription"); litShortDescription = (Literal)FindControl("litShortDescription"); btnBuy = (BuyButton)FindControl("btnBuy"); btnaddgouwu = (AddCartButton)FindControl("btnaddgouwu"); hpkProductConsultations = (HyperLink)FindControl("hpkProductConsultations"); hpkProductReviews = (HyperLink)FindControl("hpkProductReviews"); images = (Common_ProductImages)FindControl("common_ProductImages"); rptExpandAttributes = (ThemedTemplatedRepeater)FindControl("rptExpandAttributes"); skuSelector = (SKUSelector)FindControl("SKUSelector"); reviews = (Common_ProductReview)FindControl("list_Common_ProductReview"); consultations = (Common_ProductConsultations)FindControl("list_Common_ProductConsultations"); correlative = (Common_GoodsList_Correlative)FindControl("list_Common_GoodsList_Correlative"); if (!Page.IsPostBack) { ProductBrowseInfo info = ProductBrowser.GetProductBrowseInfo(productId, new int?(reviews.MaxNum), new int?(consultations.MaxNum)); if ((info.Product == null) || (info.Product.SaleStatus == ProductSaleStatus.Delete)) { Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品已经被管理员删除")); } else { if (info.Product.SaleStatus == ProductSaleStatus.UnSale) { Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("unproductdetails", new object[] { Page.Request.QueryString["productId"] })); } LoadPageSearch(info.Product); hpkProductReviews.Text = "查看全部" + ProductBrowser.GetProductReviewNumber(productId).ToString() + "条评论"; hpkProductConsultations.Text = "查看全部" + ProductBrowser.GetProductConsultationNumber(productId).ToString() + "条咨询"; hpkProductConsultations.NavigateUrl = string.Format("ProductConsultationsAndReplay.aspx?productId={0}", productId); hpkProductReviews.NavigateUrl = string.Format("LookProductReviews.aspx?productId={0}", productId); LoadProductInfo(info.Product, info.BrandName); btnBuy.Stock = info.Product.Stock; btnaddgouwu.Stock = info.Product.Stock; BrowsedProductQueue.EnQueue(productId); images.ImageInfo = info.Product; if (info.DbAttribute != null) { rptExpandAttributes.DataSource = info.DbAttribute; rptExpandAttributes.DataBind(); } if (info.DbSKUs != null) { skuSelector.ProductId = productId; skuSelector.DataSource = info.DbSKUs; } if (info.DBReviews != null) { reviews.DataSource = info.DBReviews; reviews.DataBind(); } if (info.DBConsultations != null) { consultations.DataSource = info.DBConsultations; consultations.DataBind(); } if (info.DbCorrelatives != null) { correlative.DataSource = info.DbCorrelatives; correlative.DataBind(); } } } }
protected override void AttachChildControls() { if (!int.TryParse(base.GetParameter("productId", false), out this.productId)) { base.GotoResourceNotFound(); } this.hidSupName = (HtmlInputHidden)this.FindControl("hidSupName"); this.litSupplierName = (Literal)this.FindControl("litSupplierName"); this.hiddenpid = (HtmlInputHidden)this.FindControl("hiddenpid"); this.hidCartQuantity = (HtmlInputHidden)this.FindControl("txCartQuantity"); this.hiddenpid.Value = this.productId.ToString(); this.common_Location = (Common_Location)this.FindControl("common_Location"); this.litProductName = (Literal)this.FindControl("litProductName"); this.lblStock = (StockLabel)this.FindControl("lblStock"); this.litUnit = (Literal)this.FindControl("litUnit"); this.litSaleCounts = (Literal)this.FindControl("litSaleCounts"); this.lblMarkerPrice = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice"); this.lblBuyPrice = (Label)this.FindControl("lblBuyPrice"); this.lblTotalPrice = (TotalLabel)this.FindControl("lblTotalPrice"); this.lblSku = (SkuLabel)this.FindControl("lblSku"); this.litDescription = (Literal)this.FindControl("litDescription"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.btnBuy = (BuyButton)this.FindControl("btnBuy"); this.btnaddgouwu = (AddCartButton)this.FindControl("btnaddgouwu"); this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations"); this.ltlSaleCount = (Literal)this.FindControl("ltlSaleCount"); this.ltlReviewCount = (Literal)this.FindControl("ltlReviewCount"); this.litReviewCount = (Literal)this.FindControl("litReviewCount"); this.ltlConsultation = (Literal)this.FindControl("ltlConsultation"); this.images = (Common_ProductImages)this.FindControl("common_ProductImages"); this.rptExpandAttributes = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes"); this.rptOnlineService = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService"); this.skuSelector = (SKUSelector)this.FindControl("SKUSelector"); 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 = (HtmlInputHidden)this.FindControl("hidden_skus"); this.hidden_skuItem = (HtmlInputHidden)this.FindControl("hidden_skuItem"); this.hidIsOpenMultiStore = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore"); this.aCountDownUrl = (HyperLink)this.FindControl("aCountDownUrl"); this.imgQrCode = (Image)this.FindControl("imgQrCode"); this.phonePriceQrCode = (Image)this.FindControl("phonePriceQrCode"); this.liCode = (HtmlGenericControl)this.FindControl("liCode"); this.hidden_productId = (HtmlInputHidden)this.FindControl("hidden_productId"); this.hidHasStores = (HtmlInputHidden)this.FindControl("hidHasStores"); this.divGift = (HtmlGenericControl)this.FindControl("divGift"); this.ltlGiftName = (Literal)this.FindControl("ltlGiftName"); this.ltlGiftNum = (Literal)this.FindControl("ltlGiftNum"); this.aBrand = (HtmlAnchor)this.FindControl("aBrand"); this.imgBrand = (HiImage)this.FindControl("imgBrand"); this.imgpdorequest = (HtmlImage)this.FindControl("imgpdorequest"); this.imgTakeonstore = (HtmlImage)this.FindControl("imgTakeonstore"); this.imgCustomerService = (HtmlImage)this.FindControl("imgCustomerService"); this.ltlOrderPromotion = (Literal)this.FindControl("ltlOrderPromotion"); this.ltlOrderPromotion_free = (Literal)this.FindControl("ltlOrderPromotion_free"); this.divOrderPromotions = (HtmlGenericControl)this.FindControl("divOrderPromotions"); this.divOrderPromotions2 = (HtmlGenericControl)this.FindControl("divOrderPromotions2"); this.divOrderPromotions3 = (HtmlGenericControl)this.FindControl("divOrderPromotions3"); this.divPhonePrice = (HtmlGenericControl)this.FindControl("divPhonePrice"); this.litPhonePrice = (Literal)this.FindControl("litPhonePrice"); this.litPhonePriceEndDate = (Literal)this.FindControl("litPhonePriceEndDate"); this.divCuxiao = (HtmlGenericControl)this.FindControl("divCuxiao"); this.ltlUnit = (Literal)this.FindControl("ltlUnit"); this.divProductReferral = (HtmlGenericControl)this.FindControl("divProductReferral"); this.ltlProductSendGifts = (Literal)this.FindControl("ltlProductSendGifts"); this.setDeliverRegion = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion"); this.hidShowCombinationBuy = (HtmlInputHidden)this.FindControl("hidShowCombinationBuy"); this.hidCombinationId = (HtmlInputHidden)this.FindControl("hidCombinationId"); this.imgMainPic = (HtmlImage)this.FindControl("imgMainPic"); this.divqq = (HtmlGenericControl)this.FindControl("divqq"); HtmlAnchor htmlAnchor = (HtmlAnchor)this.FindControl("aMainName"); this.lblMainPrice = (Label)this.FindControl("lblMainPrice"); ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts"); this.spdiscount = (HtmlGenericControl)this.FindControl("spdiscount"); this.aCountDownUrl.Visible = false; this.buyProduct = (HtmlTableRow)this.FindControl("buyProduct"); this.serviceProduct = (HtmlTableRow)this.FindControl("serviceProduct"); if (this.Page.IsPostBack) { return; } SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (this.spdiscount != null && HiContext.Current.User.UserId > 0) { MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(HiContext.Current.User.GradeId); this.spdiscount.Visible = true; this.spdiscount.InnerHtml = "<strong class='vip_price'><img src='/templates/pccommon/images/vip_price.png' />" + memberGrade.Name + "价</strong>"; } if (this.imgQrCode != null) { string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png"; Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png); this.imgQrCode.ImageUrl = text; } if (this.phonePriceQrCode != null) { string text2 = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png"; Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text2, false, ImageFormats.Png); this.phonePriceQrCode.ImageUrl = text2; } if (this.liCode != null && HiContext.Current.SiteSettings.OpenAliho == 0 && HiContext.Current.SiteSettings.OpenVstore == 0 && HiContext.Current.SiteSettings.OpenWap == 0 && HiContext.Current.SiteSettings.OpenMobbile == 0) { this.liCode.Visible = false; } ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, 0); if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete) { this.Page.Response.Redirect("/ProductDelete.aspx"); return; } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale) { this.Page.Response.Redirect(base.GetRouteUrl("unproductdetails", new { ProductId = this.productId })); } if (productBrowseInfo.Product.SupplierId > 0 && productBrowseInfo.Product.AuditStatus != ProductAuditStatus.Pass) { this.Page.Response.Redirect(base.GetRouteUrl("unproductdetailsaudit", new { ProductId = this.productId })); } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库")); return; } this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId; this.setDeliverRegion.Volume = productBrowseInfo.Product.Weight; this.setDeliverRegion.Weight = productBrowseInfo.Product.Weight; this.ActivityBusiness(); if (this.hidCartQuantity != null) { this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId); } 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); } this.hidden_productId.Value = this.productId.ToString(); this.LoadPageSearch(productBrowseInfo.Product); if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage) { this.lbUserProductRefer.product = productBrowseInfo.Product; } HyperLink hyperLink = this.hpkProductConsultations; int num = productBrowseInfo.ConsultationCount; hyperLink.Text = "查看全部" + num.ToString() + "条咨询"; Literal literal = this.ltlConsultation; num = productBrowseInfo.ConsultationCount; literal.Text = num.ToString(); Literal literal2 = this.ltlSaleCount; num = productBrowseInfo.SaleCount; literal2.Text = num.ToString(); Literal literal3 = this.ltlReviewCount; num = productBrowseInfo.ReviewCount; literal3.Text = num.ToString(); Literal literal4 = this.litReviewCount; num = productBrowseInfo.ReviewCount; literal4.Text = num.ToString(); this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}"; this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName); this.btnBuy.Stock = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock); this.ltlUnit.Text = productBrowseInfo.Product.Unit; this.divqq.Visible = (this.sitesettings.ServiceIsOpen == "1"); MemberInfo user = HiContext.Current.User; if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productBrowseInfo.Product.SubMemberDeduct.HasValue)) { if (!productBrowseInfo.Product.SubMemberDeduct.HasValue) { goto IL_0c9e; } decimal?subMemberDeduct = productBrowseInfo.Product.SubMemberDeduct; if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue) { goto IL_0c9e; } } goto IL_0cd8; IL_0cd9: int num2; if (num2 != 0) { this.divProductReferral.Visible = false; } this.btnaddgouwu.Stock = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock); BrowsedProductQueue.EnQueue(this.productId); this.images.ImageInfo = productBrowseInfo.Product; if (productBrowseInfo.DbAttribute != null) { this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute; this.rptExpandAttributes.DataBind(); } if (productBrowseInfo.DbSKUs != null) { this.skuSelector.ProductId = this.productId; this.skuSelector.DataSource = productBrowseInfo.DbSKUs; } int supplierId = productBrowseInfo.Product.SupplierId; if (supplierId > 0) { SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId); if (!string.IsNullOrEmpty(supplierById.Picture)) { this.imgBrand.ImageUrl = supplierById.Picture; } else if (productBrowseInfo.Product.BrandId.HasValue) { BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value); if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo)) { this.imgBrand.ImageUrl = brandCategory.Logo; this.aBrand.HRef = base.GetRouteUrl("branddetails", new { brandId = brandCategory.BrandId }); } } else { this.imgBrand.Visible = false; } this.litSupplierName.Text = "<a href=\"/SupplierAbout?SupplierId=" + supplierById.SupplierId + "\">" + supplierById.SupplierName + "</a>"; this.hidSupName.Value = supplierById.SupplierName; } else { this.litSupplierName.Visible = false; if (productBrowseInfo.Product.BrandId.HasValue) { BrandCategoryInfo brandCategory2 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value); if (brandCategory2 != null && !string.IsNullOrEmpty(brandCategory2.Logo)) { this.imgBrand.ImageUrl = brandCategory2.Logo; this.aBrand.HRef = base.GetRouteUrl("branddetails", new { brandId = brandCategory2.BrandId }); } } } if (SalesHelper.IsSupportPodrequest() && productBrowseInfo.Product.SupplierId == 0) { this.imgpdorequest.Visible = true; } if (masterSettings.OpenMultStore) { if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId)) { this.imgTakeonstore.Visible = true; } } else if (masterSettings.IsOpenPickeupInStore && productBrowseInfo.Product.SupplierId == 0) { this.imgTakeonstore.Visible = true; } if (productBrowseInfo.DBConsultations != null) { this.consultations.DataSource = productBrowseInfo.DBConsultations; this.consultations.DataBind(); } if (productBrowseInfo.DbCorrelatives != null) { this.correlative.DataSource = productBrowseInfo.DbCorrelatives; this.correlative.DataBind(); } this.BindOrderPromotions(); if (!this.divOrderPromotions.Visible && !this.divOrderPromotions2.Visible && !this.divOrderPromotions3.Visible && !this.divPhonePrice.Visible) { this.divCuxiao.Style.Add("display", "none"); } if (this.rptOnlineService != null) { IList <OnlineServiceInfo> allOnlineService = OnlineServiceHelper.GetAllOnlineService(0, 1); IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2); if (allOnlineService2 != null) { foreach (OnlineServiceInfo item in allOnlineService2) { allOnlineService.Add(item); } } this.rptOnlineService.DataSource = allOnlineService; this.rptOnlineService.DataBind(); } if (productBrowseInfo.Product.Stock > 0) { CombinationBuyInfo combinationBuyByMainProductId = CombinationBuyHelper.GetCombinationBuyByMainProductId(this.productId); if (combinationBuyByMainProductId != null) { List <CombinationBuyandProductUnionInfo> combinationProductListByProductId = CombinationBuyHelper.GetCombinationProductListByProductId(this.productId); CombinationBuyandProductUnionInfo combinationBuyandProductUnionInfo = combinationProductListByProductId.FirstOrDefault((CombinationBuyandProductUnionInfo c) => c.ProductId == this.productId); if (combinationBuyandProductUnionInfo != null) { HtmlInputHidden htmlInputHidden = this.hidCombinationId; num = combinationBuyandProductUnionInfo.CombinationId; htmlInputHidden.Value = num.ToString(); string value2 = string.IsNullOrEmpty(combinationBuyandProductUnionInfo.ThumbnailUrl100) ? this.sitesettings.DefaultProductThumbnail3 : combinationBuyandProductUnionInfo.ThumbnailUrl100; this.imgMainPic.Attributes["data-url"] = value2; htmlAnchor.InnerText = combinationBuyandProductUnionInfo.ProductName; this.lblMainPrice.Text = combinationBuyandProductUnionInfo.MinCombinationPrice.F2ToString("f2"); this.lblMainPrice.Attributes["salePrice"] = combinationBuyandProductUnionInfo.MinSalePrice.F2ToString("f2"); } combinationProductListByProductId.Remove(combinationBuyandProductUnionInfo); if (combinationProductListByProductId != null && combinationProductListByProductId.Count > 0) { for (int i = 0; i < combinationProductListByProductId.Count; i++) { string thumbnailUrl = string.IsNullOrEmpty(combinationProductListByProductId[i].ThumbnailUrl100) ? this.sitesettings.DefaultProductThumbnail3 : combinationProductListByProductId[i].ThumbnailUrl100; combinationProductListByProductId[i].ThumbnailUrl100 = thumbnailUrl; combinationProductListByProductId[i].Index = i + 1; } themedTemplatedRepeater.DataSource = combinationProductListByProductId; themedTemplatedRepeater.DataBind(); this.hidShowCombinationBuy.Value = "1"; } } } return; IL_0cd8: num2 = 1; goto IL_0cd9; IL_0c9e: if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null) { num2 = (user.Referral.IsRepeled ? 1 : 0); goto IL_0cd9; } goto IL_0cd8; }