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");
 }
        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();
            }
        }
Exemple #3
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);
        }
Exemple #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("一元夺宝商品详情");
        }
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["id"], out this.bargainId))
            {
                base.GotoResourceNotFound("");
            }
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                BargainDetialInfo bargainDetialInfo = BargainHelper.GetBargainDetialInfo(this.bargainId, currentMember.UserId);
                if (bargainDetialInfo != null)
                {
                    this.Page.Response.Redirect(string.Concat(new object[] { "InviteBargainDetial.aspx?bargainId=", this.bargainId, "&bargainDetialId=", bargainDetialInfo.Id, "&ReferralId=", this.Page.Request.QueryString["ReferralId"] }));
                }
            }
            this.litProdcutName              = (Literal)this.FindControl("litProdcutName");
            this.litShortDescription         = (Literal)this.FindControl("litShortDescription");
            this.litSalePrice                = (Literal)this.FindControl("litSalePrice");
            this.litFloorPrice               = (Literal)this.FindControl("litFloorPrice");
            this.litFloorPrice1              = (Literal)this.FindControl("litFloorPrice1");
            this.litPurchaseNumber           = (Literal)this.FindControl("litPurchaseNumber");
            this.litParticipantNumber        = (Literal)this.FindControl("litParticipantNumber");
            this.litProductDesc              = (Literal)this.FindControl("litProductDesc");
            this.litProductConsultationTotal = (Literal)this.FindControl("litProductConsultationTotal");
            this.litProductCommentTotal      = (Literal)this.FindControl("litProductCommentTotal");
            this.litStock           = (Literal)this.FindControl("litStock");
            this.hiddHasCollected   = (HtmlInputHidden)this.FindControl("hiddHasCollected");
            this.hiddProductId      = (HtmlInputHidden)this.FindControl("hiddProductId");
            this.hiddEndDate        = (HtmlInputHidden)this.FindControl("hiddEndDate");
            this.hiddPurchaseNumber = (HtmlInputHidden)this.FindControl("hiddPurchaseNumber");
            this.skuSelector        = (Common_SKUSelector)this.FindControl("skuSelector");
            this.rptProductImages   = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.hideTitle          = (HtmlInputHidden)this.FindControl("hideTitle");
            this.hideImgUrl         = (HtmlInputHidden)this.FindControl("hideImgUrl");
            this.hideDesc           = (HtmlInputHidden)this.FindControl("hideDesc");
            bool        flag        = false;
            BargainInfo bargainInfo = BargainHelper.GetBargainInfo(this.bargainId);

            if (bargainInfo != null)
            {
                PageTitle.AddSiteNameTitle(bargainInfo.Title);
                this.litFloorPrice.Text        = bargainInfo.FloorPrice.ToString("F2");
                this.litFloorPrice1.Text       = bargainInfo.FloorPrice.ToString("F2");
                this.litSalePrice.Text         = bargainInfo.InitialPrice.ToString("f2");
                this.litPurchaseNumber.Text    = (bargainInfo.ActivityStock - bargainInfo.TranNumber).ToString();
                this.litParticipantNumber.Text = BargainHelper.HelpBargainCount(this.bargainId).ToString();
                this.hiddEndDate.Value         = bargainInfo.EndDate.ToString("yyyy:MM:dd:HH:mm:ss");
                this.hiddPurchaseNumber.Value  = bargainInfo.PurchaseNumber.ToString();
                this.litStock.Text             = bargainInfo.PurchaseNumber.ToString();
                this.hideTitle.Value           = bargainInfo.Title;
                this.hideDesc.Value            = bargainInfo.Remarks.Replace("\n", " ").Replace("\r", "");
                string activityCover = bargainInfo.ActivityCover;
                string str2          = string.Empty;
                Uri    url           = HttpContext.Current.Request.Url;
                if (!activityCover.StartsWith("http"))
                {
                    str2 = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString()));
                }
                if (bargainInfo.ProductId > 0)
                {
                    this.skuSelector.ProductId = bargainInfo.ProductId;
                    if (currentMember != null)
                    {
                        flag = ProductBrowser.CheckHasCollect(currentMember.UserId, bargainInfo.ProductId);
                    }
                    this.hiddHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
                    ProductInfo productDetails = ProductHelper.GetProductDetails(bargainInfo.ProductId);
                    if (productDetails == null)
                    {
                        this.Context.Response.Write("<script>alert('该商品不存在!');location.href='/default.aspx';</script>");
                        this.Context.Response.End();
                    }
                    else
                    {
                        this.hiddProductId.Value      = bargainInfo.ProductId.ToString();
                        this.litProdcutName.Text      = productDetails.ProductName;
                        this.litShortDescription.Text = productDetails.ProductShortName;
                        this.hideImgUrl.Value         = string.IsNullOrEmpty(productDetails.ThumbnailUrl60) ? (str2 + activityCover) : (str2 + productDetails.ThumbnailUrl60);
                        this.litProductDesc.Text      = productDetails.Description;
                        //if (this.rptProductImages != null)
                        //{
                        //    string locationUrl = "javascript:;";
                        //    SlideImage[] imageArray = new SlideImage[] { new SlideImage(productDetails.ImageUrl1, locationUrl), new SlideImage(productDetails.ImageUrl2, locationUrl), new SlideImage(productDetails.ImageUrl3, locationUrl), new SlideImage(productDetails.ImageUrl4, locationUrl), new SlideImage(productDetails.ImageUrl5, locationUrl) };
                        //    if (CS$<>9__CachedAnonymousMethodDelegate1 == null)
                        //    {
                        //        CS$<>9__CachedAnonymousMethodDelegate1 = new Func<SlideImage, bool>(null, (IntPtr) <AttachChildControls>b__0);
                        //    }
                        //    this.rptProductImages.DataSource = Enumerable.Where<SlideImage>(imageArray, CS$<>9__CachedAnonymousMethodDelegate1);
                        //    this.rptProductImages.DataBind();
                        //}
                        if (this.rptProductImages != null)
                        {
                            string       locationUrl = "javascript:;";
                            SlideImage[] imageArray  = new SlideImage[] { new SlideImage(productDetails.ImageUrl1, locationUrl), new SlideImage(productDetails.ImageUrl2, locationUrl), new SlideImage(productDetails.ImageUrl3, locationUrl), new SlideImage(productDetails.ImageUrl4, locationUrl), new SlideImage(productDetails.ImageUrl5, locationUrl) };
                            this.rptProductImages.DataSource = from item in imageArray
                                                               where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                               select item;
                            this.rptProductImages.DataBind();
                        }
                        int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(bargainInfo.ProductId, false);
                        this.litProductConsultationTotal.SetWhenIsNotNull(productConsultationsCount.ToString());
                        this.litProductCommentTotal.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(bargainInfo.ProductId).ToString());
                    }
                }
            }
        }
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["bargainId"], out this.bargainId))
            {
                base.GotoResourceNotFound("");
            }
            this.litProdcutName              = (Literal)this.FindControl("litProdcutName");
            this.litShortDescription         = (Literal)this.FindControl("litShortDescription");
            this.litSalePrice                = (Literal)this.FindControl("litSalePrice");
            this.litFloorPrice               = (Literal)this.FindControl("litFloorPrice");
            this.litFloorPrice1              = (Literal)this.FindControl("litFloorPrice1");
            this.litPurchaseNumber           = (Literal)this.FindControl("litPurchaseNumber");
            this.litParticipantNumber        = (Literal)this.FindControl("litParticipantNumber");
            this.litProductDesc              = (Literal)this.FindControl("litProductDesc");
            this.litProductConsultationTotal = (Literal)this.FindControl("litProductConsultationTotal");
            this.litProductCommentTotal      = (Literal)this.FindControl("litProductCommentTotal");
            this.litStock           = (Literal)this.FindControl("litStock");
            this.hiddHasCollected   = (HtmlInputHidden)this.FindControl("hiddHasCollected");
            this.hiddProductId      = (HtmlInputHidden)this.FindControl("hiddProductId");
            this.hideTitle          = (HtmlInputHidden)this.FindControl("hideTitle");
            this.hideImgUrl         = (HtmlInputHidden)this.FindControl("hideImgUrl");
            this.hideDesc           = (HtmlInputHidden)this.FindControl("hideDesc");
            this.hiddEndDate        = (HtmlInputHidden)this.FindControl("hiddEndDate");
            this.hiddPurchaseNumber = (HtmlInputHidden)this.FindControl("hiddPurchaseNumber");
            this.skuSelector        = (Common_SKUSelector)this.FindControl("skuSelector");
            this.rptProductImages   = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            MemberInfo  currentMember = MemberProcessor.GetCurrentMember();
            bool        flag          = false;
            BargainInfo bargainInfo   = BargainHelper.GetBargainInfo(this.bargainId);

            if (bargainInfo != null)
            {
                this.hideTitle.Value = bargainInfo.Title;
                this.hideDesc.Value  = bargainInfo.Remarks;
                Uri    url           = HttpContext.Current.Request.Url;
                string activityCover = bargainInfo.ActivityCover;
                string str2          = string.Empty;
                if (!activityCover.StartsWith("http"))
                {
                    str2 = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString()));
                }
                int id = Globals.RequestQueryNum("bargainDetialId");
                if (id > 0)
                {
                    BargainDetialInfo bargainDetialInfo = BargainHelper.GetBargainDetialInfo(id);
                    if ((currentMember == null) || (((currentMember != null) && (bargainDetialInfo != null)) && (bargainDetialInfo.UserId != currentMember.UserId)))
                    {
                        HttpContext.Current.Response.Redirect(string.Concat(new object[] { "HelpBargainDetial.aspx?bargainId=", this.bargainId, "&bargainDetialId=", id }));
                        HttpContext.Current.Response.End();
                    }
                }
                PageTitle.AddSiteNameTitle(bargainInfo.Title);
                this.litFloorPrice.Text        = bargainInfo.FloorPrice.ToString("F2");
                this.litFloorPrice1.Text       = bargainInfo.FloorPrice.ToString("F2");
                this.litPurchaseNumber.Text    = (bargainInfo.ActivityStock - bargainInfo.TranNumber).ToString();
                this.litParticipantNumber.Text = BargainHelper.HelpBargainCount(this.bargainId).ToString();
                this.hiddEndDate.Value         = bargainInfo.EndDate.ToString("yyyy:MM:dd:HH:mm:ss");
                this.hiddPurchaseNumber.Value  = bargainInfo.PurchaseNumber.ToString();
                this.litStock.Text             = bargainInfo.PurchaseNumber.ToString();
                if (bargainInfo.ProductId > 0)
                {
                    this.skuSelector.ProductId = bargainInfo.ProductId;
                    if (currentMember != null)
                    {
                        flag = ProductBrowser.CheckHasCollect(currentMember.UserId, bargainInfo.ProductId);
                    }
                    this.hiddHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
                    ProductInfo productDetails = ProductHelper.GetProductDetails(bargainInfo.ProductId);
                    this.hiddProductId.Value      = bargainInfo.ProductId.ToString();
                    this.litProdcutName.Text      = productDetails.ProductName;
                    this.litShortDescription.Text = productDetails.ShortDescription;
                    this.litSalePrice.Text        = productDetails.MinSalePrice.ToString("f2");
                    this.litProductDesc.Text      = productDetails.Description;
                    this.hideImgUrl.Value         = string.IsNullOrEmpty(productDetails.ThumbnailUrl60) ? (str2 + activityCover) : (str2 + productDetails.ThumbnailUrl60);
                    if (this.rptProductImages != null)
                    {
                        string       locationUrl = "javascript:;";
                        SlideImage[] imageArray  = new SlideImage[] { new SlideImage(productDetails.ImageUrl1, locationUrl), new SlideImage(productDetails.ImageUrl2, locationUrl), new SlideImage(productDetails.ImageUrl3, locationUrl), new SlideImage(productDetails.ImageUrl4, locationUrl), new SlideImage(productDetails.ImageUrl5, locationUrl) };
                        this.rptProductImages.DataSource = from item in imageArray
                                                           where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                           select item;
                        this.rptProductImages.DataBind();
                    }
                    int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(bargainInfo.ProductId, false);
                    this.litProductConsultationTotal.SetWhenIsNotNull(productConsultationsCount.ToString());
                    this.litProductCommentTotal.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(bargainInfo.ProductId).ToString());
                }
            }
            else
            {
                HttpContext.Current.Response.Redirect("/default.aspx");
                HttpContext.Current.Response.End();
            }
        }
