private void FindControls()
 {
     this.rptProductImages      = (VshopTemplatedRepeater)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.litLeftSeconds        = (Literal)this.FindControl("leftSeconds");
     this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
     this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
     this.expandAttr            = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
     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.nowTime                = (HtmlInputHidden)this.FindControl("nowTime");
 }
 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");
 }
        private void FindControls()
        {
            this.divShortDescription = (HtmlGenericControl)this.FindControl("divShortDescription");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            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.litLeftSeconds        = (Literal)this.FindControl("leftSeconds");
            this.skuSubmitOrder        = (Common_SKUSubmitOrder)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.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.hdSource      = (HtmlInputHidden)this.FindControl("hdSource");
            this.hdAppId.Value = masterSettings.WeixinAppId;
            this.expandAttr    = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litUnit1      = (Literal)this.FindControl("litUnit1");
            this.litUnit2      = (Literal)this.FindControl("litUnit2");
            this.litUnit3      = (Literal)this.FindControl("litUnit3");
        }
Beispiel #4
0
        protected override void AttachChildControls()
        {
            this.Vaid = Globals.RequestQueryStr("vaid");
            if (string.IsNullOrEmpty(this.Vaid))
            {
                base.GotoResourceNotFound("");
            }
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(this.Vaid);

            if (oneyuanTaoInfoById == null)
            {
                base.GotoResourceNotFound("");
            }
            this.productId = oneyuanTaoInfoById.ProductId;
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

            if (product == null)
            {
                base.GotoResourceNotFound("");
            }
            OneTaoState oneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);

            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (System.Web.UI.WebControls.Literal) this.FindControl("litItemParams");
            this.litProdcutName        = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litProdcutTag         = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutTag");
            this.litSalePrice          = (System.Web.UI.WebControls.Literal) this.FindControl("litSalePrice");
            this.litMarketPrice        = (System.Web.UI.WebControls.Literal) this.FindControl("litMarketPrice");
            this.litShortDescription   = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.litDescription        = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
            this.litStock              = (System.Web.UI.WebControls.Literal) this.FindControl("litStock");
            this.litSoldCount          = (System.Web.UI.WebControls.Literal) this.FindControl("litSoldCount");
            this.litConsultationsCount = (System.Web.UI.WebControls.Literal) this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (System.Web.UI.WebControls.Literal) this.FindControl("litReviewsCount");
            this.litActivityId         = (System.Web.UI.WebControls.Literal) this.FindControl("litActivityId");
            this.litState              = (System.Web.UI.WebControls.Literal) this.FindControl("litState");
            this.PrizeTime             = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("PrizeTime");
            this.buyNum           = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("buyNum");
            this.SaveBtn          = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("SaveBtn");
            this.ViewtReview      = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("ViewtReview");
            this.litMaxtxt        = (System.Web.UI.WebControls.Literal) this.FindControl("litMaxtxt");
            this.expandAttr       = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.skuSelector      = (Common_SKUSelector)this.FindControl("skuSelector");
            this.NomachMember     = (System.Web.UI.HtmlControls.HtmlContainerControl) this.FindControl("NomachMember");
            this.litMinNum        = (System.Web.UI.WebControls.Literal) this.FindControl("litMinNum");
            this.litPrizeNum      = (System.Web.UI.WebControls.Literal) this.FindControl("litPrizeNum");
            this.litFinished      = (System.Web.UI.WebControls.Literal) this.FindControl("litFinished");
            this.Prizeprogress    = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("Prizeprogress");
            this.litBuytxt        = (System.Web.UI.WebControls.Literal) this.FindControl("litBuytxt");
            this.litPrizeNum.Text = oneyuanTaoInfoById.ReachNum.ToString();
            this.litFinished.Text = oneyuanTaoInfoById.FinishedNum.ToString();
            int num = oneyuanTaoInfoById.ReachNum - oneyuanTaoInfoById.FinishedNum;

            if (num < 0)
            {
                num = 0;
            }
            this.litMinNum.Text = num.ToString();
            float num2 = (float)(100 * oneyuanTaoInfoById.FinishedNum / oneyuanTaoInfoById.ReachNum);

            this.Prizeprogress.Attributes.Add("style", "width:" + num2.ToString("F0") + "%");
            this.ViewtReview.Attributes.Add("href", "ProductReview.aspx?ProductId=" + oneyuanTaoInfoById.ProductId.ToString());
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            this.skuSelector.ProductId = this.productId;
            if (product != null)
            {
                if (this.rptProductImages != null)
                {
                    string       locationUrl = "javascript:;";
                    SlideImage[] source      = new SlideImage[]
                    {
                        new SlideImage(product.ImageUrl1, locationUrl),
                        new SlideImage(product.ImageUrl2, locationUrl),
                        new SlideImage(product.ImageUrl3, locationUrl),
                        new SlideImage(product.ImageUrl4, locationUrl),
                        new SlideImage(product.ImageUrl5, locationUrl)
                    };
                    this.rptProductImages.DataSource = from item in source
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                }
                this.litShortDescription.Text = product.ShortDescription;
            }
            int num3 = OneyuanTaoHelp.MermberCanbuyNum(oneyuanTaoInfoById.ActivityId, Globals.GetCurrentMemberUserId());

            this.buyNum.Attributes.Add("max", num3.ToString());
            this.litBuytxt.Text = string.Concat(new object[]
            {
                "限购",
                oneyuanTaoInfoById.EachCanBuyNum,
                "份,每份价格¥",
                oneyuanTaoInfoById.EachPrice.ToString("F2")
            });
            this.litMaxtxt.Text = "您已订购<di>" + (oneyuanTaoInfoById.EachCanBuyNum - num3).ToString() + "</di>份";
            if (num3 == 0 || oneTaoState != OneTaoState.进行中 || !MemberHelper.CheckCurrentMemberIsInRange(oneyuanTaoInfoById.FitMember, oneyuanTaoInfoById.DefualtGroup, oneyuanTaoInfoById.CustomGroup, this.CurrentMemberInfo.UserId))
            {
                this.buyNum.Attributes.Add("disabled", "disabled");
                this.SaveBtn.Visible = false;
            }
            string text;

            if (oneyuanTaoInfoById.FitMember == "0" || oneyuanTaoInfoById.CustomGroup == "0")
            {
                text = "全部会员";
            }
            else
            {
                text = "部分会员";
            }
            text = "适用会员:" + text;
            if (oneyuanTaoInfoById.FitMember != "0" && !MemberHelper.CheckCurrentMemberIsInRange(oneyuanTaoInfoById.FitMember, oneyuanTaoInfoById.DefualtGroup, oneyuanTaoInfoById.CustomGroup, this.CurrentMemberInfo.UserId))
            {
                text = "会员等级不符合活动要求";
                this.NomachMember.Attributes.Add("CanBuy", "false");
            }
            this.NomachMember.InnerHtml = text;
            string productName = product.ProductName;
            string text2       = product.Description;

            if (!string.IsNullOrEmpty(text2))
            {
                text2 = System.Text.RegularExpressions.Regex.Replace(text2, "<img[^>]*\\bsrc=('|\")([^'\">]*)\\1[^>]*>", "<img alt='" + System.Web.HttpContext.Current.Server.HtmlEncode(productName) + "' src='$2' />", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            }
            if (this.litDescription != null)
            {
                this.litDescription.Text = text2;
            }
            this.litProdcutName.Text = productName;
            this.litSalePrice.Text   = product.MinSalePrice.ToString("F2");
            this.litActivityId.Text  = oneyuanTaoInfoById.ActivityId;
            if (oneyuanTaoInfoById.ReachType == 1)
            {
                this.litActivityId.Text = "活动结束前满足总需份数,自动开出" + oneyuanTaoInfoById.PrizeNumber + "个奖品";
            }
            else if (oneyuanTaoInfoById.ReachType == 2)
            {
                this.litActivityId.Text = "活动到期自动开出" + oneyuanTaoInfoById.PrizeNumber + "个奖品";
            }
            else if (oneyuanTaoInfoById.ReachType == 3)
            {
                this.litActivityId.Text = "到开奖时间并满足总需份数,自动开出" + oneyuanTaoInfoById.PrizeNumber + "个奖品";
            }
            this.PrizeTime.Attributes.Add("PrizeTime", oneyuanTaoInfoById.EndTime.ToString("G"));
            this.litState.Text = oneTaoState.ToString();
            if (oneTaoState == OneTaoState.已开奖)
            {
                IsoDateTimeConverter isoDateTimeConverter = new IsoDateTimeConverter();
                isoDateTimeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                System.Web.UI.WebControls.Literal           literal            = (System.Web.UI.WebControls.Literal) this.FindControl("LitDataJson");
                System.Collections.Generic.IList <LuckInfo> winnerLuckInfoList = OneyuanTaoHelp.getWinnerLuckInfoList(oneyuanTaoInfoById.ActivityId, "");
                if (winnerLuckInfoList != null)
                {
                    literal.Text = "var LitDataJson=" + JsonConvert.SerializeObject(winnerLuckInfoList, new JsonConverter[]
                    {
                        isoDateTimeConverter
                    });
                }
                else
                {
                    literal.Text = "var LitDataJson=null";
                }
            }
            System.Web.UI.WebControls.Literal literal2 = (System.Web.UI.WebControls.Literal) this.FindControl("litJs");
            string title       = oneyuanTaoInfoById.Title;
            string activityDec = oneyuanTaoInfoById.ActivityDec;

            System.Uri url   = this.Context.Request.Url;
            string     text3 = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString()));
            string     text4 = oneyuanTaoInfoById.ProductImg;

            if (text4 == "/utility/pics/none.gif")
            {
                text4 = oneyuanTaoInfoById.HeadImgage;
            }
            literal2.Text = string.Concat(new string[]
            {
                "<script>wxinshare_title=\"",
                this.Context.Server.HtmlEncode(title.Replace("\n", " ").Replace("\r", "")),
                "\";wxinshare_desc=\"",
                this.Context.Server.HtmlEncode(activityDec.Replace("\n", " ").Replace("\r", "")),
                "\";wxinshare_link=location.href;wxinshare_imgurl=\"",
                text3,
                text4,
                "\"</script>"
            });
            PageTitle.AddSiteNameTitle("一元夺宝商品详情");
        }
