protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["combinaid"], out this.combinaid)) { base.GotoResourceNotFound(""); } else { CombinationBuyInfo combinationBuyById = CombinationBuyHelper.GetCombinationBuyById(this.combinaid); if (combinationBuyById == null) { base.GotoResourceNotFound(""); } else { DateTime now = DateTime.Now; int num; if (!(now.Date > combinationBuyById.EndDate)) { now = DateTime.Now; num = ((now.Date < combinationBuyById.StartDate) ? 1 : 0); } else { num = 1; } if (num != 0) { this.ShowWapMessage("活动未开始或者已结束", "ProductDetails.aspx?productId=" + combinationBuyById.MainProductId); } else { this.HasActivitiesToJumpUrl(combinationBuyById.MainProductId); if (base.ClientType.Equals(ClientType.VShop)) { FightGroupActivitiyModel fightGroupActivitiyModel = VShopHelper.GetFightGroupActivities(new FightGroupActivitiyQuery { PageIndex = 1, PageSize = 1, ProductId = combinationBuyById.MainProductId, Status = EnumFightGroupActivitiyStatus.BeingCarried }).Models.FirstOrDefault(); if (fightGroupActivitiyModel != null) { this.Page.Response.Redirect("FightGroupActivityDetails.aspx?fightGroupActivityId=" + fightGroupActivitiyModel.FightGroupActivityId); } } this.FindControls(); this.SetControlsValue(combinationBuyById.MainProductId); PageTitle.AddSiteNameTitle("组合购详情页"); } } } }
protected override void AttachChildControls() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId)) { this.ShowWapMessage("错误的商品ID", "Default.aspx"); } if (base.ClientType.Equals(ClientType.VShop)) { FightGroupActivitiyModel fightGroupActivitiyModel = VShopHelper.GetFightGroupActivities(new FightGroupActivitiyQuery { PageIndex = 1, PageSize = 1, ProductId = this.productId, Status = EnumFightGroupActivitiyStatus.BeingCarried }).Models.FirstOrDefault(); if (fightGroupActivitiyModel != null) { this.Page.Response.Redirect("FightGroupActivityDetails.aspx?fightGroupActivityId=" + fightGroupActivitiyModel.FightGroupActivityId); } } this.hidStoreId = (HtmlInputHidden)this.FindControl("hidStoreId"); this.hidSupplier = (HtmlInputHidden)this.FindControl("hidSupplier"); this.litSupplierName = (Literal)this.FindControl("litSupplierName"); this.aCountDownUrl = (HyperLink)this.FindControl("aCountDownUrl"); this.aCountDownUrl.Visible = false; this.divCountDownUrl = (HtmlGenericControl)this.FindControl("divCountDownUrl"); this.hidCanTakeOnStore = (HtmlInputHidden)this.FindControl("hidCanTakeOnStore"); this.HasActivitiesToJumpUrl(); this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations"); this.rptProductImages = (WapTemplatedRepeater)this.FindControl("rptProductImages"); this.rptCouponList = (WapTemplatedRepeater)this.FindControl("rptCouponList"); this.rp_guest = (WapTemplatedRepeater)this.FindControl("rp_guest"); this.rp_com = (WapTemplatedRepeater)this.FindControl("rp_com"); this.litProdcutName = (Literal)this.FindControl("litProdcutName"); this.litSalePrice = (Literal)this.FindControl("litSalePrice"); this.litMarketPrice = (Literal)this.FindControl("litMarketPrice"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.litDescription = (Literal)this.FindControl("litDescription"); this.ltlcombinamaininfo = (Literal)this.FindControl("ltlcombinamaininfo"); this.skuSubmitOrder = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder"); this.skuStoreSubmitOrder = (Common_SKUSubmitStoreOrder)this.FindControl("skuStoreSubmitOrder"); this.expandAttr = (Common_ExpandAttributes)this.FindControl("ExpandAttributes"); this.litSoldCount = (Literal)this.FindControl("litSoldCount"); this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount"); this.litReviewsCount = (Literal)this.FindControl("litReviewsCount"); this.litHasCollected = (HtmlInputHidden)this.FindControl("litHasCollected"); this.hidden_skus = (HtmlInputHidden)this.FindControl("hidden_skus"); this.ltlOrderPromotion = (Literal)this.FindControl("ltlOrderPromotion"); this.ltlOrderPromotion2 = (Literal)this.FindControl("ltlOrderPromotion2"); this.ltlProductSendGifts2 = (Literal)this.FindControl("ltlProductSendGifts2"); this.ltlProductSendGifts = (Literal)this.FindControl("ltlProductSendGifts"); this.liOrderPromotions = (HtmlGenericControl)this.FindControl("liOrderPromotions"); this.liOrderPromotions2 = (HtmlGenericControl)this.FindControl("liOrderPromotions2"); this.liProductSendGifts2 = (HtmlGenericControl)this.FindControl("liProductSendGifts2"); this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2"); this.liOrderPromotions_free = (HtmlGenericControl)this.FindControl("liOrderPromotions_free"); this.divActivities = (HtmlGenericControl)this.FindControl("divActivities"); this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2"); this.ltlOrderPromotion_free = (Literal)this.FindControl("ltlOrderPromotion_free"); this.liProductSendGifts = (HtmlGenericControl)this.FindControl("liProductSendGifts"); this.lbUserProductRefer = (UserProductReferLabel)this.FindControl("lbUserProductRefer"); this.divshiptoregion = (HtmlGenericControl)this.FindControl("divshiptoregion"); this.divwaplocateaddress = (HtmlGenericControl)this.FindControl("divwaplocateaddress"); this.promote = (ProductPromote)this.FindControl("ProductPromote"); this.hdAppId = (HtmlInputHidden)this.FindControl("hdAppId"); this.hdTitle = (HtmlInputHidden)this.FindControl("hdTitle"); this.hdDesc = (HtmlInputHidden)this.FindControl("hdDesc"); this.hdImgUrl = (HtmlInputHidden)this.FindControl("hdImgUrl"); this.hdLink = (HtmlInputHidden)this.FindControl("hdLink"); this.hidCombinaid = (HtmlInputHidden)this.FindControl("hidCombinaid"); this.divConsultationEmpty = (HtmlGenericControl)this.FindControl("divConsultationEmpty"); this.ulConsultations = (HtmlGenericControl)this.FindControl("ulConsultations"); this.divShortDescription = (HtmlGenericControl)this.FindControl("divShortDescription"); this.hidRegionId = (HtmlInputHidden)this.FindControl("hidRegionId"); this.divProductReferral = (HtmlGenericControl)this.FindControl("divProductReferral"); this.hidden_productId = (HtmlInputHidden)this.FindControl("hidden_productId"); this.hidCouponCount = (HtmlInputHidden)this.FindControl("hidCouponCount"); this.hidHasStores = (HtmlInputHidden)this.FindControl("hidHasStores"); this.divPodrequest = (HtmlGenericControl)this.FindControl("divPodrequest"); this.divGuest = (HtmlGenericControl)this.FindControl("divGuest"); this.divcombina = (HtmlGenericControl)this.FindControl("divcombina"); this.hidUnOnSale = (HtmlInputHidden)this.FindControl("hidUnOnSale"); this.hidUnAudit = (HtmlInputHidden)this.FindControl("hidUnAudit"); this.divPhonePrice = (HtmlGenericControl)this.FindControl("divPhonePrice"); this.litPhonePrice = (Literal)this.FindControl("litPhonePrice"); this.spdiscount = (HtmlGenericControl)this.FindControl("spdiscount"); this.ulsupplier = (HtmlGenericControl)this.FindControl("ulsupplier"); this.divGouMai = (HtmlGenericControl)this.FindControl("divGouMai"); this.ltlBottomStatus = (Literal)this.FindControl("ltlBottomStatus"); this.hdAppId.Value = masterSettings.WeixinAppId; this.hidStoreId.Value = this.storeId.ToString(); HtmlInputHidden htmlInputHidden = this.hidRegionId; int num = HiContext.Current.DeliveryScopRegionId; htmlInputHidden.Value = num.ToString(); this.hidden_skuItem = (HtmlInputHidden)this.FindControl("hidden_skuItem"); this.hidCartQuantity = (HtmlInputHidden)this.FindControl("txCartQuantity"); this.lblStock = (StockLabel)this.FindControl("lblStock"); this.litUnit = (Literal)this.FindControl("litUnit"); this.lit_IsRefund = (Literal)this.FindControl("lit_IsRefund"); this.lit_IsOverRefund = (Literal)this.FindControl("lit_IsOverRefund"); this.lit_RefundTime = (Literal)this.FindControl("lit_RefundTime"); ProductBrowseInfo wAPProductBrowseInfo = ProductBrowser.GetWAPProductBrowseInfo(this.productId, null, masterSettings.OpenMultStore, 0); StoreProductQuery storeProductQuery = new StoreProductQuery { ProductId = this.productId, StoreId = this.storeId }; string cookie = WebHelper.GetCookie("UserCoordinateCookie", "NewCoordinate"); if (!string.IsNullOrEmpty(cookie)) { string[] array = cookie.Split(','); storeProductQuery.Position = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0)); storeProductQuery.Position.CityId = WebHelper.GetCookie("UserCoordinateCookie", "CityRegionId").ToInt(0); storeProductQuery.Position.AreaId = WebHelper.GetCookie("UserCoordinateCookie", "RegionId").ToInt(0); } else { storeProductQuery.Position = new PositionInfo(0.0, 0.0); storeProductQuery.Position.CityId = 0; storeProductQuery.Position.AreaId = 0; } this.hidStoreId.Value = this.storeId.ToString(); if (this.storeId > 0) { ProductModel storeProduct = ProductBrowser.GetStoreProduct(storeProductQuery); if (storeProduct == null || storeProduct.SaleStatus == ProductSaleStatus.Delete) { this.Page.Response.Redirect("ProductDelete.aspx"); return; } if (storeProduct.SaleStatus == ProductSaleStatus.OnStock) { base.GotoResourceNotFound("商品已经入库"); } if (wAPProductBrowseInfo.Product.ProductType != 1.GetHashCode()) { HttpContext.Current.Response.Redirect("ProductDetail?productId=" + this.productId); } if (storeProduct.SaleStatus == ProductSaleStatus.UnSale) { this.hidUnOnSale.Value = "1"; } this.litSalePrice.Text = ((storeProduct.MinSalePrice == storeProduct.MaxSalePrice) ? storeProduct.MinSalePrice.F2ToString("f2") : (storeProduct.MinSalePrice.F2ToString("f2") + "~" + storeProduct.MaxSalePrice.F2ToString("f2"))); this.skuStoreSubmitOrder.IsServiceProduct = true; this.skuStoreSubmitOrder.ProductInfo = storeProduct; this.skuSubmitOrder.Visible = false; } else { if (wAPProductBrowseInfo.Product == null || wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete) { this.Page.Response.Redirect("ProductDelete.aspx"); return; } if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock) { base.GotoResourceNotFound("商品已经入库"); } if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale) { this.hidUnOnSale.Value = "1"; } this.litSalePrice.Text = ((wAPProductBrowseInfo.Product.MinSalePrice == wAPProductBrowseInfo.Product.MaxSalePrice) ? wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") : (wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") + "~" + wAPProductBrowseInfo.Product.MaxSalePrice.F2ToString("f2"))); this.skuSubmitOrder.ProductInfo = wAPProductBrowseInfo.Product; this.skuStoreSubmitOrder.Visible = false; } if (masterSettings.OpenMultStore) { if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId)) { this.hidHasStores.Value = "1"; this.hidCanTakeOnStore.Value = "1"; } } else if (masterSettings.IsOpenPickeupInStore && wAPProductBrowseInfo.Product.SupplierId == 0) { this.hidCanTakeOnStore.Value = "1"; } if (SalesHelper.IsSupportPodrequest() && wAPProductBrowseInfo.Product.SupplierId == 0) { this.divPodrequest.Visible = true; } HtmlInputHidden htmlInputHidden2 = this.hidUnAudit; num = (int)wAPProductBrowseInfo.Product.AuditStatus; htmlInputHidden2.Value = num.ToString(); 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>"; } this.lbUserProductRefer.product = wAPProductBrowseInfo.Product; this.hdTitle.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.Title) ? wAPProductBrowseInfo.Product.ProductName : wAPProductBrowseInfo.Product.Title); this.hdDesc.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : wAPProductBrowseInfo.Product.ShortDescription); string oldValue = "/storage/master/product/images/"; string newValue = "/storage/master/product/thumbs410/410_"; if (!string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1)) { wAPProductBrowseInfo.Product.ImageUrl1 = wAPProductBrowseInfo.Product.ImageUrl1.ToLower().Replace(oldValue, newValue); } string local = string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) ? SettingsManager.GetMasterSettings().DefaultProductImage : wAPProductBrowseInfo.Product.ImageUrl1; this.hdImgUrl.Value = Globals.FullPath(local); this.hdLink.Value = Globals.FullPath(HttpContext.Current.Request.Url.ToString()); if (this.hidCartQuantity != null) { this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(this.productId); } if (this.hidden_productId != null) { this.hidden_productId.Value = this.productId.ToString(); } if (this.promote != null) { this.promote.ProductId = this.productId; } MemberInfo user = HiContext.Current.User; if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || wAPProductBrowseInfo.Product.SubMemberDeduct.HasValue)) { if (!wAPProductBrowseInfo.Product.SubMemberDeduct.HasValue) { goto IL_0ed1; } decimal?subMemberDeduct = wAPProductBrowseInfo.Product.SubMemberDeduct; if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue) { goto IL_0ed1; } } goto IL_0f0b; IL_0ed1: int num2; if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null) { num2 = (user.Referral.IsRepeled ? 1 : 0); goto IL_0f0c; } goto IL_0f0b; IL_0f0b: num2 = 1; goto IL_0f0c; IL_0f0c: if (num2 != 0) { this.divProductReferral.Visible = false; } bool flag = true; if (this.rptProductImages != null) { string locationUrl = "javascript:;"; if (string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl2) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl3) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl4) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl5)) { wAPProductBrowseInfo.Product.ImageUrl1 = masterSettings.DefaultProductImage; } DataTable skus = ProductBrowser.GetSkus(this.productId); List <SlideImage> list = new List <SlideImage>(); int supplierId = wAPProductBrowseInfo.Product.SupplierId; if (supplierId > 0) { SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId); if (supplierById != null) { this.hidSupplier.Value = "true"; this.litSupplierName.Text = supplierById.SupplierName; } } else { this.hidSupplier.Value = "false"; flag = false; this.ulsupplier.Style.Add(HtmlTextWriterStyle.Display, "none"); } list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl1, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl2, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl3, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl4, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl5, locationUrl)); this.rptProductImages.DataSource = from item in list where !string.IsNullOrWhiteSpace(item.ImageUrl) select item; this.rptProductImages.DataBind(); } this.litProdcutName.Text = wAPProductBrowseInfo.Product.ProductName; if (wAPProductBrowseInfo.Product.MarketPrice.HasValue) { this.litMarketPrice.SetWhenIsNotNull(wAPProductBrowseInfo.Product.MarketPrice.GetValueOrDefault(decimal.Zero).F2ToString("f2")); } this.litShortDescription.Text = wAPProductBrowseInfo.Product.ShortDescription; this.divShortDescription.Visible = !string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription); if (wAPProductBrowseInfo.Product.IsRefund) { this.lit_IsRefund.Text = "<img src=\"/templates/common/images/service_gou.png\" /><span class=\"c-green\">随时退</span>"; this.lit_IsOverRefund.Text = (wAPProductBrowseInfo.Product.IsOverRefund ? "" : "<img src=\"/templates/common/images/service_cha.png\" /><span class=\"c-orange\">过期不退</span>"); } else { this.lit_IsRefund.Text = "<img src=\"/templates/common/images/service_cha.png\" /><span class=\"c-orange\">不可退</span>"; } if (!wAPProductBrowseInfo.Product.IsValid) { if (wAPProductBrowseInfo.Product.ValidStartDate.HasValue && wAPProductBrowseInfo.Product.ValidEndDate.HasValue) { Literal literal = this.lit_RefundTime; DateTime value = wAPProductBrowseInfo.Product.ValidStartDate.Value; string arg = value.ToString("yyyy/MM/dd"); value = wAPProductBrowseInfo.Product.ValidEndDate.Value; literal.Text = string.Format("{0}-{1}", arg, value.ToString("yyyy/MM/dd")); } } else { this.lit_RefundTime.Text = "长期有效"; } if (this.litDescription != null) { string text = ""; Regex regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase); if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.MobbileDescription)) { text = regex.Replace(wAPProductBrowseInfo.Product.MobbileDescription, ""); } else if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.Description)) { text = regex.Replace(wAPProductBrowseInfo.Product.Description, ""); } text = text.Replace("src", "data-url"); text = text.Replace("vurl", "src"); this.litDescription.Text = text; } Literal control = this.litSoldCount; num = wAPProductBrowseInfo.Product.ShowSaleCounts; control.SetWhenIsNotNull(num.ToString()); if (this.expandAttr != null) { this.expandAttr.ProductId = this.productId; } Literal control2 = this.litConsultationsCount; num = wAPProductBrowseInfo.ConsultationCount; control2.SetWhenIsNotNull(num.ToString()); Literal control3 = this.litReviewsCount; num = wAPProductBrowseInfo.ReviewCount; control3.SetWhenIsNotNull(num.ToString()); MemberInfo user2 = HiContext.Current.User; bool flag2 = false; if (user2 != null) { flag2 = ProductBrowser.CheckHasCollect(user2.UserId, this.productId); } this.litHasCollected.SetWhenIsNotNull(flag2 ? "1" : "0"); this.BindCouponList(); PageTitle.AddSiteNameTitle(wAPProductBrowseInfo.Product.ProductName); this.BindCombinaBuyInfo(); this.BindPromotionInfo(); DataTable dBConsultations = wAPProductBrowseInfo.DBConsultations; for (int i = 0; i < dBConsultations.Rows.Count; i++) { dBConsultations.Rows[i]["UserName"] = DataHelper.GetHiddenUsername(dBConsultations.Rows[i]["UserName"].ToNullString()); } this.rptProductConsultations.DataSource = dBConsultations; this.rptProductConsultations.DataBind(); this.divConsultationEmpty.Visible = dBConsultations.IsNullOrEmpty(); this.ulConsultations.Visible = !dBConsultations.IsNullOrEmpty(); string phonePriceByProductId = PromoteHelper.GetPhonePriceByProductId(this.productId); if (!string.IsNullOrEmpty(phonePriceByProductId)) { this.divPhonePrice.Visible = true; decimal num3 = phonePriceByProductId.Split(',')[0].ToDecimal(0); this.litPhonePrice.Text = num3.F2ToString("f2"); decimal num4 = wAPProductBrowseInfo.Product.MinSalePrice - num3; this.litSalePrice.Text = ((num4 > decimal.Zero) ? num4 : decimal.Zero).F2ToString("f2"); this.lbUserProductRefer.MobileExclusive = num3; } if (flag || this.liOrderPromotions.Visible || this.liOrderPromotions_free2.Visible || this.liProductSendGifts.Visible || this.rptCouponList.Visible) { this.divActivities.Visible = true; } else { this.divActivities.Visible = false; } StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); if (storeById != null) { this.ProcessException(storeById); } }