Exemple #7
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);
        }
Exemple #8
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("礼品详情");
        }
        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();
            }
        }
Exemple #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.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 });
        }
        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;
                }
            }
        }
Exemple #12
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 });
        }
        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());
        }
Exemple #14
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("商品详情");
        }
Exemple #15
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());
        }
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["bargainId"], out this.bargainId))
            {
                base.GotoResourceNotFound("");
            }
            int num = int.Parse(this.Page.Request.QueryString["bargainDetialId"]);

            this.litProdcutName              = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litShortDescription         = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.litSalePrice                = (System.Web.UI.WebControls.Literal) this.FindControl("litSalePrice");
            this.litFloorPrice               = (System.Web.UI.WebControls.Literal) this.FindControl("litFloorPrice");
            this.litPurchaseNumber           = (System.Web.UI.WebControls.Literal) this.FindControl("litPurchaseNumber");
            this.litParticipantNumber        = (System.Web.UI.WebControls.Literal) this.FindControl("litParticipantNumber");
            this.litProductDesc              = (System.Web.UI.WebControls.Literal) this.FindControl("litProductDesc");
            this.litProductConsultationTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litProductConsultationTotal");
            this.litProductCommentTotal      = (System.Web.UI.WebControls.Literal) this.FindControl("litProductCommentTotal");
            this.litStock           = (System.Web.UI.WebControls.Literal) this.FindControl("litStock");
            this.litPurcharseNum    = (System.Web.UI.WebControls.Literal) this.FindControl("litPurcharseNum");
            this.hiddHasCollected   = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddHasCollected");
            this.hiddProductId      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddProductId");
            this.hiddEndDate        = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddEndDate");
            this.hiddPurchaseNumber = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddPurchaseNumber");
            this.rptProductImages   = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.skuSelector        = (Common_SKUSelector)this.FindControl("skuSelector");
            this.hideTitle          = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hideTitle");
            this.hideImgUrl         = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hideImgUrl");
            this.hideDesc           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hideDesc");
            MemberInfo        currentMember     = MemberProcessor.GetCurrentMember();
            bool              flag              = false;
            BargainInfo       bargainInfo       = BargainHelper.GetBargainInfo(this.bargainId);
            BargainDetialInfo bargainDetialInfo = BargainHelper.GetBargainDetialInfo(num);

            if (bargainInfo != null)
            {
                PageTitle.AddSiteNameTitle(bargainInfo.Title);
                this.litFloorPrice.Text        = bargainInfo.FloorPrice.ToString("F2");
                this.litPurchaseNumber.Text    = (bargainInfo.ActivityStock - bargainInfo.TranNumber).ToString();
                this.litParticipantNumber.Text = BargainHelper.GetHelpBargainDetialCount(num).ToString();
                this.hiddEndDate.Value         = bargainInfo.EndDate.ToString("yyyy:MM:dd:HH:mm:ss");
                this.hiddPurchaseNumber.Value  = bargainInfo.PurchaseNumber.ToString();
                this.litStock.Text             = bargainInfo.PurchaseNumber.ToString();
                this.litPurcharseNum.Text      = bargainInfo.PurchaseNumber.ToString();
                this.hideTitle.Value           = bargainInfo.Title;
                this.hideDesc.Value            = bargainInfo.Remarks.Replace("\n", " ").Replace("\r", "");
                string     activityCover = bargainInfo.ActivityCover;
                string     str           = string.Empty;
                System.Uri url           = System.Web.HttpContext.Current.Request.Url;
                if (!activityCover.StartsWith("http"))
                {
                    str = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString()));
                }
                if (bargainDetialInfo != null)
                {
                    this.litSalePrice.Text = bargainDetialInfo.Price.ToString("F2");
                }
                if (bargainInfo.ProductId > 0)
                {
                    this.skuSelector.ProductId = bargainInfo.ProductId;
                    if (currentMember != null)
                    {
                        flag = ProductBrowser.CheckHasCollect(currentMember.UserId, bargainInfo.ProductId);
                    }
                    this.hiddHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
                    ProductInfo productDetails = ProductHelper.GetProductDetails(bargainInfo.ProductId);
                    this.hiddProductId.Value      = bargainInfo.ProductId.ToString();
                    this.litProdcutName.Text      = productDetails.ProductName;
                    this.litShortDescription.Text = bargainInfo.Remarks;
                    this.hideImgUrl.Value         = (string.IsNullOrEmpty(productDetails.ThumbnailUrl60) ? (str + activityCover) : (str + productDetails.ThumbnailUrl60));
                    this.litProductDesc.Text      = productDetails.Description;
                    if (this.rptProductImages != null)
                    {
                        string       locationUrl = "javascript:;";
                        SlideImage[] source      = new SlideImage[]
                        {
                            new SlideImage(productDetails.ImageUrl1, locationUrl),
                            new SlideImage(productDetails.ImageUrl2, locationUrl),
                            new SlideImage(productDetails.ImageUrl3, locationUrl),
                            new SlideImage(productDetails.ImageUrl4, locationUrl),
                            new SlideImage(productDetails.ImageUrl5, locationUrl)
                        };
                        this.rptProductImages.DataSource = from item in source
                                                           where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                           select item;
                        this.rptProductImages.DataBind();
                    }
                    int num2 = ProductBrowser.GetProductConsultationsCount(bargainInfo.ProductId, false);
                    this.litProductConsultationTotal.SetWhenIsNotNull(num2.ToString());
                    num2 = ProductBrowser.GetProductReviewsCount(bargainInfo.ProductId);
                    this.litProductCommentTotal.SetWhenIsNotNull(num2.ToString());
                }
            }
        }
        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();
        }
Exemple #18
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();
            }
        }