Beispiel #5
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);
            }
        }
        protected override void AttachChildControls()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (!int.TryParse(this.Page.Request.QueryString["PreSaleId"], out this.presaleId))
            {
                this.ShowWapMessage("错误的活动ID", "Default.aspx");
                return;
            }
            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.presaleId);

            if (productPreSaleInfo == null)
            {
                this.ShowWapMessage("错误的活动ID", "Default.aspx");
                return;
            }
            if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
            {
                this.Page.Response.Redirect("ProductDetails.aspx?ProductId = " + productPreSaleInfo.ProductId);
                return;
            }
            this.productId               = productPreSaleInfo.ProductId;
            this.hidSupplier             = (HtmlInputHidden)this.FindControl("hidSupplier");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            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.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.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.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.ltlProductSendGifts2    = (Literal)this.FindControl("ltlProductSendGifts2");
            this.liOrderPromotions       = (HtmlGenericControl)this.FindControl("liOrderPromotions");
            this.liOrderPromotions2      = (HtmlGenericControl)this.FindControl("liOrderPromotions2");
            this.liProductSendGifts      = (HtmlGenericControl)this.FindControl("liProductSendGifts");
            this.liProductSendGifts2     = (HtmlGenericControl)this.FindControl("liProductSendGifts2");
            this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2");
            this.liOrderPromotions_free  = (HtmlGenericControl)this.FindControl("liOrderPromotions_free");
            this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.divshiptoregion         = (HtmlGenericControl)this.FindControl("divshiptoregion");
            this.divwaplocateaddress     = (HtmlGenericControl)this.FindControl("divwaplocateaddress");
            this.productFreight          = (ProductFreightLiteral)this.FindControl("productFreight");
            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.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litpresaleprice         = (Literal)this.FindControl("litpresaleprice");
            this.litsaleprice            = (Literal)this.FindControl("litsaleprice");
            this.litRetainage            = (Literal)this.FindControl("litRetainage");
            this.litDeliverGood          = (Literal)this.FindControl("litDeliverGood");
            this.hidEndDate              = (HtmlInputHidden)this.FindControl("hidEndDate");
            this.hidNowDate              = (HtmlInputHidden)this.FindControl("hidNowDate");
            this.hdAppId.Value           = masterSettings.WeixinAppId;
            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");
            ProductBrowseInfo productPreSaleBrowseInfo = ProductBrowser.GetProductPreSaleBrowseInfo(this.productId, true);

            if (productPreSaleBrowseInfo.Product == null || productPreSaleBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("ProductDelete.aspx");
                return;
            }
            if (productPreSaleBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.hidUnOnSale.Value = "1";
            }
            this.litpresaleprice.Text = ((productPreSaleInfo.DepositPercent == 0) ? productPreSaleInfo.Deposit.F2ToString("f2") : ((decimal)productPreSaleInfo.DepositPercent * productPreSaleBrowseInfo.Product.MinSalePrice / 100m).F2ToString("f2"));
            if (productPreSaleBrowseInfo.Product.MinSalePrice < productPreSaleBrowseInfo.Product.MaxSalePrice)
            {
                this.litsaleprice.Text = "¥" + productPreSaleBrowseInfo.Product.MinSalePrice.F2ToString("f2") + "~ ¥" + productPreSaleBrowseInfo.Product.MaxSalePrice.F2ToString("f2");
            }
            else
            {
                this.litsaleprice.Text = "¥" + productPreSaleBrowseInfo.Product.MinSalePrice.F2ToString("f2");
            }
            Literal  literal  = this.litRetainage;
            DateTime dateTime = productPreSaleInfo.PaymentStartDate;
            string   str      = dateTime.ToString("yyyy/MM/dd");

            dateTime     = productPreSaleInfo.PaymentEndDate;
            literal.Text = str + "~" + dateTime.ToString("yyyy/MM/dd");
            Literal literal2 = this.litDeliverGood;
            object  text;

            if (!productPreSaleInfo.DeliveryDate.HasValue)
            {
                text = $"尾款支付后{productPreSaleInfo.DeliveryDays}天内发货";
            }
            else
            {
                dateTime = productPreSaleInfo.DeliveryDate.Value;
                text     = dateTime.ToString("yyyy年MM月dd日") + "发货";
            }
            literal2.Text = (string)text;
            HtmlInputHidden htmlInputHidden2 = this.hidNowDate;

            dateTime = DateTime.Now;
            htmlInputHidden2.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            HtmlInputHidden htmlInputHidden3 = this.hidEndDate;

            dateTime = productPreSaleInfo.PreSaleEndDate;
            htmlInputHidden3.Value                 = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            this.skuSubmitOrder.ProductInfo        = productPreSaleBrowseInfo.Product;
            this.skuSubmitOrder.OrderBusiness      = 4;
            this.skuSubmitOrder.PreSaleId          = this.presaleId;
            this.skuSubmitOrder.productPreSaleInfo = productPreSaleInfo;
            this.lbUserProductRefer.product        = productPreSaleBrowseInfo.Product;
            this.productFreight.ShippingTemplateId = productPreSaleBrowseInfo.Product.ShippingTemplateId;
            this.productFreight.Volume             = productPreSaleBrowseInfo.Product.Weight;
            this.productFreight.Weight             = productPreSaleBrowseInfo.Product.Weight;
            this.hdTitle.Value = Globals.StripAllTags(string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.Title) ? productPreSaleBrowseInfo.Product.ProductName : productPreSaleBrowseInfo.Product.Title);
            this.hdDesc.Value  = Globals.StripAllTags(string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : productPreSaleBrowseInfo.Product.ShortDescription);
            string local = string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl1) ? SettingsManager.GetMasterSettings().DefaultProductImage : productPreSaleBrowseInfo.Product.ImageUrl1;

            this.hdImgUrl.Value = Globals.FullPath(local);
            this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
            IEnumerable enumerable = from item in productPreSaleBrowseInfo.Product.Skus
                                     select item.Value;

            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(this.productId);
            }
            IEnumerable value = from item in productPreSaleBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productPreSaleBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productPreSaleBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            if (this.hidden_productId != null)
            {
                this.hidden_productId.Value = this.productId.ToString();
            }
            if (this.promote != null)
            {
                this.promote.ProductId = this.productId;
            }
            int supplierId = productPreSaleBrowseInfo.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";
            }
            MemberInfo user = HiContext.Current.User;

            if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productPreSaleBrowseInfo.Product.SubMemberDeduct.HasValue))
            {
                if (!productPreSaleBrowseInfo.Product.SubMemberDeduct.HasValue)
                {
                    goto IL_0c63;
                }
                decimal?subMemberDeduct = productPreSaleBrowseInfo.Product.SubMemberDeduct;
                if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue)
                {
                    goto IL_0c63;
                }
            }
            goto IL_0c89;
IL_0c89:
            int num2 = 1;

            goto IL_0c8a;
IL_0c8a:
            if (num2 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            if (this.rptProductImages != null)
            {
                string locationUrl = "javascript:;";
                if (string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl1) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl2) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl3) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl4) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl5))
                {
                    productPreSaleBrowseInfo.Product.ImageUrl1 = masterSettings.DefaultProductImage;
                }
                List <SlideImage> list = new List <SlideImage>();
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl1, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl2, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl3, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl4, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl5, locationUrl));
                this.rptProductImages.DataSource = from item in list
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.Text         = productPreSaleBrowseInfo.Product.ProductName;
            this.litShortDescription.Text    = productPreSaleBrowseInfo.Product.ShortDescription;
            this.divShortDescription.Visible = !string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ShortDescription);
            if (this.litDescription != null)
            {
                string text2 = "";
                Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                if (!string.IsNullOrWhiteSpace(productPreSaleBrowseInfo.Product.MobbileDescription))
                {
                    text2 = regex.Replace(productPreSaleBrowseInfo.Product.MobbileDescription, "");
                }
                else if (!string.IsNullOrWhiteSpace(productPreSaleBrowseInfo.Product.Description))
                {
                    text2 = regex.Replace(productPreSaleBrowseInfo.Product.Description, "");
                }
                text2 = text2.Replace("src", "data-url");
                this.litDescription.Text = text2;
            }
            Literal control = this.litSoldCount;

            num = productPreSaleBrowseInfo.Product.ShowSaleCounts;
            control.SetWhenIsNotNull(num.ToString());
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            Literal control2 = this.litConsultationsCount;

            num = productPreSaleBrowseInfo.ConsultationCount;
            control2.SetWhenIsNotNull(num.ToString());
            Literal control3 = this.litReviewsCount;

            num = productPreSaleBrowseInfo.ReviewCount;
            control3.SetWhenIsNotNull(num.ToString());
            MemberInfo user2 = HiContext.Current.User;
            bool       flag  = false;

            if (user2 != null)
            {
                flag = ProductBrowser.CheckHasCollect(user2.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            this.BindCouponList();
            PageTitle.AddSiteNameTitle(productPreSaleBrowseInfo.Product.ProductName);
            this.BindPromotionInfo();
            this.BindGuestProducts();
            DataTable dBConsultations = productPreSaleBrowseInfo.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();
            return;

IL_0c63:
            if (HiContext.Current.SiteSettings.OpenReferral == 1)
            {
                num2 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0);
                goto IL_0c8a;
            }
            goto IL_0c89;
        }
Beispiel #7
0
        private Button buyButton;                     //购买按钮

        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["GiftId"], out this.GiftId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptGiftImages = (VshopTemplatedRepeater)this.FindControl("rptGiftImages"); //商品展示播
            this.litItemParams = (Literal)this.FindControl("litItemParams");
            this.litGiftName   = (Literal)this.FindControl("litGiftName");                  //礼物名
            this.litMyPoint    = (Literal)this.FindControl("litMyPoint");                   //我的积分
            //this.litActivities = (Literal) this.FindControl("litActivities");
            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.litStock              = (Literal)this.FindControl("litStock");//库存
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            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.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litgiftid             = (HtmlInputHidden)this.FindControl("litgiftid");
            this.buyButton             = (Button)this.FindControl("buyButton"); //购买按钮
            buyButton.Attributes.Add("OnClick", "return BuyProduct()");         //在后台为按钮绑定前端单击事件
            this.buyButton.Click += new EventHandler(this.buyButton_Click);     //给购买按钮绑定后台单击事件

            buyButton.Text = "立即兑换";
            //获取礼品信息
            GiftInfo gift = ProductBrowser.GetGiftDetails(GiftId);

            this.litgiftid.Value = this.GiftId.ToString();//将礼品id放到隐藏控件内
            //获取礼品展示图
            if (this.rptGiftImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] imageArray  = new SlideImage[] { new SlideImage(gift.ImageUrl, locationUrl) };
                this.rptGiftImages.DataSource = from item in imageArray
                                                where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                select item;
                this.rptGiftImages.DataBind();
            }
            //获取礼品名
            this.litGiftName.Text  = gift.Name;
            this.litSalePrice.Text = gift.NeedPoint.ToString();
            //获取库存
            this.litStock.Text = gift.Stock.ToString();
            //获取礼品市场价
            if (gift.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(gift.MarketPrice.GetValueOrDefault(0M).ToString("F2"));
            }
            //获取礼品描述
            this.litShortDescription.Text = gift.ShortDescription;
            if (this.litDescription != null)
            {
                this.litDescription.Text = gift.LongDescription;
            }
            //获取我的积分
            if (this.litMyPoint != null)
            {
                MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                this.litMyPoint.Text = currentMember.Points.ToString();
            }
            //页面标题
            PageTitle.AddSiteNameTitle("礼品详情");
        }
