private void FindControls()
 {
     this.divShortDescription   = (HtmlGenericControl)this.FindControl("divShortDescription");
     this.rptProductImages      = (WapTemplatedRepeater)this.FindControl("rptProductImages");
     this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
     this.litShortDescription   = (Literal)this.FindControl("litShortDescription");
     this.litDescription        = (Literal)this.FindControl("litDescription");
     this.litSoldCount          = (Literal)this.FindControl("soldCount");
     this.litprice              = (Literal)this.FindControl("price");
     this.litcontent            = (Literal)this.FindControl("content");
     this.litminCount           = (Literal)this.FindControl("minCount");
     this.litGroupBuyId         = (HtmlInputControl)this.FindControl("litGroupbuyId");
     this.hidden_IsOver         = (HtmlInputHidden)this.FindControl("hidden_IsOver");
     this.hidden_pdEx           = (HtmlInputHidden)this.FindControl("hidden_pdEx");
     this.litLeftSeconds        = (Literal)this.FindControl("leftSeconds");
     this.skuSubmitOrder        = (Common_SKUSubmitStoreOrder)this.FindControl("skuSubmitOrder");
     this.salePrice             = (Literal)this.FindControl("salePrice");
     this.leftCount             = (Literal)this.FindControl("leftCount");
     this.minSuccessCount       = (Literal)this.FindControl("minSuccessCount");
     this.txtProductId          = (HtmlInputControl)this.FindControl("txtProductId");
     this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount");
     this.litReviewsCount       = (Literal)this.FindControl("litReviewsCount");
     this.litMaxCount           = (Literal)this.FindControl("litMaxCount");
     this.startTime             = (HtmlInputHidden)this.FindControl("startTime");
     this.endTime                = (HtmlInputHidden)this.FindControl("endTime");
     this.groupBuySoldCount      = (HtmlInputHidden)this.FindControl("groupBuySoldCount");
     this.groupBuyMinCount       = (HtmlInputHidden)this.FindControl("groupBuyMinCount");
     this.litGroupbuyDescription = (Literal)this.FindControl("litGroupbuyDescription");
     this.groupBuyMaxCount       = (HtmlInputHidden)this.FindControl("groupBuyMaxCount");
     this.skuStock               = (HtmlInputHidden)this.FindControl("skuStock");
     this.hiddenIsLogin          = (HtmlInputHidden)this.FindControl("hiddenIsLogin");
     this.hdAppId                = (HtmlInputHidden)this.FindControl("hdAppId");
     this.hdTimestamp            = (HtmlInputHidden)this.FindControl("hdTimestamp");
     this.hdNonceStr             = (HtmlInputHidden)this.FindControl("hdNonceStr");
     this.hdSignature            = (HtmlInputHidden)this.FindControl("hdSignature");
     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.hdCountDownId  = (HtmlInputHidden)this.FindControl("hdCountDownId");
     this.hidLngLat      = (HtmlInputHidden)this.FindControl("hidLngLat");
     this.litPdImgSlides = (Literal)this.FindControl("litPdImgSlides");
     this.hidNoData      = (HtmlInputHidden)this.FindControl("hidNoData");
     this.hidRecommend   = (HtmlInputHidden)this.FindControl("hidRecommend");
     this.hidStoreType   = (HtmlInputHidden)this.FindControl("hidStoreType");
     this.hidStoreId     = (HtmlInputHidden)this.FindControl("hidStoreId");
     this.hidStoreName   = (HtmlInputHidden)this.FindControl("hidStoreName");
     this.hidQQMapKey    = (HtmlInputHidden)this.FindControl("hidQQMapKey");
     this.hidLanLng      = (HtmlInputHidden)this.FindControl("hidLanLng");
     this.expandAttr     = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
     this.litUnit        = (Literal)this.FindControl("litUnit");
 }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        protected override void AttachChildControls()
        {
            base.CheckOpenMultStore();
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                this.ShowWapMessage("错误的商品ID", "Default.aspx");
            }
            this.aCountDownUrl         = (HyperLink)this.FindControl("aCountDownUrl");
            this.divCountDownUrl       = (HtmlGenericControl)this.FindControl("divCountDownUrl");
            this.aCountDownUrl.Visible = false;
            this.HasActivitiesToJumpUrl();
            MemberInfo user = HiContext.Current.User;

            if (user.UserId != 0 && user.IsReferral() && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
            {
                string text = HttpContext.Current.Request.Url.ToString();
                text = ((text.IndexOf("?") <= -1) ? (text + "?ReferralUserId=" + HiContext.Current.UserId) : (text + "&ReferralUserId=" + HiContext.Current.UserId));
                this.Page.Response.Redirect(text);
                return;
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            this.litPdImgSlides        = (Literal)this.FindControl("litPdImgSlides");
            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.litReferral           = (Literal)this.FindControl("litReferral");
            this.litShortDescription   = (Literal)this.FindControl("litShortDescription");
            this.litDescription        = (Literal)this.FindControl("litDescription");
            this.ltlBottomStatus       = (Literal)this.FindControl("ltlBottomStatus");
            this.skuSubmitOrder        = (Common_SKUSubmitStoreOrder)this.FindControl("skuSubmitOrder");
            this.litSoldCount          = (Literal)this.FindControl("litSoldCount");
            this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (Literal)this.FindControl("litReviewsCount");
            this.litStoreId            = (HtmlInputHidden)this.FindControl("litStoreId");
            this.litStoreId.Value      = this.storeId.ToString();
            this.litHasCollected       = (HtmlInputHidden)this.FindControl("litHasCollected");
            this.hidLngLat             = (HtmlInputHidden)this.FindControl("hidLngLat");
            this.hdQQMapKey            = (HtmlInputHidden)this.FindControl("hdQQMapKey");
            this.hidStoreName          = (HtmlInputHidden)this.FindControl("hidStoreName");
            this.divShortDescription   = (HtmlGenericControl)this.FindControl("divShortDescription");
            this.divProductReferral    = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.hidUnOnSale           = (HtmlInputHidden)this.FindControl("hidUnOnSale");
            this.hidRecommend          = (HtmlInputHidden)this.FindControl("hidRecommend");
            this.hidNoData             = (HtmlInputHidden)this.FindControl("hidNoData");
            this.divGouMai             = (HtmlGenericControl)this.FindControl("divGouMai");
            this.hidStoreId            = (HtmlInputHidden)this.FindControl("hidStoreId");
            this.ltlMessage            = (Literal)this.FindControl("ltlMessage");
            this.spdiscount            = (HtmlGenericControl)this.FindControl("spdiscount");
            this.hidRecommend.Value    = (masterSettings.Store_IsRecommend ? "1" : "0");
            this.lblStock              = (StockLabel)this.FindControl("lblStock");
            this.litUnit               = (Literal)this.FindControl("litUnit");
            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.hdAppId.Value         = masterSettings.WeixinAppId;
            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();
            ProductModel storeProduct = ProductBrowser.GetStoreProduct(storeProductQuery);

            this.skuSubmitOrder.ProductInfo = storeProduct;
            if (storeProduct == null || storeProduct.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("ProductDelete.aspx");
                return;
            }
            if (storeProduct.ProductType == 1.GetHashCode())
            {
                HttpContext.Current.Response.Redirect("ServiceProductDetails?productId=" + this.productId + "&StoreID=" + this.storeId);
            }
            if (storeProduct.SaleStatus != ProductSaleStatus.OnSale)
            {
                this.hidUnOnSale.Value = "1";
            }
            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>";
            }
            MemberInfo user2 = HiContext.Current.User;

            if (user2 != null && user2.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || storeProduct.SubMemberDeduct.HasValue))
            {
                if (!storeProduct.SubMemberDeduct.HasValue)
                {
                    goto IL_078d;
                }
                decimal?subMemberDeduct = storeProduct.SubMemberDeduct;
                if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue)
                {
                    goto IL_078d;
                }
            }
            goto IL_07c7;