Beispiel #8
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
            this.litActivities         = (Literal)this.FindControl("litActivities");
            this.litSalePrice          = (Literal)this.FindControl("litSalePrice");
            this.litMemberGradeInfo    = (Literal)this.FindControl("litMemberGradeInfo");
            this.litMarketPrice        = (Literal)this.FindControl("litMarketPrice");
            this.litShortDescription   = (Literal)this.FindControl("litShortDescription");
            this.litDescription        = (Literal)this.FindControl("litDescription");
            this.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            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.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litproductid          = (HtmlInputHidden)this.FindControl("litproductid");
            this.specialHideShow       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("specialHideShow");
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

            this.litproductid.Value = this.productId.ToString();
            if (product == null)
            {
                base.GotoResourceNotFound("重复购买失败!该商品不存在或已下架");
            }
            if (!string.IsNullOrEmpty(product.MainCategoryPath))
            {
                DataTable allFull = ProductBrowser.GetAllFull(int.Parse(product.MainCategoryPath.Split(new char[] { '|' })[0].ToString()));
                this.litActivities.Text = "<div class=\"price clearfix\"><span class=\"title\">促销活动:</span><div class=\"all-action\">";
                if (allFull.Rows.Count > 0)
                {
                    for (int i = 0; i < allFull.Rows.Count; i++)
                    {
                        if (i == 0)
                        {
                            object text = this.litActivities.Text;
                            this.litActivities.Text = string.Concat(new object[] { text, "<div class=\"action\"><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=", allFull.Rows[i]["ActivitiesId"], "&CategoryId=", allFull.Rows[i]["ActivitiesType"], "\">", allFull.Rows[i]["ActivitiesName"].ToString(), "满", decimal.Parse(allFull.Rows[i]["MeetMoney"].ToString()).ToString("0"), "减", decimal.Parse(allFull.Rows[i]["ReductionMoney"].ToString()).ToString("0"), "</a>&nbsp;&nbsp;</span></div>" });
                        }
                        else
                        {
                            object obj3 = this.litActivities.Text;
                            this.litActivities.Text = string.Concat(new object[] { obj3, "<div class=\"action actionnone\"><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=", allFull.Rows[i]["ActivitiesId"], "&CategoryId=", allFull.Rows[i]["ActivitiesType"], "\">", allFull.Rows[i]["ActivitiesName"].ToString(), "满", decimal.Parse(allFull.Rows[i]["MeetMoney"].ToString()).ToString("0"), "减", decimal.Parse(allFull.Rows[i]["ReductionMoney"].ToString()).ToString("0"), "</a>&nbsp;&nbsp;</span></div>" });
                        }
                    }
                    this.litActivities.Text = this.litActivities.Text + "</div><em>&nbsp;more</em></div>";
                }
                else
                {
                    this.litActivities.Text = "";
                }
            }
            //传递爽爽挝啡的特殊名到前端,前端用jquery进行相应的功能隐藏
            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.AutoShipping)
            {
                specialHideShow.Value = "sswk";//爽爽挝啡
            }
            else if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.CouponRecharge)
            {
                if (product.ProductName == "会员充值")
                {
                    specialHideShow.Value = "JZ";//轿子洗衣
                }
            }

            if (!string.IsNullOrEmpty(this.litActivities.Text) && (product == null))
            {
                base.GotoResourceNotFound("此商品已不存在");
            }
            Uri u1 = HttpContext.Current.Request.UrlReferrer;

            if (product.SaleStatus != ProductSaleStatus.OnSale && (u1 == null || u1.ToString().ToLower().IndexOf("admin") == -1))
            {
                base.GotoResourceNotFound("此商品已下架");//20160505,增加处理,后台查看商品时允许显示
            }
            if (this.rptProductImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] imageArray  = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) };
                this.rptProductImages.DataSource = from item in imageArray
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            string mainCategoryPath = product.MainCategoryPath;

            if (!string.IsNullOrEmpty(mainCategoryPath))
            {
                this.litCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0];
            }
            else
            {
                this.litCategoryId.Value = "0";
            }
            this.litProdcutName.Text = product.ProductName;
            //this.litSalePrice.Text = product.MinSalePrice.ToString("F2");
            string currentMemberGradeName = (MemberProcessor.GetCurrentMember() == null) ? "" :
                                            string.Format("<span style='font-size:12px; background:#F90; color:#FFF; border-radius:3px; padding:3px 5px; margin-right:5px;'>{0}</span>"
                                                          , Hidistro.ControlPanel.Members.MemberHelper.GetMemberGrade(MemberProcessor.GetCurrentMember().GradeId).Name);

            this.litMemberGradeInfo.Text = currentMemberGradeName;
            //九信渐佳需求:如果是通过后台代理商点击商品链接跳转到此页面,显示成本价。
            //判断当前登陆的用户是不是代理商;
            ManagerInfo currentManager = ManagerHelper.GetCurrentManager();

            if (currentManager != null && ManagerHelper.GetRole(currentManager.RoleId).RoleName == "代理商")
            {
                //是代理商就显示成本价
                this.litSalePrice.Text = "¥" + product.MinCostPrice.ToString("F2");
            }
            else
            {
                //不是就显示原价
                this.litSalePrice.Text = "¥" + product.MinSalePrice.ToString("F2");
            }

            if (product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(product.MarketPrice.GetValueOrDefault(0M).ToString("F2"));
            }
            this.litShortDescription.Text = product.ShortDescription;
            if (this.litDescription != null)
            {
                this.litDescription.Text = product.Description;
            }
            this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());
            this.litStock.Text         = product.Stock.ToString();
            this.skuSelector.ProductId = this.productId;
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId;
            }
            this.litConsultationsCount.SetWhenIsNotNull(ProductBrowser.GetProductConsultationsCount(this.productId, false).ToString());
            this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(this.productId).ToString());
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            bool       flag          = false;

            if (currentMember != null)
            {
                flag = ProductBrowser.CheckHasCollect(currentMember.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            ProductBrowser.UpdateVisitCounts(this.productId);
            PageTitle.AddSiteNameTitle("商品详情");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            string       str3           = "";

            if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
            }
            this.litItemParams.Text = string.Concat(new object[] { str3, "|", masterSettings.GoodsName, "|", masterSettings.GoodsDescription, "$", Globals.HostPath(HttpContext.Current.Request.Url), product.ImageUrl1, "|", this.litProdcutName.Text, "|", product.ShortDescription, "|", HttpContext.Current.Request.Url });
        }
Beispiel #9
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
            this.litActivities         = (Literal)this.FindControl("litActivities");
            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.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            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.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litproductid          = (HtmlInputHidden)this.FindControl("litproductid");
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

            this.litproductid.Value = this.productId.ToString();
            if (!string.IsNullOrEmpty(product.MainCategoryPath))
            {
                DataTable allFull = ProductBrowser.GetAllFull(int.Parse(product.MainCategoryPath.Split(new char[] { '|' })[0].ToString()));
                this.litActivities.Text = "<div class=\"price clearfix\"><span class=\"title\">促销活动:</span><div class=\"all-action\">";
                if (allFull.Rows.Count > 0)
                {
                    for (int i = 0; i < allFull.Rows.Count; i++)
                    {
                        if (i == 0)
                        {
                            object text = this.litActivities.Text;
                            this.litActivities.Text = string.Concat(new object[] { text, "<div class=\"action\"><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=", allFull.Rows[i]["ActivitiesId"], "&CategoryId=", allFull.Rows[i]["ActivitiesType"], "\">", allFull.Rows[i]["ActivitiesName"].ToString(), "满", decimal.Parse(allFull.Rows[i]["MeetMoney"].ToString()).ToString("0"), "减", decimal.Parse(allFull.Rows[i]["ReductionMoney"].ToString()).ToString("0"), "</a>&nbsp;&nbsp;</span></div>" });
                        }
                        else
                        {
                            object obj3 = this.litActivities.Text;
                            this.litActivities.Text = string.Concat(new object[] { obj3, "<div class=\"action actionnone\"><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=", allFull.Rows[i]["ActivitiesId"], "&CategoryId=", allFull.Rows[i]["ActivitiesType"], "\">", allFull.Rows[i]["ActivitiesName"].ToString(), "满", decimal.Parse(allFull.Rows[i]["MeetMoney"].ToString()).ToString("0"), "减", decimal.Parse(allFull.Rows[i]["ReductionMoney"].ToString()).ToString("0"), "</a>&nbsp;&nbsp;</span></div>" });
                        }
                    }
                    this.litActivities.Text = this.litActivities.Text + "</div><em>&nbsp;more</em></div>";
                }
                else
                {
                    this.litActivities.Text = "";
                }
            }
            if (!string.IsNullOrEmpty(this.litActivities.Text) && (product == null))
            {
                base.GotoResourceNotFound("此商品已不存在");
            }
            if (product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已下架");
            }
            if (this.rptProductImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] imageArray  = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) };
                this.rptProductImages.DataSource = from item in imageArray
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            string mainCategoryPath = product.MainCategoryPath;

            if (!string.IsNullOrEmpty(mainCategoryPath))
            {
                this.litCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0];
            }
            else
            {
                this.litCategoryId.Value = "0";
            }
            this.litProdcutName.Text = product.ProductName;
            this.litSalePrice.Text   = product.MinSalePrice.ToString("F2");
            if (product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(product.MarketPrice.GetValueOrDefault(0M).ToString("F2"));
            }
            this.litShortDescription.Text = product.ShortDescription;
            if (this.litDescription != null)
            {
                this.litDescription.Text = product.Description;
            }
            this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());
            this.litStock.Text         = product.Stock.ToString();
            this.skuSelector.ProductId = this.productId;
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId;
            }
            this.litConsultationsCount.SetWhenIsNotNull(ProductBrowser.GetProductConsultationsCount(this.productId, false).ToString());
            this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(this.productId).ToString());
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            bool       flag          = false;

            if (currentMember != null)
            {
                flag = ProductBrowser.CheckHasCollect(currentMember.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            ProductBrowser.UpdateVisitCounts(this.productId);
            PageTitle.AddSiteNameTitle("商品详情");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            string       str3           = "";

            if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
            }
            this.litItemParams.Text = string.Concat(new object[] { str3, "|", masterSettings.GoodsName, "|", masterSettings.GoodsDescription, "$", Globals.HostPath(HttpContext.Current.Request.Url), product.ImageUrl1, "|", this.litProdcutName.Text, "|", product.ShortDescription, "|", HttpContext.Current.Request.Url });
        }
Beispiel #10
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages    = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litProdcutName      = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litSalePrice        = (System.Web.UI.WebControls.Literal) this.FindControl("litSalePrice");
            this.litMarketPrice      = (System.Web.UI.WebControls.Literal) this.FindControl("litMarketPrice");
            this.litShortDescription = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.litDescription      = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
            this.litTaxRate          = (System.Web.UI.WebControls.Literal) this.FindControl("litTaxRate");
            this.litShipping         = (System.Web.UI.WebControls.Literal) this.FindControl("litShipping");
            this.litStock            = (System.Web.UI.WebControls.Literal) this.FindControl("litStock");
            this.litBuyCardinality   = (System.Web.UI.WebControls.Literal) this.FindControl("litBuyCardinality");
            this.litSupplier         = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplier");
            this.lblsmalltitle       = (System.Web.UI.WebControls.Literal) this.FindControl("lblsmalltitle");
            this.litDiscrunt         = (System.Web.UI.WebControls.Literal) this.FindControl("litDiscrunt");
            this.litpropricemsg      = (System.Web.UI.WebControls.Literal) this.FindControl("litpropricemsg");
            this.litProPromration    = (System.Web.UI.WebControls.Literal) this.FindControl("litProPromration");
            this.litOrderPromration  = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderPromration");
            this.litFreeShip         = (System.Web.UI.WebControls.Literal) this.FindControl("litFreeShip");

            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (System.Web.UI.WebControls.HyperLink) this.FindControl("linkDescription");
            this.expandAttr            = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount          = (System.Web.UI.WebControls.Literal) this.FindControl("litSoldCount");
            this.litConsultationsCount = (System.Web.UI.WebControls.Literal) this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (System.Web.UI.WebControls.Literal) this.FindControl("litReviewsCount");
            this.litHasCollected       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litHasCollected");
            this.hidden_skus           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skus");
            this.hidden_BuyCardinality = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_BuyCardinality");
            this.lbUserProductRefer    = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.promote   = (ProductPromote)this.FindControl("ProductPromote");
            this.litCnArea = (System.Web.UI.WebControls.Literal) this.FindControl("litCnArea");
            this.imgIcon   = (HiImage)this.FindControl("imgIcon");
            //this.imgSupplierIcon = (HiImage)this.FindControl("imgSupplierIcon");

            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, null);

            if (productBrowseInfo == null)
            {
                base.GotoResourceNotFound("此商品已不存在");
            }

            if (productBrowseInfo.Product == null)
            {
                base.GotoResourceNotFound("此商品已不存在");
            }
            if (productBrowseInfo.Product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已下架");
            }
            if (!productBrowseInfo.Product.IsApproved)
            {
                base.GotoResourceNotFound("此商品未审核");
            }


            System.Collections.IEnumerable value =
                from item in productBrowseInfo.Product.Skus
                select item.Value;

            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }


            if (HiContext.Current.User.UserRole == UserRole.Member && ((Member)HiContext.Current.User).ReferralStatus == 2 && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
            {
                string text = System.Web.HttpContext.Current.Request.Url.ToString();
                if (text.IndexOf("?") > -1)
                {
                    text = text + "&ReferralUserId=" + HiContext.Current.User.UserId;
                }
                else
                {
                    text = text + "?ReferralUserId=" + HiContext.Current.User.UserId;
                }
                base.RegisterShareScript(productBrowseInfo.Product.ImageUrl4, text, productBrowseInfo.Product.ShortDescription, productBrowseInfo.Product.ProductName);
            }
            if (this.lbUserProductRefer != null)
            {
                this.lbUserProductRefer.product = productBrowseInfo.Product;
            }

            ImportSourceTypeInfo imSourceType = ProductBrowser.GetProductImportSourceType(this.productId);

            if (this.litCnArea != null && imSourceType != null)
            {
                this.litCnArea.Text = imSourceType.CnArea;
            }

            if (this.imgIcon != null && imSourceType != null)
            {
                this.imgIcon.ImageUrl = imSourceType.Icon;
            }

            if (this.rptProductImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] source      = new SlideImage[]
                {
                    new SlideImage(productBrowseInfo.Product.ImageUrl1, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl2, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl3, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl4, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl5, locationUrl),
                };
                this.rptProductImages.DataSource =
                    from item in source
                    where !string.IsNullOrWhiteSpace(item.ImageUrl)
                    select item;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.Text = productBrowseInfo.Product.ProductName;
            this.litSalePrice.Text   = productBrowseInfo.Product.MinSalePrice.ToString("F2");
            if (productBrowseInfo.Product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(productBrowseInfo.Product.MarketPrice.GetValueOrDefault(0m).ToString("F2"));
            }
            this.litShortDescription.Text = productBrowseInfo.Product.ShortDescription;
            if (this.litDescription != null)
            {
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("<script[^>]*?>.*?</script>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.MobblieDescription))
                {
                    this.litDescription.Text = regex.Replace(productBrowseInfo.Product.MobblieDescription, "");
                }
                else
                {
                    if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.Description))
                    {
                        this.litDescription.Text = regex.Replace(productBrowseInfo.Product.Description, "");
                    }
                }
            }
            this.litSoldCount.SetWhenIsNotNull(productBrowseInfo.Product.ShowSaleCounts.ToString());
            this.litStock.Text = productBrowseInfo.Product.Stock.ToString();
            //this.litTaxRate.Text = (productBrowseInfo.Product.TaxRate * 100).ToString("0");

            if (this.litTaxRate != null)
            {
                this.litTaxRate.Text = productBrowseInfo.Product.GetExtendTaxRate();
            }

            if (productBrowseInfo.Product.BuyCardinality > 1)
            {
                this.litBuyCardinality.Text = "起购数:" + productBrowseInfo.Product.BuyCardinality;
            }
            else
            {
                this.litBuyCardinality.Visible = false;
            }
            this.hidden_BuyCardinality.Value = productBrowseInfo.Product.BuyCardinality.ToString();

            //运费模版
            ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(Int32.Parse(productBrowseInfo.Product.TemplateId != null ? productBrowseInfo.Product.TemplateId.ToString() : "0"));

            this.litShipping.Text = shippingMode != null ? shippingMode.TemplateName : "未设置";

            this.skuSelector.ProductId = this.productId;
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId;
            }
            this.litConsultationsCount.SetWhenIsNotNull(productBrowseInfo.ConsultationCount.ToString());
            this.litReviewsCount.SetWhenIsNotNull(productBrowseInfo.ReviewCount.ToString());
            Member member     = HiContext.Current.User as Member;
            int    favoriteId = 0;

            if (member != null)
            {
                favoriteId = ProductBrowser.GetFavoriteId(member.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(favoriteId.ToString());

            if (this.promote != null)
            {
                this.promote.ProductId = this.productId;
            }
            PageTitle.AddSiteNameTitle(productBrowseInfo.Product.ProductName);

            //this.litSupplierName.Text = productBrowseInfo.SupplierName;

            //if (this.imgSupplierIcon != null && productBrowseInfo.SupplierImageUrl != null)
            //{
            //    this.imgSupplierIcon.ImageUrl = productBrowseInfo.SupplierImageUrl;
            //}

            if (productBrowseInfo.Product.SupplierId == null || productBrowseInfo.Product.SupplierId == 0)
            {
                this.litSupplier.Text = "";
            }
            else
            {
                this.litSupplier.Text = "<a class=\"shop-link fix\" href=\"/vshop/SupProductList.aspx?SupplierId=" + productBrowseInfo.Product.SupplierId + "\"><span>进入店铺</span><img src=\"" + productBrowseInfo.SupplierLogo + "\"/>" + productBrowseInfo.SupplierName + "</a>";
            }

            this.lblsmalltitle.Text = productBrowseInfo.Product.ProductTitle;

            //this.litDiscrunt = (System.Web.UI.WebControls.Literal)this.FindControl("litDiscrunt");
            //this.litpropricemsg = (System.Web.UI.WebControls.Literal)this.FindControl("litpropricemsg");
            //显示促销信息
            if (productBrowseInfo.Product.IsPromotion)
            {
                this.litpropricemsg.Text = "<span class=\"pro-pricemsg\">促销价</span>";
            }

            decimal tempMinSalePrice = productBrowseInfo.Product.MinSalePrice;                      //折扣价
            decimal tempMarketPrice  = productBrowseInfo.Product.MarketPrice.GetValueOrDefault(0m); //会员价
            decimal tempDiscrunt     = 1M;

            if (tempMarketPrice > 0)
            {
                tempDiscrunt = (tempMinSalePrice / tempMarketPrice) * 10;
            }
            //显示折扣信息
            if (productBrowseInfo.Product.IsDisplayDiscount)
            {
                this.litDiscrunt.Text = "<span class=\"pro-discrunt\">" + tempDiscrunt.ToString("F2") + "折</span>";
            }


            //PromotionInfo promotionInfo;
            List <OrderPromotionItem>   orderpromotionlist   = new List <OrderPromotionItem>();
            List <ProductPromotionItem> productpromotionlist = new List <ProductPromotionItem>();

            if (member != null)
            {
                //promotionInfo = ProductBrowser.GetProductPromotionInfo(member, productId);
                DataTable dtorderpromotion = ProductBrowser.GetOrderPromotionInfo(member);
                if (dtorderpromotion != null)
                {
                    OrderPromotionItem item = null;
                    foreach (DataRow row in dtorderpromotion.Rows)
                    {
                        item = new OrderPromotionItem();
                        if (row["Name"] != DBNull.Value)
                        {
                            item.Name = (string)row["Name"];
                        }
                        if (row["PromoteType"] != DBNull.Value)
                        {
                            item.PromoteType = (int)row["PromoteType"];
                        }
                        orderpromotionlist.Add(item);
                    }
                }

                DataTable dtproductpromotion = ProductBrowser.GetProductPromotionList(member, productId);
                if (dtproductpromotion != null)
                {
                    ProductPromotionItem item = null;
                    foreach (DataRow row in dtproductpromotion.Rows)
                    {
                        item = new ProductPromotionItem();
                        if (row["Name"] != DBNull.Value)
                        {
                            item.Name = (string)row["Name"];
                        }
                        if (row["PromoteType"] != DBNull.Value)
                        {
                            item.PromoteType = (int)row["PromoteType"];
                        }
                        productpromotionlist.Add(item);
                    }
                }
            }
            else
            {
                //promotionInfo = ProductBrowser.GetAllProductPromotionInfo(productId);
                DataTable dtorderpromotion = ProductBrowser.GetAllOrderPromotionInfo();
                if (dtorderpromotion != null)
                {
                    OrderPromotionItem item = null;
                    foreach (DataRow row in dtorderpromotion.Rows)
                    {
                        item = new OrderPromotionItem();
                        if (row["Name"] != DBNull.Value)
                        {
                            item.Name = (string)row["Name"];
                        }
                        if (row["PromoteType"] != DBNull.Value)
                        {
                            item.PromoteType = (int)row["PromoteType"];
                        }
                        orderpromotionlist.Add(item);
                    }
                }

                DataTable dtproductpromotion = ProductBrowser.GetAllProductPromotionList(productId);

                if (dtproductpromotion != null)
                {
                    ProductPromotionItem item = null;
                    foreach (DataRow row in dtproductpromotion.Rows)
                    {
                        item = new ProductPromotionItem();
                        if (row["Name"] != DBNull.Value)
                        {
                            item.Name = (string)row["Name"];
                        }
                        if (row["PromoteType"] != DBNull.Value)
                        {
                            item.PromoteType = (int)row["PromoteType"];
                        }
                        productpromotionlist.Add(item);
                    }
                }
            }


            //this.litProPromration = (System.Web.UI.WebControls.Literal)this.FindControl("litProPromration");
            //this.litOrderPromration = (System.Web.UI.WebControls.Literal)this.FindControl("litOrderPromration");
            //包邮
            if (orderpromotionlist != null)
            {
                for (int i = 0; i < orderpromotionlist.Count; i++)
                {
                    if (orderpromotionlist[i].PromoteType == 17)
                    {
                        this.litFreeShip.Text = "<div><span style=\"color:#999\">" + orderpromotionlist[i].Name + "</span></div>";
                    }
                    else
                    {
                        this.litOrderPromration.Text = "<span>" + orderpromotionlist[i].Name + "</span>";
                    }
                }
            }
            if (productpromotionlist != null)
            {
                for (int i = 0; i < productpromotionlist.Count; i++)
                {
                    this.litProPromration.Text = "<span>" + productpromotionlist[i].Name + "</span>";
                    break;
                }
            }
        }
        private Literal litEndtime;//抢购结束时间

        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["countDownId"], out this.countDownId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
            this.litActivities         = (Literal)this.FindControl("litActivities");
            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.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            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.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litproductid          = (HtmlInputHidden)this.FindControl("litproductid");
            this.litGroupbuyId         = (HtmlInputControl)this.FindControl("litGroupbuyId");
            this.litEndtime            = (Literal)this.FindControl("litEndtime");//抢购结束时间
            //ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);
            CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(countDownId);
            SiteSettings  masterSettings             = SettingsManager.GetMasterSettings(true);
            //ProductBrowseInfo info2 = ProductBrowser.GetProductBrowseInfo(countDownInfoByCountDownId.ProductId, null, null, masterSettings.StoreStockValidateType, masterSettings.OpenMultStore);
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), countDownInfoByCountDownId.ProductId);

            this.litproductid.Value = this.countDownId.ToString();

            if (!string.IsNullOrEmpty(this.litActivities.Text) && (product == null))
            {
                base.GotoResourceNotFound("此商品已不存在");
            }
            if (product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已下架");
            }
            if (this.rptProductImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] imageArray  = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) };
                this.rptProductImages.DataSource = from item in imageArray
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            string mainCategoryPath = product.MainCategoryPath;

            if (!string.IsNullOrEmpty(mainCategoryPath))
            {
                this.litCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0];
            }
            else
            {
                this.litCategoryId.Value = "0";
            }
            this.litProdcutName.Text = product.ProductName;
            this.litSalePrice.Text   = countDownInfoByCountDownId.CountDownPrice.ToString("F2");//现价是该商品的抢购价
            if (product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(product.MinSalePrice.ToString("F2"));//原价是该商品的一口价
            }
            this.litShortDescription.Text = product.ShortDescription;
            if (this.litDescription != null)
            {
                this.litDescription.Text = product.Description;
            }
            this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());
            this.litStock.Text         = countDownInfoByCountDownId.MaxCount.ToString(); //库存为限购数量
            this.skuSelector.ProductId = countDownInfoByCountDownId.ProductId;           //为型号选择器绑定productid
            if (this.litEndtime != null)                                                 //倒计时
            {
                this.litEndtime.Text = Convert.ToDateTime(countDownInfoByCountDownId.EndDate).ToString();
            }
            this.skuSelector.ProductId = countDownInfoByCountDownId.ProductId;
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = countDownInfoByCountDownId.ProductId;
            }
            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + countDownInfoByCountDownId.ProductId;
            }
            this.litConsultationsCount.SetWhenIsNotNull(ProductBrowser.GetProductConsultationsCount(countDownInfoByCountDownId.ProductId, false).ToString());
            this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(countDownInfoByCountDownId.ProductId).ToString());
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            bool       flag          = false;

            if (currentMember != null)
            {
                flag = ProductBrowser.CheckHasCollect(currentMember.UserId, countDownInfoByCountDownId.ProductId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            ProductBrowser.UpdateVisitCounts(countDownInfoByCountDownId.ProductId);
            PageTitle.AddSiteNameTitle("商品详情");
            string str3 = "";

            if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
            }
            string           str4 = "";
            DistributorsInfo userIdDistributors = new DistributorsInfo();

            userIdDistributors = DistributorsBrower.GetUserIdDistributors(base.referralId);
            if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
            {
                PageTitle.AddSiteNameTitle(userIdDistributors.StoreName);
            }
            string str5 = (userIdDistributors == null) ? masterSettings.SiteName : userIdDistributors.StoreName;

            if (!string.IsNullOrEmpty(masterSettings.DistributorBackgroundPic))
            {
                str4 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[] { '|' })[0];
            }
            string strDes = masterSettings.ShopHomeDescription;

            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.BrandShow)
            {
                strDes = "低价抢正品,马上有优惠,就在考拉萌购!";
            }

            this.litItemParams.Text = str3 + "|" + masterSettings.ShopHomeName + "|" + strDes + "$";
            this.litItemParams.Text = string.Concat(new object[] { this.litItemParams.Text, str4, "|好店推荐之", str5, "商城|" + strDes + "|", HttpContext.Current.Request.Url });
            this.litGroupbuyId.SetWhenIsNotNull(countDownInfoByCountDownId.CountDownId.ToString());
        }