IL_078d:
            int num;

            if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user2.Referral != null)
            {
                num = (user2.Referral.IsRepeled ? 1 : 0);
                goto IL_07c8;
            }
            goto IL_07c7;
IL_07c8:
            if (num != 0)
            {
                this.divProductReferral.Visible = false;
            }
            else
            {
                this.litReferral.Text = storeProduct.ProductReduce;
            }
            storeProduct.ImgUrlList.ForEach(delegate(string i)
            {
                Literal literal5 = this.litPdImgSlides;
                literal5.Text   += $"<img src=\"{i}\" />";
            });
            this.litProdcutName.Text         = storeProduct.ProductName;
            this.litSalePrice.Text           = ((storeProduct.MinSalePrice == storeProduct.MaxSalePrice) ? storeProduct.MinSalePrice.F2ToString("f2") : (storeProduct.MinSalePrice.F2ToString("f2") + "~" + storeProduct.MaxSalePrice.F2ToString("f2")));
            this.litMarketPrice.Text         = storeProduct.MarketPrice.F2ToString("f2");
            this.litShortDescription.Text    = storeProduct.ShortDescription;
            this.divShortDescription.Visible = !string.IsNullOrEmpty(storeProduct.ShortDescription);
            if (!string.IsNullOrWhiteSpace(storeProduct.Description))
            {
                Regex regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                this.litDescription.Text = regex.Replace(storeProduct.Description, "").Replace("src", "data-url");
            }
            Literal literal = this.litSoldCount;
            int     num2    = storeProduct.ShowSaleCounts;

            literal.Text = num2.ToString();
            Literal control = this.litConsultationsCount;

            num2 = storeProduct.ConsultationCount;
            control.SetWhenIsNotNull(num2.ToString());
            Literal control2 = this.litReviewsCount;

            num2 = storeProduct.ReviewCount;
            control2.SetWhenIsNotNull(num2.ToString());
            if (storeProduct.StoreInfo.IsInServiceArea)
            {
                this.ltlStoreName      = (Literal)this.FindControl("ltlStoreName");
                this.ltlStoreName.Text = storeProduct.StoreInfo.StoreName;
                this.ltlDistance       = (Literal)this.FindControl("ltlDistance");
                this.ltlDistance.Text  = storeProduct.StoreInfo.Distance;
                this.ltlDelivery       = (Literal)this.FindControl("ltlDelivery");
                this.ltlDelivery.Text  = storeProduct.StoreInfo.Delivery.DeliveryList.Aggregate(string.Empty, (string t, string n) => "<li>" + t + "</li><li>" + n + "</li>");
                this.ltlDeliveryDetail = (Literal)this.FindControl("ltlDeliveryDetail");
                if (storeProduct.StoreInfo.Delivery.IsStoreDelive)
                {
                    if (storeProduct.StoreInfo.Delivery.MinOrderPrice > decimal.Zero)
                    {
                        Literal literal2 = this.ltlDeliveryDetail;
                        num2          = storeProduct.StoreInfo.Delivery.MinOrderPrice.ToInt(0);
                        literal2.Text = $"¥<em>{num2.ToString()}</em>起送";
                        if (storeProduct.StoreInfo.Delivery.StoreFreight > decimal.Zero)
                        {
                            Literal literal3 = this.ltlDeliveryDetail;
                            string  text2    = literal3.Text;
                            num2          = storeProduct.StoreInfo.Delivery.StoreFreight.ToInt(0);
                            literal3.Text = text2 + $",配送费¥<em>{num2.ToString()}</em>";
                        }
                        else
                        {
                            Literal literal4 = this.ltlDeliveryDetail;
                            literal4.Text += string.Format(",免配送费");
                        }
                    }
                    else if (storeProduct.StoreInfo.Delivery.StoreFreight > decimal.Zero)
                    {
                        this.ltlDeliveryDetail.Text = $"配送费¥<em>{storeProduct.StoreInfo.Delivery.StoreFreight.ToInt(0)}</em>";
                    }
                    else
                    {
                        this.ltlDeliveryDetail.Text = string.Format("免配送费");
                    }
                }
                this.ltlStoreAddress      = (Literal)this.FindControl("ltlStoreAddress");
                this.ltlStoreAddress.Text = storeProduct.StoreInfo.AddressSimply;
                this.hidLngLat.Value      = $"{storeProduct.StoreInfo.Position.Longitude},{storeProduct.StoreInfo.Position.Latitude}";
                this.hidStoreName.Value   = storeProduct.StoreInfo.StoreName;
                this.hdQQMapKey.Value     = masterSettings.QQMapAPIKey;
                this.hdTitle.Value        = Globals.StripAllTags(string.IsNullOrEmpty(storeProduct.Title) ? storeProduct.ProductName : storeProduct.Title);
                this.hdDesc.Value         = Globals.StripAllTags(string.IsNullOrEmpty(storeProduct.ShortDescription) ? this.hdTitle.Value : storeProduct.ShortDescription);
                string oldValue = "/storage/master/product/images/";
                string newValue = "/storage/master/product/thumbs410/410_";
                string text3    = storeProduct.ImgUrlList[0];
                if (!string.IsNullOrEmpty(text3))
                {
                    text3 = text3.ToLower().Replace(oldValue, newValue);
                }
                string local = string.IsNullOrEmpty(text3) ? SettingsManager.GetMasterSettings().DefaultProductImage : text3;
                this.hdImgUrl.Value = Globals.FullPath(local);
                this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
            }
            this.litHasCollected.SetWhenIsNotNull(storeProduct.IsFavorite ? "1" : "0");
            PageTitle.AddSiteNameTitle(storeProduct.ProductName);
            this.ProcessException(storeProduct);
            return;

IL_07c7:
            num = 1;
            goto IL_07c8;
        }