Beispiel #12
0
        protected override void AttachChildControls()
        {
            this.rptProductImages      = (AppshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litProdcutName        = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litSalePrice          = (System.Web.UI.WebControls.Literal) this.FindControl("litSalePrice");
            this.litMarketPrice        = (System.Web.UI.WebControls.Literal) this.FindControl("litMarketPrice");
            this.litShortDescription   = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.litDescription        = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
            this.litStock              = (System.Web.UI.WebControls.Literal) this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (System.Web.UI.WebControls.HyperLink) this.FindControl("linkDescription");
            this.expandAttr            = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount          = (System.Web.UI.WebControls.Literal) this.FindControl("litSoldCount");
            this.litConsultationsCount = (System.Web.UI.WebControls.Literal) this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (System.Web.UI.WebControls.Literal) this.FindControl("litReviewsCount");
            this.litHasCollected       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litHasCollected");
            this.hidden_skus           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skus");
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, null);

            System.Collections.IEnumerable value =
                from item in productBrowseInfo.Product.Skus
                select item.Value;

            this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            if (productBrowseInfo == null || productBrowseInfo.Product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已不存在,或者已经被入库/下架");
            }
            if (this.rptProductImages != null)
            {
                System.Collections.Generic.IList <ProductIamge> list = new System.Collections.Generic.List <ProductIamge>();
                if (!string.IsNullOrEmpty(productBrowseInfo.Product.ImageUrl1))
                {
                    list.Add(new ProductIamge(productBrowseInfo.Product.ImageUrl1));
                }
                if (!string.IsNullOrEmpty(productBrowseInfo.Product.ImageUrl2))
                {
                    list.Add(new ProductIamge(productBrowseInfo.Product.ImageUrl2));
                }
                if (!string.IsNullOrEmpty(productBrowseInfo.Product.ImageUrl3))
                {
                    list.Add(new ProductIamge(productBrowseInfo.Product.ImageUrl3));
                }
                if (!string.IsNullOrEmpty(productBrowseInfo.Product.ImageUrl4))
                {
                    list.Add(new ProductIamge(productBrowseInfo.Product.ImageUrl4));
                }
                if (!string.IsNullOrEmpty(productBrowseInfo.Product.ImageUrl5))
                {
                    list.Add(new ProductIamge(productBrowseInfo.Product.ImageUrl5));
                }
                this.rptProductImages.DataSource = list;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.Text = productBrowseInfo.Product.ProductName;
            this.litSalePrice.Text   = productBrowseInfo.Product.MinSalePrice.ToString("F2");
            if (productBrowseInfo.Product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(productBrowseInfo.Product.MarketPrice.GetValueOrDefault(0m).ToString("F2"));
            }
            this.litShortDescription.Text = productBrowseInfo.Product.ShortDescription;
            if (this.litDescription != null)
            {
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("<script[^>]*?>.*?</script>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.MobblieDescription))
                {
                    this.litDescription.Text = regex.Replace(productBrowseInfo.Product.MobblieDescription, "");
                }
                else
                {
                    if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.Description))
                    {
                        this.litDescription.Text = regex.Replace(productBrowseInfo.Product.Description, "");
                    }
                }
            }
            this.litSoldCount.SetWhenIsNotNull(productBrowseInfo.Product.ShowSaleCounts.ToString());
            this.litStock.Text         = productBrowseInfo.Product.Stock.ToString();
            this.skuSelector.ProductId = this.productId;
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/AppShop/ProductDescription.aspx?productId=" + this.productId;
            }
            this.litConsultationsCount.SetWhenIsNotNull(productBrowseInfo.ConsultationCount.ToString());
            this.litReviewsCount.SetWhenIsNotNull(productBrowseInfo.ReviewCount.ToString());
            Member member = HiContext.Current.User as Member;
            bool   flag   = false;

            if (member != null)
            {
                flag = ProductBrowser.CheckHasCollect(member.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            PageTitle.AddSiteNameTitle("商品详情");
        }
Beispiel #13
0
        private Literal litEndtime;//抢购结束时间

        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["cutDownId"], out this.cutDownId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
            this.litActivities         = (Literal)this.FindControl("litActivities");
            this.litSalePrice          = (Literal)this.FindControl("litSalePrice");    //原价
            this.litCurrentPrice       = (Literal)this.FindControl("litCurrentPrice"); //当前价格
            this.litShortDescription   = (Literal)this.FindControl("litShortDescription");
            this.litDescription        = (Literal)this.FindControl("litDescription");
            this.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            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.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litproductid          = (HtmlInputHidden)this.FindControl("litproductid");
            this.litCutDownId          = (HtmlInputControl)this.FindControl("litCutDownId");
            this.litEndtime            = (Literal)this.FindControl("litEndtime");//抢购结束时间
            //ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);
            CutDownInfo  cutDownInfo    = PromoteHelper.GetCutDown(this.cutDownId);
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            //ProductBrowseInfo info2 = ProductBrowser.GetProductBrowseInfo(countDownInfoByCountDownId.ProductId, null, null, masterSettings.StoreStockValidateType, masterSettings.OpenMultStore);
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), cutDownInfo.ProductId);

            this.litproductid.Value = product.ProductId.ToString();

            if (!string.IsNullOrEmpty(this.litActivities.Text) && (product == null))
            {
                base.GotoResourceNotFound("此商品已不存在");
            }
            if (product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已下架");
            }
            if (this.rptProductImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] imageArray  = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) };
                this.rptProductImages.DataSource = from item in imageArray
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            string mainCategoryPath = product.MainCategoryPath;

            if (!string.IsNullOrEmpty(mainCategoryPath))
            {
                this.litCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0];
            }
            else
            {
                this.litCategoryId.Value = "0";
            }
            this.litProdcutName.Text = product.ProductName;
            this.litSalePrice.Text   = cutDownInfo.FirstPrice.ToString("F2");//原价是该活动的初始价
            if (product.MarketPrice.HasValue)
            {
                this.litCurrentPrice.SetWhenIsNotNull(cutDownInfo.CurrentPrice.ToString("F2"));//现价是该商品的被砍后的价格
            }
            this.litShortDescription.Text = product.ShortDescription;
            if (this.litDescription != null)
            {
                this.litDescription.Text = product.Description;
            }
            this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());
            this.litStock.Text         = cutDownInfo.Count.ToString(); //库存为限购数量
            this.skuSelector.ProductId = cutDownInfo.ProductId;        //为型号选择器绑定productid
            if (this.litEndtime != null)                               //倒计时
            {
                this.litEndtime.Text = Convert.ToDateTime(cutDownInfo.EndDate).ToString();
            }
            this.skuSelector.ProductId = cutDownInfo.ProductId;
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = cutDownInfo.ProductId;
            }
            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + cutDownInfo.ProductId;
            }
            this.litConsultationsCount.SetWhenIsNotNull(ProductBrowser.GetProductConsultationsCount(cutDownInfo.ProductId, false).ToString());
            this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(cutDownInfo.ProductId).ToString());
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            bool       flag          = false;

            if (currentMember != null)
            {
                flag = ProductBrowser.CheckHasCollect(currentMember.UserId, cutDownInfo.ProductId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            ProductBrowser.UpdateVisitCounts(cutDownInfo.ProductId);
            PageTitle.AddSiteNameTitle("商品详情");
            string str3 = "";

            if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
            }
            this.litItemParams.Text = string.Concat(new object[] { str3, "|", masterSettings.GoodsName, "|", masterSettings.GoodsDescription, "$", Globals.HostPath(HttpContext.Current.Request.Url), product.ImageUrl1, "|", this.litProdcutName.Text, "|", product.ShortDescription, "|", HttpContext.Current.Request.Url });
            this.litCutDownId.SetWhenIsNotNull(cutDownInfo.CutDownId.ToString());
        }
Beispiel #14
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            if (HiContext.Current.User.UserRole == UserRole.Member && ((Member)HiContext.Current.User).ReferralStatus == 2 && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
            {
                string text = System.Web.HttpContext.Current.Request.Url.ToString();
                if (text.IndexOf("?") > -1)
                {
                    text = text + "&ReferralUserId=" + HiContext.Current.User.UserId;
                }
                else
                {
                    text = text + "?ReferralUserId=" + HiContext.Current.User.UserId;
                }
                this.Page.Response.Redirect(text);
                return;
            }
            this.rptProductImages      = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.litProdcutName        = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litSalePrice          = (System.Web.UI.WebControls.Literal) this.FindControl("litSalePrice");
            this.litMarketPrice        = (System.Web.UI.WebControls.Literal) this.FindControl("litMarketPrice");
            this.litShortDescription   = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.litDescription        = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
            this.litTaxRate            = (System.Web.UI.WebControls.Literal) this.FindControl("litTaxRate");
            this.litShipping           = (System.Web.UI.WebControls.Literal) this.FindControl("litShipping");
            this.litStock              = (System.Web.UI.WebControls.Literal) this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (System.Web.UI.WebControls.HyperLink) this.FindControl("linkDescription");
            this.expandAttr            = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount          = (System.Web.UI.WebControls.Literal) this.FindControl("litSoldCount");
            this.litConsultationsCount = (System.Web.UI.WebControls.Literal) this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (System.Web.UI.WebControls.Literal) this.FindControl("litReviewsCount");
            this.litHasCollected       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litHasCollected");
            this.hidden_skus           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skus");
            this.lbUserProductRefer    = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.promote   = (ProductPromote)this.FindControl("ProductPromote");
            this.litCnArea = (System.Web.UI.WebControls.Literal) this.FindControl("litCnArea");
            //this.imgIcon = (HiImage)this.FindControl("imgIcon");

            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, null);

            System.Collections.IEnumerable value =
                from item in productBrowseInfo.Product.Skus
                select item.Value;

            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            if (productBrowseInfo == null)
            {
                base.GotoResourceNotFound("此商品已不存在");
            }
            if (productBrowseInfo.Product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已下架");
            }
            if (!productBrowseInfo.Product.IsApproved)
            {
                base.GotoResourceNotFound("此商品未审核");
            }
            //if (HiContext.Current.User.UserRole == UserRole.Member && ((Member)HiContext.Current.User).ReferralStatus == 2 && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
            //{
            //    string text = System.Web.HttpContext.Current.Request.Url.ToString();
            //    if (text.IndexOf("?") > -1)
            //    {
            //        text = text + "&ReferralUserId=" + HiContext.Current.User.UserId;
            //    }
            //    else
            //    {
            //        text = text + "?ReferralUserId=" + HiContext.Current.User.UserId;
            //    }
            //    base.RegisterShareScript(productBrowseInfo.Product.ImageUrl4, text, productBrowseInfo.Product.ShortDescription, productBrowseInfo.Product.ProductName);
            //}
            if (this.lbUserProductRefer != null)
            {
                this.lbUserProductRefer.product = productBrowseInfo.Product;
            }

            ImportSourceTypeInfo imSourceType = ProductBrowser.GetProductImportSourceType(this.productId);

            if (this.litCnArea != null && imSourceType != null)
            {
                this.litCnArea.Text = imSourceType.CnArea;
            }

            //if (this.imgIcon != null && imSourceType != null)
            //{
            //    this.imgIcon.ImageUrl = imSourceType.Icon;
            //}

            if (this.rptProductImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] source      = new SlideImage[]
                {
                    new SlideImage(productBrowseInfo.Product.ImageUrl1, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl2, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl3, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl4, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl5, locationUrl),
                };
                this.rptProductImages.DataSource =
                    from item in source
                    where !string.IsNullOrWhiteSpace(item.ImageUrl)
                    select item;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.Text = productBrowseInfo.Product.ProductName;
            this.litSalePrice.Text   = productBrowseInfo.Product.MinSalePrice.ToString("F2");
            if (productBrowseInfo.Product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(productBrowseInfo.Product.MarketPrice.GetValueOrDefault(0m).ToString("F2"));
            }
            this.litShortDescription.Text = productBrowseInfo.Product.ShortDescription;
            if (this.litDescription != null)
            {
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("<script[^>]*?>.*?</script>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.MobblieDescription))
                {
                    this.litDescription.Text = regex.Replace(productBrowseInfo.Product.MobblieDescription, "");
                }
                else
                {
                    if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.Description))
                    {
                        this.litDescription.Text = regex.Replace(productBrowseInfo.Product.Description, "");
                    }
                }
            }
            this.litSoldCount.SetWhenIsNotNull(productBrowseInfo.Product.ShowSaleCounts.ToString());
            this.litStock.Text   = productBrowseInfo.Product.Stock.ToString();
            this.litTaxRate.Text = (productBrowseInfo.Product.TaxRate * 100).ToString("0");

            //运费模版
            ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(Int32.Parse(productBrowseInfo.Product.TemplateId != null ? productBrowseInfo.Product.TemplateId.ToString() : "0"));

            this.litShipping.Text = shippingMode != null ? shippingMode.TemplateName : "未设置";

            this.skuSelector.ProductId = this.productId;
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId;
            }
            this.litConsultationsCount.SetWhenIsNotNull(productBrowseInfo.ConsultationCount.ToString());
            this.litReviewsCount.SetWhenIsNotNull(productBrowseInfo.ReviewCount.ToString());
            Member member = HiContext.Current.User as Member;
            bool   flag   = false;

            if (member != null)
            {
                flag = ProductBrowser.CheckHasCollect(member.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");

            if (this.promote != null)
            {
                this.promote.ProductId = this.productId;
            }
            PageTitle.AddSiteNameTitle(productBrowseInfo.Product.ProductName);
        }
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
            this.litProdcutTag         = (Literal)this.FindControl("litProdcutTag");
            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.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            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.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litproductid          = (HtmlInputHidden)this.FindControl("litproductid");
            this.litTemplate           = (HtmlInputHidden)this.FindControl("litTemplate");
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

            if (product != null)
            {
                this.litproductid.Value = this.productId.ToString();
                this.litTemplate.Value  = product.FreightTemplateId.ToString();
                if (product == null)
                {
                    base.GotoResourceNotFound("此商品已不存在");
                }
                if (product.SaleStatus != ProductSaleStatus.OnSale)
                {
                    base.GotoResourceNotFound(ErrorType.前台商品下架, "此商品已下架");
                }
                if (this.rptProductImages != null)
                {
                    string       locationUrl = "javascript:;";
                    SlideImage[] imageArray  = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) };
                    this.rptProductImages.DataSource = from item in imageArray
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                }
                string mainCategoryPath = product.MainCategoryPath;
                if (!string.IsNullOrEmpty(mainCategoryPath))
                {
                    this.litCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0];
                }
                else
                {
                    this.litCategoryId.Value = "0";
                }
                string productName    = product.ProductName;
                string productTagName = ProductBrowser.GetProductTagName(this.productId);
                if (!string.IsNullOrEmpty(productTagName))
                {
                    this.litProdcutTag.Text = "<div class='y-shopicon'>" + productTagName.Trim() + "</div>";
                    productTagName          = "<span class='producttag'>【" + HttpContext.Current.Server.HtmlEncode(productTagName) + "】</span>";
                }
                this.litProdcutName.Text = productTagName + productName;
                if (product.MinSalePrice != product.MaxSalePrice)
                {
                    this.litSalePrice.Text = product.MinSalePrice.ToString("F2") + "~" + product.MaxSalePrice.ToString("F2");
                }
                else
                {
                    this.litSalePrice.Text = product.MinSalePrice.ToString("F2");
                }
                if (product.MarketPrice.HasValue && (product.MarketPrice > 0M))
                {
                    this.litMarketPrice.Text = "<del class=\"text-muted font-s\">\x00a5" + product.MarketPrice.Value.ToString("F2") + "</del>";
                }
                this.litShortDescription.Text = product.ShortDescription;
                string description = product.Description;
                if (!string.IsNullOrEmpty(description))
                {
                    description = Regex.Replace(description, "<img[^>]*\\bsrc=('|\")([^'\">]*)\\1[^>]*>", "<img alt='" + HttpContext.Current.Server.HtmlEncode(productName) + "' src='$2' />", RegexOptions.IgnoreCase);
                }
                if (this.litDescription != null)
                {
                    this.litDescription.Text = description;
                }
                this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());
                this.litStock.Text         = product.Stock.ToString();
                this.skuSelector.ProductId = this.productId;
                if (this.expandAttr != null)
                {
                    this.expandAttr.ProductId = this.productId;
                }
                if (this.linkDescription != null)
                {
                    this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId;
                }
                int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(this.productId, false);
                this.litConsultationsCount.SetWhenIsNotNull(productConsultationsCount.ToString());
                this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(this.productId).ToString());
                MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                bool       flag          = false;
                if (currentMember != null)
                {
                    flag = ProductBrowser.CheckHasCollect(currentMember.UserId, this.productId);
                }
                this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
                ProductBrowser.UpdateVisitCounts(this.productId);
                PageTitle.AddSiteNameTitle(productName);
                PageTitle.AddSiteDescription(product.ShortDescription);
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                string       objStr         = "";
                if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
                {
                    objStr = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
                }
                this.litItemParams.Text = Globals.GetReplaceStr(objStr, "|", "|") + "|" + Globals.GetReplaceStr(masterSettings.GoodsName, "|", "|") + "|" + Globals.GetReplaceStr(masterSettings.GoodsDescription, "|", "|") + "$" + Globals.HostPath(HttpContext.Current.Request.Url).Replace("|", "|") + Globals.GetReplaceStr(product.ImageUrl1, "|", "|") + "|" + Globals.GetReplaceStr(product.ProductName, "|", "|") + "|" + Globals.GetReplaceStr(product.ShortDescription, "|", "|") + "|" + HttpContext.Current.Request.Url.ToString().Replace("|", "|");
            }
            else
            {
                HttpContext.Current.Response.Redirect("/default.aspx");
                HttpContext.Current.Response.End();
            }
        }
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId) || !int.TryParse(this.Page.Request.QueryString["exchangeId"], out this.exchangeId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
            this.litSalePoint          = (Literal)this.FindControl("litSalePoint");
            this.litMarketPrice        = (Literal)this.FindControl("litMarketPrice");
            this.litShortDescription   = (Literal)this.FindControl("litShortDescription");
            this.litSurplusTime        = (Literal)this.FindControl("litSurplusTime");
            this.litDescription        = (Literal)this.FindControl("litDescription");
            this.litStock              = (Literal)this.FindControl("litStock");
            this.litEachCount          = (Literal)this.FindControl("litEachCount");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            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.hdHasCollected        = (HtmlInputHidden)this.FindControl("hdHasCollected");
            this.hdCategoryId          = (HtmlInputHidden)this.FindControl("hdCategoryId");
            this.hdEachCount           = (HtmlInputHidden)this.FindControl("hdEachCount");
            this.hdProductId           = (HtmlInputHidden)this.FindControl("hdProductId");
            this.hdStock         = (HtmlInputHidden)this.FindControl("hdStock");
            this.hdIsActive      = (HtmlInputHidden)this.FindControl("hdIsActive");
            this.hdIsInRange     = (HtmlInputHidden)this.FindControl("hdIsInRange");
            this.hdPoint         = (HtmlInputHidden)this.FindControl("hdPoint");
            this.hdTemplateid    = (HtmlInputHidden)this.FindControl("hdTemplateid");
            this.hdUserExchanged = (HtmlInputHidden)this.FindControl("hdUserExchanged");
            PointExChangeInfo        info        = PointExChangeHelper.Get(this.exchangeId);
            PointExchangeProductInfo productInfo = PointExChangeHelper.GetProductInfo(this.exchangeId, this.productId);
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

            if (((info != null) && (product != null)) && (productInfo != null))
            {
                MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                if (currentMember != null)
                {
                    this.hdPoint.Value = currentMember.Points.ToString();
                    if (MemberProcessor.CheckCurrentMemberIsInRange(info.MemberGrades, info.DefualtGroup, info.CustomGroup))
                    {
                        this.hdIsInRange.Value = "true";
                    }
                    else
                    {
                        this.hdIsInRange.Value = "false";
                    }
                }
                if (info.EndDate < DateTime.Now)
                {
                    this.litSurplusTime.Text = "已结束";
                    this.hdIsActive.Value    = "0";
                }
                else if (info.BeginDate > DateTime.Now)
                {
                    this.litSurplusTime.Text = "未开始";
                    this.hdIsActive.Value    = "0";
                }
                else
                {
                    this.hdIsActive.Value = "1";
                    TimeSpan span = (TimeSpan)(info.EndDate - DateTime.Now);
                    if (span.Days > 1)
                    {
                        this.litSurplusTime.Text = string.Concat(new object[] { "还剩", span.Days, "天", span.Hours, "小时" });
                    }
                    else
                    {
                        this.litSurplusTime.Text = "还剩" + span.Hours + "小时";
                    }
                }
                this.hdProductId.Value = this.productId.ToString();
                if (product == null)
                {
                    base.GotoResourceNotFound("此商品已不存在");
                }
                if (product.SaleStatus != ProductSaleStatus.OnSale)
                {
                    base.GotoResourceNotFound(ErrorType.前台商品下架, "此商品已下架");
                }
                if (this.rptProductImages != null)
                {
                    string       locationUrl = "javascript:;";
                    SlideImage[] imageArray  = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) };
                    this.rptProductImages.DataSource = from item in imageArray
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                }
                string mainCategoryPath = product.MainCategoryPath;
                if (!string.IsNullOrEmpty(mainCategoryPath))
                {
                    this.hdCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0];
                }
                else
                {
                    this.hdCategoryId.Value = "0";
                }
                this.litProdcutName.Text = product.ProductName;
                this.hdTemplateid.Value  = product.FreightTemplateId.ToString();
                this.litSalePoint.Text   = productInfo.PointNumber.ToString();
                if (product.MarketPrice.HasValue && (product.MarketPrice > 0M))
                {
                    this.litMarketPrice.Text = "<del class=\"text-muted font-s\">\x00a5" + product.MarketPrice.Value.ToString("F2") + "</del>";
                }
                this.litShortDescription.Text = product.ShortDescription;
                string description = product.Description;
                if (!string.IsNullOrEmpty(description))
                {
                    description = Regex.Replace(description, "<img[^>]*\\bsrc=('|\")([^'\">]*)\\1[^>]*>", "<img alt='" + HttpContext.Current.Server.HtmlEncode(product.ProductName) + "' src='$2' />", RegexOptions.IgnoreCase);
                }
                if (this.litDescription != null)
                {
                    this.litDescription.Text = description;
                }
                this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());
                int productExchangedCount = PointExChangeHelper.GetProductExchangedCount(this.exchangeId, this.productId);
                int num2 = ((productInfo.ProductNumber - productExchangedCount) >= 0) ? (productInfo.ProductNumber - productExchangedCount) : 0;
                this.litStock.Text         = num2.ToString();
                this.hdStock.Value         = num2.ToString();
                this.litEachCount.Text     = productInfo.EachMaxNumber.ToString();
                this.hdEachCount.Value     = productInfo.EachMaxNumber.ToString();
                this.skuSelector.ProductId = this.productId;
                if (this.expandAttr != null)
                {
                    this.expandAttr.ProductId = this.productId;
                }
                if (this.linkDescription != null)
                {
                    this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId;
                }
                int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(this.productId, false);
                this.litConsultationsCount.SetWhenIsNotNull(productConsultationsCount.ToString());
                this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(this.productId).ToString());
                bool flag = false;
                if (currentMember != null)
                {
                    this.hdUserExchanged.Value = PointExChangeHelper.GetUserProductExchangedCount(this.exchangeId, this.productId, currentMember.UserId).ToString();
                    flag = ProductBrowser.CheckHasCollect(currentMember.UserId, this.productId);
                    this.hdHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
                }
                ProductBrowser.UpdateVisitCounts(this.productId);
                PageTitle.AddSiteNameTitle("积分商品");
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                string       objStr         = "";
                if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
                {
                    objStr = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
                }
                this.litItemParams.Text = Globals.GetReplaceStr(objStr, "|", "|") + "|" + Globals.GetReplaceStr(masterSettings.GoodsName, "|", "|") + "|" + Globals.GetReplaceStr(masterSettings.GoodsDescription, "|", "|") + "$" + Globals.HostPath(HttpContext.Current.Request.Url).Replace("|", "|") + Globals.GetReplaceStr(product.ImageUrl1, "|", "|") + "|" + Globals.GetReplaceStr(product.ProductName, "|", "|") + "|" + Globals.GetReplaceStr(product.ShortDescription, "|", "|") + "|" + HttpContext.Current.Request.Url.ToString().Replace("|", "|");
            }
            else
            {
                HttpContext.Current.Response.Redirect("/default.aspx");
                HttpContext.Current.Response.End();
            }
        }
Beispiel #17
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            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.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            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.litFenyong            = (Literal)this.FindControl("litFenyong");
            this.fenyongPanel          = (Panel)this.FindControl("fenyongPanel");

            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

            if (product == null)
            {
                base.GotoResourceNotFound("此商品已不存在");
            }

            if (product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已下架");
            }
            if (this.rptProductImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] imageArray  = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) };
                this.rptProductImages.DataSource = from item in imageArray
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.Text = product.ProductName;
            PageTitle.AddSiteNameTitle(product.ProductName);

            this.litSalePrice.Text = product.MinSalePrice.ToString("F2");
            if (product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(product.MarketPrice.GetValueOrDefault(0M).ToString("F2"));
            }
            this.litShortDescription.Text = product.ShortDescription;
            if (this.litDescription != null)
            {
                this.litDescription.Text = product.Description;
            }
            this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());
            this.litStock.Text         = product.Stock.ToString();
            this.skuSelector.ProductId = this.productId;
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId;
            }
            this.litConsultationsCount.SetWhenIsNotNull(ProductBrowser.GetProductConsultationsCount(this.productId, false).ToString());
            this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(this.productId).ToString());
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            bool       flag          = false;

            if (currentMember != null)
            {
                flag = ProductBrowser.CheckHasCollect(currentMember.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");

            //显示佣金
            try
            {
                //是否分销商
                DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId());
                if (currentDistributors != null)
                {
                    decimal commission = decimal.Parse(CategoryBrowser.GetCategory(product.CategoryId).FirstCommission);
                    this.litFenyong.Text = (commission * (product.MinSalePrice - product.MinCostPrice) / 100).ToString("F2");
                }
                else
                {
                    this.fenyongPanel.Visible = false;
                }
            }
            catch (Exception)
            {
            }

            ProductBrowser.UpdateVisitCounts(this.productId);
        }
        protected override void AttachChildControls()
        {
            #region 资源存在判断

            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }

            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);
            if (null == product)
            {
                base.GotoResourceNotFound("此商品已不存在");
            }

            if (product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound(ErrorType.前台商品下架, "此商品已下架");
            }

            #endregion

            #region 关联控件
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (System.Web.UI.WebControls.Literal) this.FindControl("litItemParams");
            this.litProdcutName        = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litProdcutTag         = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutTag");
            this.litSalePrice          = (System.Web.UI.WebControls.Literal) this.FindControl("litSalePrice");
            this.litMarketPrice        = (System.Web.UI.WebControls.Literal) this.FindControl("litMarketPrice");
            this.litShortDescription   = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.litDescription        = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
            this.litStock              = (System.Web.UI.WebControls.Literal) this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (System.Web.UI.WebControls.HyperLink) this.FindControl("linkDescription");
            this.expandAttr            = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount          = (System.Web.UI.WebControls.Literal) this.FindControl("litSoldCount");
            this.litConsultationsCount = (System.Web.UI.WebControls.Literal) this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (System.Web.UI.WebControls.Literal) this.FindControl("litReviewsCount");
            this.litHasCollected       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litHasCollected");
            this.litCategoryId         = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litCategoryId");
            this.litproductid          = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litproductid");
            this.litTemplate           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litTemplate");
            #endregion

            this.litproductid.Value = this.productId.ToString();
            this.litTemplate.Value  = product.FreightTemplateId.ToString();


            if (this.rptProductImages != null)
            {
                string locationUrl = "javascript:;";

                SlideImage[] source = new SlideImage[]
                {
                    new SlideImage(product.ImageUrl1, locationUrl),
                    new SlideImage(product.ImageUrl2, locationUrl),
                    new SlideImage(product.ImageUrl3, locationUrl),
                    new SlideImage(product.ImageUrl4, locationUrl),
                    new SlideImage(product.ImageUrl5, locationUrl)
                };

                this.rptProductImages.DataSource =
                    from item in source
                    where !string.IsNullOrWhiteSpace(item.ImageUrl)
                    select item;

                this.rptProductImages.DataBind();
            }

            string mainCategoryPath = product.MainCategoryPath;

            if (!string.IsNullOrEmpty(mainCategoryPath))
            {
                this.litCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0];
            }
            else
            {
                this.litCategoryId.Value = "0";
            }

            string productName = product.ProductName;

            string tagName = ProductBrowser.GetProductTagName(this.productId);

            if (!string.IsNullOrEmpty(tagName))
            {
                this.litProdcutTag.Text = "<div class='y-shopicon'>" + tagName.Trim() + "</div>";
                tagName = "<span class='producttag'>【" + System.Web.HttpContext.Current.Server.HtmlEncode(tagName) + "】</span>";
            }


            this.litProdcutName.Text = tagName + productName;

            this.litSalePrice.Text = product.MinSalePrice.ToString("F2");

            if (product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(product.MarketPrice.GetValueOrDefault(0m).ToString("F2"));
            }

            this.litShortDescription.Text = product.ShortDescription;

            string description = product.Description;

            //160519修改
            //if (!string.IsNullOrEmpty(description))
            //{
            //    description = System.Text.RegularExpressions.Regex.Replace(description, "<img[^>]*\\bsrc=('|\")([^'\">]*)\\1[^>]*>", "<img alt='" + System.Web.HttpContext.Current.Server.HtmlEncode(productName) + "' src=\"/Utility/images/blank.gif\" data-echo='$2' />", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            //}

            if (this.litDescription != null)
            {
                this.litDescription.Text = description;
            }

            this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());

            this.litStock.Text = product.Stock.ToString();

            this.skuSelector.ProductId = this.productId;

            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }

            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId;
            }

            int num = ProductBrowser.GetProductConsultationsCount(this.productId, false);

            this.litConsultationsCount.SetWhenIsNotNull(num.ToString());

            num = ProductBrowser.GetProductReviewsCount(this.productId);


            this.litReviewsCount.SetWhenIsNotNull(num.ToString());

            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            bool flag = false;
            if (currentMember != null)
            {
                flag = ProductBrowser.CheckHasCollect(currentMember.UserId, this.productId);
            }

            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");

            ProductBrowser.UpdateVisitCounts(this.productId);

            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            string hostPath = "";
            if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
            {
                hostPath = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
            }

            this.litItemParams.Text = string.Concat(new object[]
            {
                hostPath,
                "|",
                masterSettings.GoodsName,
                "|",
                masterSettings.GoodsDescription,
                "$",
                Globals.HostPath(System.Web.HttpContext.Current.Request.Url),
                product.ImageUrl1,
                "|",
                this.litProdcutName.Text,
                "|",
                product.ShortDescription,
                "|",
                System.Web.HttpContext.Current.Request.Url
            });


            PageTitle.AddSiteNameTitle(productName);

            PageTitle.AddSiteDescription(product.ShortDescription);

            // System.Web.HttpContext.Current.Response.Redirect("/vshop/");
            // System.Web.HttpContext.Current.Response.End();
        }
Beispiel #19
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            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.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            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.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litproductid          = (HtmlInputHidden)this.FindControl("litproductid");
            this.litTemplate           = (HtmlInputHidden)this.FindControl("litTemplate");
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

            if (product != null)
            {
                this.litproductid.Value = this.productId.ToString();
                this.litTemplate.Value  = product.FreightTemplateId.ToString();
                if (product == null)
                {
                    base.GotoResourceNotFound("此商品已不存在");
                }
                if (product.SaleStatus != ProductSaleStatus.OnSale)
                {
                    base.GotoResourceNotFound("此商品已下架");
                }
                if (this.rptProductImages != null)
                {
                    string       locationUrl = "javascript:;";
                    SlideImage[] imageArray  = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) };
                    this.rptProductImages.DataSource = from item in imageArray
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                }
                string mainCategoryPath = product.MainCategoryPath;
                if (!string.IsNullOrEmpty(mainCategoryPath))
                {
                    this.litCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0];
                }
                else
                {
                    this.litCategoryId.Value = "0";
                }
                this.litProdcutName.Text = product.ProductName;
                this.litSalePrice.Text   = product.MinSalePrice.ToString("F2");
                if (product.MarketPrice.HasValue)
                {
                    this.litMarketPrice.SetWhenIsNotNull(product.MarketPrice.GetValueOrDefault(0M).ToString("F2"));
                }
                this.litShortDescription.Text = product.ShortDescription;
                if (this.litDescription != null)
                {
                    this.litDescription.Text = product.Description;
                }
                this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());
                this.litStock.Text         = product.Stock.ToString();
                this.skuSelector.ProductId = this.productId;
                if (this.expandAttr != null)
                {
                    this.expandAttr.ProductId = this.productId;
                }
                if (this.linkDescription != null)
                {
                    this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId;
                }

                MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                int        UserId        = 0;
                if (currentMember != null)
                {
                    int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(this.productId, false, UserId);
                    this.litConsultationsCount.SetWhenIsNotNull(productConsultationsCount.ToString());
                    this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(this.productId, UserId).ToString());
                }
                else
                {
                    this.litConsultationsCount.SetWhenIsNotNull("0");
                    this.litReviewsCount.SetWhenIsNotNull("0");
                }

                bool flag = false;
                if (currentMember != null)
                {
                    flag = ProductBrowser.CheckHasCollect(currentMember.UserId, this.productId);
                }
                this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
                ProductBrowser.UpdateVisitCounts(this.productId);
                PageTitle.AddSiteNameTitle("商品详情");
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);
                string       str3           = "";
                if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
                {
                    str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
                }
                this.litItemParams.Text = string.Concat(new object[] { str3, "|", masterSettings.GoodsName, "|", masterSettings.GoodsDescription, "$", Globals.HostPath(HttpContext.Current.Request.Url), product.ImageUrl1, "|", this.litProdcutName.Text, "|", product.ShortDescription, "|", HttpContext.Current.Request.Url });
            }
            else
            {
                HttpContext.Current.Response.Redirect("/vshop/");
                HttpContext.Current.Response.End();
            }
        }