protected override void AttachChildControls()
        {
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.ulConsultations         = (HtmlGenericControl)this.FindControl("ulConsultations");
            this.rptProductConsultations = (AppshopTemplatedRepeater)this.FindControl("rptProductConsultations");
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.Page.Request.QueryString["productId"].ToInt(0), null, SettingsManager.GetMasterSettings().OpenMultStore, 0);

            if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                base.GotoResourceNotFound("该件商品已经被管理员删除");
            }
            else
            {
                DataTable dBConsultations = productBrowseInfo.DBConsultations;
                for (int i = 0; i < dBConsultations.Rows.Count; i++)
                {
                    dBConsultations.Rows[i]["UserName"] = DataHelper.GetHiddenUsername(dBConsultations.Rows[i]["UserName"].ToNullString());
                }
                this.rptProductConsultations.DataSource = dBConsultations;
                this.rptProductConsultations.DataBind();
                this.divConsultationEmpty.Visible = dBConsultations.IsNullOrEmpty();
                this.ulConsultations.Visible      = !dBConsultations.IsNullOrEmpty();
                PageTitle.AddSiteNameTitle("商品咨询");
            }
        }
Ejemplo n.º 2
0
        protected override void Render(HtmlTextWriter writer)
        {
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.ProductId, null, null);
            //writer.Write("<input type=\"hidden\" name=\"productStock\" value=\"{0}\" />", productBrowseInfo.Product.Stock);
            //writer.Write("<input type=\"hidden\" name=\"productSkuId\" value=\"{0}\" />", productBrowseInfo.Product.SkuId);
            //writer.Write("<input type=\"hidden\" name=\"productQuantity\" value=\"{0}\" />", GetQuantity_Product(this.ProductId));
            var value = from item in productBrowseInfo.Product.Skus
                        select new { SkuId = item.Value.SkuId, Count = item.Value.Stock };

            writer.Write("<script type=\"text/javascript\">var productSkus_{0} = {1};var productQuantityInShoppingCart_{0} = {2};</script>"
                         , this.ProductId, JsonConvert.SerializeObject(value)
                         , JsonConvert.SerializeObject(GetProductQuantityInShoppingCart(this.ProductId, productBrowseInfo.Product.Skus)));
            this.DataSource = productBrowseInfo.DbSKUs;
            base.Render(writer);
        }
Ejemplo n.º 3
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["ProductId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            WapTemplatedRepeater rptOrderProducts = this.FindControl("rptOrderProducts") as WapTemplatedRepeater;

            ProductBrowseInfo   productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, null);
            IList <ProductInfo> productInfolist   = new List <ProductInfo>();

            productInfolist.Add(productBrowseInfo.Product);

            rptOrderProducts.DataSource = productInfolist;
            rptOrderProducts.DataBind();
        }
Ejemplo n.º 4
0
        public static ProductBrowseInfo GetAppletProductBrowseInfo(int productId, int gradeId = 0)
        {
            ProductBrowseDao productBrowseDao = new ProductBrowseDao();

            productBrowseDao.AddVistiCounts(productId);
            if (gradeId == 0)
            {
                MemberInfo user = HiContext.Current.User;
                if (user.UserId != 0)
                {
                    gradeId = user.GradeId;
                }
            }
            string            key = $"DataCache-AppletProduct-{productId}-{gradeId}";
            ProductBrowseInfo productBrowseInfo = HiCache.Get <ProductBrowseInfo>(key);

            if (productBrowseInfo == null)
            {
                productBrowseInfo = productBrowseDao.GetAppletProductBrowseInfo(productId, gradeId);
                HiCache.Insert(key, productBrowseInfo, 600);
            }
            return(productBrowseInfo);
        }
Ejemplo n.º 5
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
     {
         base.GotoResourceNotFound();
     }
     this.common_Location         = (Common_Location)this.FindControl("common_Location");
     this.litProductName          = (System.Web.UI.WebControls.Literal) this.FindControl("litProductName");
     this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
     this.lblStock                = (StockLabel)this.FindControl("lblStock");
     this.litUnit                 = (System.Web.UI.WebControls.Literal) this.FindControl("litUnit");
     this.litWeight               = (System.Web.UI.WebControls.Label) this.FindControl("litWeight");
     this.litBrosedNum            = (System.Web.UI.WebControls.Literal) this.FindControl("litBrosedNum");
     this.litBrand                = (System.Web.UI.WebControls.Literal) this.FindControl("litBrand");
     this.litContent              = (System.Web.UI.WebControls.Literal) this.FindControl("litContent");
     this.lblSalePrice            = (FormatedMoneyLabel)this.FindControl("lblSalePrice");
     this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
     this.litDescription          = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
     this.litShortDescription     = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
     this.btnOrder                = (BuyButton)this.FindControl("btnOrder");
     this.hpkProductConsultations = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductConsultations");
     this.hpkProductReviews       = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductReviews");
     this.txtMaxCount             = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtMaxCount");
     this.txtSoldCount            = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtSoldCount");
     this.lblCurrentSalePrice     = (FormatedMoneyLabel)this.FindControl("lblCurrentSalePrice");
     this.litCount                = (System.Web.UI.WebControls.Label) this.FindControl("litCount");
     this.lblNeedPrice            = (FormatedMoneyLabel)this.FindControl("lblNeedPrice");
     this.lblEndTime              = (FormatedTimeLabel)this.FindControl("lblEndTime");
     this.lblStartTime            = (FormatedTimeLabel)this.FindControl("lblStartTime");
     this.litRemainTime           = (System.Web.UI.WebControls.Literal) this.FindControl("litRemainTime");
     this.litNeedCount            = (System.Web.UI.WebControls.Literal) this.FindControl("litNeedCount");
     this.litMaxCount             = (System.Web.UI.WebControls.Label) this.FindControl("litMaxCount");
     this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
     this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
     this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
     this.reviews                 = (Common_ProductReview)this.FindControl("list_Common_ProductReview");
     this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
     this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
     this.nowTime                 = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("nowTime");
     this.nowTime.SetWhenIsNotNull(System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo));
     this.hidden_skus    = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skus");
     this.hidden_skuItem = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skuItem");
     if (!this.Page.IsPostBack)
     {
         ProductBrowseInfo productBrowseInfo   = ProductBrowser.GetProductBrowseInfo(this.productId, new int?(this.reviews.MaxNum), new int?(this.consultations.MaxNum));
         GroupBuyInfo      productGroupBuyInfo = ProductBrowser.GetProductGroupBuyInfo(this.productId);
         if (productBrowseInfo.Product == null || productGroupBuyInfo == null)
         {
             this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品参与的团购活动已经结束;或已被管理员删除"));
             return;
         }
         System.Collections.IEnumerable value =
             from item in productBrowseInfo.Product.Skus
             select item.Value;
         if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
         {
             this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
         }
         if (this.hidden_skus != null)
         {
             this.hidden_skus.Value = JsonConvert.SerializeObject(value);
         }
         this.LoadPageSearch(productBrowseInfo.Product);
         this.hpkProductReviews.Text              = "查看全部" + productBrowseInfo.ReviewCount.ToString() + "条评论";
         this.hpkProductConsultations.Text        = "查看全部" + productBrowseInfo.ConsultationCount.ToString() + "条咨询";
         this.hpkProductConsultations.NavigateUrl = string.Format("ProductConsultationsAndReplay.aspx?productId={0}", this.productId);
         this.hpkProductReviews.NavigateUrl       = string.Format("LookProductReviews.aspx?productId={0}", this.productId);
         this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
         this.LoadProductGroupBuyInfo(productGroupBuyInfo);
         this.btnOrder.Stock = productBrowseInfo.Product.Stock;
         BrowsedProductQueue.EnQueue(this.productId);
         this.images.ImageInfo = productBrowseInfo.Product;
         this.litContent.Text  = productGroupBuyInfo.Content;
         if (productBrowseInfo.DbAttribute != null)
         {
             this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
             this.rptExpandAttributes.DataBind();
         }
         if (productBrowseInfo.DbSKUs != null)
         {
             this.skuSelector.ProductId  = this.productId;
             this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
         }
         if (productBrowseInfo.DBReviews != null)
         {
             this.reviews.DataSource = productBrowseInfo.DBReviews;
             this.reviews.DataBind();
         }
         if (productBrowseInfo.DBConsultations != null)
         {
             this.consultations.DataSource = productBrowseInfo.DBConsultations;
             this.consultations.DataBind();
         }
         if (productBrowseInfo.DbCorrelatives != null)
         {
             this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
             this.correlative.DataBind();
         }
     }
 }
Ejemplo n.º 6
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
     {
         base.GotoResourceNotFound();
     }
     this.common_Location         = (Common_Location)this.FindControl("common_Location");
     this.litProductName          = (Literal)this.FindControl("litProductName");
     this.lblProductCode          = (Literal)this.FindControl("lblProductCode");
     this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
     this.lblStock                = (StockLabel)this.FindControl("lblStock");
     this.litUnit                 = (Literal)this.FindControl("litUnit");
     this.litWeight               = (Label)this.FindControl("litWeight");
     this.litBrosedNum            = (Literal)this.FindControl("litBrosedNum");
     this.litBrand                = (Literal)this.FindControl("litBrand");
     this.lblMarkerPrice          = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice");
     this.lblBuyPrice             = (Label)this.FindControl("lblBuyPrice");
     this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
     this.litDescription          = (Literal)this.FindControl("litDescription");
     this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
     this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
     this.hpkProductReviews       = (HyperLink)this.FindControl("hpkProductReviews");
     this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
     this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
     this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
     this.reviews                 = (Common_ProductReview)this.FindControl("list_Common_ProductReview");
     this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
     this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
     if (!this.Page.IsPostBack)
     {
         int maxNum = 0;
         if (this.reviews != null)
         {
             maxNum = this.reviews.MaxNum;
         }
         int num2 = 0;
         if (this.consultations != null)
         {
             num2 = this.consultations.MaxNum;
         }
         ProductBrowseInfo info = ProductBrowser.GetProductBrowseInfo(this.productId, new int?(maxNum), new int?(num2));
         if ((info.Product == null) || (info.Product.SaleStatus == ProductSaleStatus.Delete))
         {
             this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品已经被管理员删除"));
         }
         else if (info.Product.SaleStatus == ProductSaleStatus.OnSale)
         {
             Globals.GetSiteUrls().UrlData.FormatUrl("productdetails", new object[] { this.Page.Request.QueryString["productId"] });
         }
         else
         {
             this.LoadPageSearch(info.Product);
             if (this.hpkProductReviews != null)
             {
                 this.hpkProductReviews.Text        = "查看全部" + ProductBrowser.GetProductReviewNumber(this.productId).ToString() + "条评论";
                 this.hpkProductReviews.NavigateUrl = string.Format("LookProductReviews.aspx?productId={0}", this.productId);
             }
             if (this.hpkProductConsultations != null)
             {
                 this.hpkProductConsultations.Text        = "查看全部" + ProductBrowser.GetProductConsultationNumber(this.productId).ToString() + "条咨询";
                 this.hpkProductConsultations.NavigateUrl = string.Format("ProductConsultationsAndReplay.aspx?productId={0}", this.productId);
             }
             this.LoadProductInfo(info.Product, info.BrandName);
             BrowsedProductQueue.EnQueue(this.productId);
             this.images.ImageInfo = info.Product;
             if (info.DbAttribute != null)
             {
                 this.rptExpandAttributes.DataSource = info.DbAttribute;
                 this.rptExpandAttributes.DataBind();
             }
             if (info.DbSKUs != null)
             {
                 this.skuSelector.ProductId  = this.productId;
                 this.skuSelector.DataSource = info.DbSKUs;
             }
             if ((this.reviews != null) && (info.DBReviews != null))
             {
                 this.reviews.DataSource = info.DBReviews;
                 this.reviews.DataBind();
             }
             if ((this.consultations != null) && (info.DBConsultations != null))
             {
                 this.consultations.DataSource = info.DBConsultations;
                 this.consultations.DataBind();
             }
             if ((this.correlative != null) && (info.DbCorrelatives != null))
             {
                 this.correlative.DataSource = info.DbCorrelatives;
                 this.correlative.DataBind();
             }
         }
     }
 }
        private void SetControlsValue(CountDownInfo countDownInfo)
        {
            this.skuSubmitOrder.CountDownId   = countDownInfo.CountDownId;
            this.skuSubmitOrder.OrderBusiness = 2;
            HtmlInputHidden htmlInputHidden = this.hdCountDownId;
            int             num             = countDownInfo.CountDownId;

            htmlInputHidden.Value    = num.ToString();
            this.hiddenIsLogin.Value = HiContext.Current.UserId.ToString();
            SiteSettings      masterSettings    = SettingsManager.GetMasterSettings();
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(countDownInfo.ProductId, null, masterSettings.OpenMultStore, 0);

            if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                base.GotoResourceNotFound("抢购商品已不存在");
            }
            else
            {
                if (productBrowseInfo.Product == null)
                {
                    this.hidden_IsOver.Value = "pullOff";
                }
                else if (!productBrowseInfo.Product.SaleStatus.Equals(ProductSaleStatus.OnSale))
                {
                    this.hidden_IsOver.Value = "pullOff";
                }
                if (countDownInfo.StartDate > DateTime.Now)
                {
                    this.hidden_IsOver.Value = "AboutToBegin";
                }
                else if (countDownInfo.EndDate < DateTime.Now)
                {
                    this.hidden_IsOver.Value = "over";
                }
                else if (!countDownInfo.IsRunning)
                {
                    this.hidden_IsOver.Value = "true";
                }
                if (productBrowseInfo.Product.SaleStatus != ProductSaleStatus.OnSale)
                {
                    base.GotoResourceNotFound("此商品已下架");
                }
                if (this.rptProductImages != null)
                {
                    string            locationUrl = "javascript:;";
                    List <SlideImage> list        = new List <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)
                    };
                    IEnumerable <SlideImage> source = from item in list
                                                      where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                      select item;
                    if (source.Count() == 0)
                    {
                        list.Add(new SlideImage(masterSettings.DefaultProductImage, locationUrl));
                    }
                    this.rptProductImages.DataSource = from item in list
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                }
                this.skuSubmitOrder.ProductInfo = productBrowseInfo.Product;
                this.litProdcutName.SetWhenIsNotNull(productBrowseInfo.Product.ProductName);
                Literal control = this.litminCount;
                num = countDownInfo.MaxCount;
                control.SetWhenIsNotNull(num.ToString());
                this.litShortDescription.SetWhenIsNotNull(productBrowseInfo.Product.ShortDescription);
                if (this.litDescription != null)
                {
                    string text  = "";
                    Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                    if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.MobbileDescription))
                    {
                        text = regex.Replace(productBrowseInfo.Product.MobbileDescription, "");
                    }
                    else if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.Description))
                    {
                        text = regex.Replace(productBrowseInfo.Product.Description, "");
                    }
                    text = text.Replace("src", "data-url");
                    this.litDescription.Text = text;
                }
                this.litprice.SetWhenIsNotNull(PromoteHelper.GetCountDownSalePrice(this.countDownId).F2ToString("f2"));
                this.litLeftSeconds.SetWhenIsNotNull(Math.Ceiling((countDownInfo.EndDate - DateTime.Now).TotalSeconds).ToString());
                this.litcontent.SetWhenIsNotNull(countDownInfo.Content);
                HtmlInputControl control2 = this.litGroupBuyId;
                num = countDownInfo.CountDownId;
                control2.SetWhenIsNotNull(num.ToString());
                if (productBrowseInfo.Product.MarketPrice.HasValue && productBrowseInfo.Product.MarketPrice.Value > decimal.Zero)
                {
                    this.salePrice.SetWhenIsNotNull(productBrowseInfo.Product.MarketPrice.Value.F2ToString("f2"));
                }
                else
                {
                    this.salePrice.SetWhenIsNotNull(productBrowseInfo.Product.Skus.Max((KeyValuePair <string, SKUItem> c) => c.Value.SalePrice).F2ToString("f2"));
                }
                HtmlInputControl control3 = this.txtProductId;
                num = countDownInfo.ProductId;
                control3.SetWhenIsNotNull(num.ToString());
                Literal control4 = this.litConsultationsCount;
                num = productBrowseInfo.ConsultationCount;
                control4.SetWhenIsNotNull(num.ToString());
                Literal control5 = this.litReviewsCount;
                num = productBrowseInfo.ReviewCount;
                control5.SetWhenIsNotNull(num.ToString());
                this.litGroupbuyDescription.SetWhenIsNotNull(countDownInfo.Content);
                Literal control6 = this.litMaxCount;
                num = countDownInfo.MaxCount;
                control6.SetWhenIsNotNull(num.ToString());
                this.nowTime = (HtmlInputHidden)this.FindControl("nowTime");
                HtmlInputHidden control7 = this.nowTime;
                DateTime        dateTime = DateTime.Now;
                control7.SetWhenIsNotNull(dateTime.ToString("yyyy/MM/dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo));
                HtmlInputHidden control8 = this.startTime;
                dateTime = countDownInfo.StartDate;
                control8.SetWhenIsNotNull(dateTime.ToString("yyyy/MM/dd HH:mm:ss"));
                HtmlInputHidden control9 = this.endTime;
                dateTime = countDownInfo.EndDate;
                control9.SetWhenIsNotNull(dateTime.ToString("yyyy/MM/dd HH:mm:ss"));
                HtmlInputHidden control10 = this.groupBuyMaxCount;
                num = countDownInfo.MaxCount;
                control10.SetWhenIsNotNull(num.ToString());
                HtmlInputHidden control11 = this.skuStock;
                num = productBrowseInfo.Product.DefaultSku.Stock;
                control11.SetWhenIsNotNull(num.ToString());
                this.litUnit.SetWhenIsNotNull(string.IsNullOrEmpty(productBrowseInfo.Product.Unit) ? "件" : productBrowseInfo.Product.Unit);
            }
        }
 protected override void AttachChildControls()
 {
     if (!int.TryParse(base.GetParameter("countDownId", false), out this.countDownId))
     {
         base.GotoResourceNotFound();
     }
     this.common_Location         = (Common_Location)this.FindControl("common_Location");
     this.litProductCode          = (Literal)this.FindControl("litProductCode");
     this.litProductName          = (Literal)this.FindControl("litProductName");
     this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
     this.lblStock                = (StockLabel)this.FindControl("lblStock");
     this.litUnit                 = (Literal)this.FindControl("litUnit");
     this.litSurplusNumber        = (Literal)this.FindControl("litSurplusNumber");
     this.litWeight               = (Label)this.FindControl("litWeight");
     this.litBrosedNum            = (Literal)this.FindControl("litBrosedNum");
     this.litBrand                = (Literal)this.FindControl("litBrand");
     this.litmaxcount             = (Literal)this.FindControl("litMaxCount");
     this.lblSalePrice            = (FormatedMoneyLabel)this.FindControl("lblSalePrice");
     this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
     this.litDescription          = (Literal)this.FindControl("litDescription");
     this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
     this.btnOrder                = (BuyButton)this.FindControl("btnOrder");
     this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
     this.ltlSaleCount            = (Literal)this.FindControl("ltlSaleCount");
     this.ltlConsultation         = (Literal)this.FindControl("ltlConsultation");
     this.ltlReviewCount          = (Literal)this.FindControl("ltlReviewCount");
     this.lblCurrentSalePrice     = (FormatedMoneyLabel)this.FindControl("lblCurrentSalePrice");
     this.litContent              = (Literal)this.FindControl("litContent");
     this.lblEndTime              = (FormatedTimeLabel)this.FindControl("lblEndTime");
     this.lblStartTime            = (FormatedTimeLabel)this.FindControl("lblStartTime");
     this.litRemainTime           = (Literal)this.FindControl("litRemainTime");
     this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
     this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
     this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
     this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
     this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
     this.nowTime                 = (HtmlInputHidden)this.FindControl("nowTime");
     this.nowTime.SetWhenIsNotNull(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo));
     this.hidden_skus        = (HtmlInputHidden)this.FindControl("hidden_skus");
     this.hidden_skuItem     = (HtmlInputHidden)this.FindControl("hidden_skuItem");
     this.hidden_IsOver      = (HtmlInputHidden)this.FindControl("hidden_IsOver");
     this.hidden_CountDownId = (HtmlInputHidden)this.FindControl("hidden_CountDownId");
     this.hidden_productId   = (HtmlInputHidden)this.FindControl("hidden_productId");
     this.hdShareDetails     = (HtmlInputHidden)this.FindControl("hdShareDetails");
     this.hdShareIcon        = (HtmlInputHidden)this.FindControl("hdShareIcon");
     this.hdShareTitle       = (HtmlInputHidden)this.FindControl("hdShareTitle");
     if (!this.Page.IsPostBack)
     {
         CountDownInfo countDownInfo  = PromoteHelper.GetCountDownInfo(this.countDownId, 0);
         SiteSettings  masterSettings = SettingsManager.GetMasterSettings();
         if (countDownInfo != null)
         {
             HtmlInputHidden htmlInputHidden = this.hidden_CountDownId;
             int             num             = countDownInfo.CountDownId;
             htmlInputHidden.Value = num.ToString();
             HtmlInputHidden htmlInputHidden2 = this.hidden_productId;
             num = countDownInfo.ProductId;
             htmlInputHidden2.Value = num.ToString();
             int num2 = 0;
             ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(countDownInfo.ProductId, null, masterSettings.OpenMultStore, 0);
             Literal           literal           = this.ltlReviewCount;
             num          = productBrowseInfo.ReviewCount;
             literal.Text = num.ToString();
             Literal literal2 = this.ltlSaleCount;
             num           = productBrowseInfo.SaleCount;
             literal2.Text = num.ToString();
             if (productBrowseInfo.Product == null)
             {
                 this.hidden_IsOver.Value = "pullOff";
             }
             else if (!productBrowseInfo.Product.SaleStatus.Equals(ProductSaleStatus.OnSale))
             {
                 this.hidden_IsOver.Value = "pullOff";
             }
             if (!string.IsNullOrEmpty(countDownInfo.ShareDetails))
             {
                 HtmlInputHidden htmlInputHidden3 = this.hdShareDetails;
                 htmlInputHidden3.Value += countDownInfo.ShareDetails;
             }
             else if (!string.IsNullOrEmpty(countDownInfo.Content))
             {
                 this.hdShareDetails.Value = "限时抢购简单说明:";
                 HtmlInputHidden htmlInputHidden4 = this.hdShareDetails;
                 htmlInputHidden4.Value += countDownInfo.Content;
             }
             else
             {
                 this.hdShareDetails.Value = "限时抢购简单说明:";
             }
             Literal literal3 = this.ltlConsultation;
             num                     = productBrowseInfo.ConsultationCount;
             literal3.Text           = num.ToString();
             this.hdShareIcon.Value  = Globals.FullPath(countDownInfo.ShareIcon);
             this.hdShareTitle.Value = countDownInfo.ShareTitle;
             if (countDownInfo.StartDate > DateTime.Now)
             {
                 this.hidden_IsOver.Value = "AboutToBegin";
             }
             else if (countDownInfo.EndDate < DateTime.Now)
             {
                 this.hidden_IsOver.Value = "over";
             }
             else if (!countDownInfo.IsRunning)
             {
                 this.hidden_IsOver.Value = "true";
             }
             num2 = PromoteHelper.GetCountDownSurplusNumber(this.countDownId);
             num2 = ((num2 >= 0) ? num2 : 0);
             this.litSurplusNumber.Text = num2.ToString();
             Dictionary <string, SKUItem> dictionary = new Dictionary <string, SKUItem>();
             foreach (SKUItem value2 in productBrowseInfo.Product.Skus.Values)
             {
                 CountDownSkuInfo countDownSkuInfo = (from c in countDownInfo.CountDownSkuInfo
                                                      where c.SkuId == value2.SkuId
                                                      select c).FirstOrDefault();
                 if (countDownSkuInfo != null)
                 {
                     value2.Stock = ((value2.Stock < countDownSkuInfo.ActivityTotal - countDownSkuInfo.BoughtCount) ? value2.Stock : (countDownSkuInfo.ActivityTotal - countDownSkuInfo.BoughtCount));
                 }
                 dictionary.Add(value2.SkuId, value2);
             }
             IEnumerable value = from item in dictionary
                                 select item.Value;
             if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
             {
                 this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
             }
             if (this.hidden_skus != null)
             {
                 this.hidden_skus.Value = JsonConvert.SerializeObject(value);
             }
             this.LoadPageSearch(productBrowseInfo.Product);
             this.hpkProductConsultations.Target      = "_blank";
             this.hpkProductConsultations.Text        = "查看全部";
             this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={countDownInfo.ProductId}";
             this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
             this.LoadCountDownBuyInfo(countDownInfo);
             this.btnOrder.Stock = productBrowseInfo.Product.Stock;
             if (!countDownInfo.IsJoin)
             {
                 this.hidden_IsOver.Value = "nojoin";
             }
             BrowsedProductQueue.EnQueue(countDownInfo.ProductId);
             this.images.ImageInfo = productBrowseInfo.Product;
             if (productBrowseInfo.DbAttribute != null)
             {
                 this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                 this.rptExpandAttributes.DataBind();
             }
             if (productBrowseInfo.DbSKUs != null)
             {
                 this.skuSelector.ProductId  = countDownInfo.ProductId;
                 this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
             }
             if (productBrowseInfo.DBConsultations != null)
             {
                 this.consultations.DataSource = productBrowseInfo.DBConsultations;
                 this.consultations.DataBind();
             }
             if (productBrowseInfo.DbCorrelatives != null)
             {
                 this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
                 this.correlative.DataBind();
             }
         }
         else
         {
             base.GotoResourceNotFound();
         }
     }
 }
Ejemplo n.º 9
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("商品详情");
        }
Ejemplo n.º 10
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(base.GetParameter("PreSaleId", false), out this.preSaleId))
            {
                base.GotoResourceNotFound();
            }
            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.preSaleId);

            if (productPreSaleInfo == null)
            {
                base.GotoResourceNotFound();
            }
            this.productId = productPreSaleInfo.ProductId;
            if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
            {
                this.Page.Response.Redirect("/ProductDetails.aspx?productId=" + this.productId);
                return;
            }
            this.hidSupName              = (HtmlInputHidden)this.FindControl("hidSupName");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.hiddenpid               = (HtmlInputHidden)this.FindControl("hiddenpid");
            this.hidCartQuantity         = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.hiddenpid.Value         = this.productId.ToString();
            this.common_Location         = (Common_Location)this.FindControl("common_Location");
            this.litProductName          = (Literal)this.FindControl("litProductName");
            this.lblStock                = (StockLabel)this.FindControl("lblStock");
            this.litUnit                 = (Literal)this.FindControl("litUnit");
            this.litSaleCounts           = (Literal)this.FindControl("litSaleCounts");
            this.lblBuyPrice             = (Label)this.FindControl("lblBuyPrice");
            this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
            this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.btnBuy                  = (BuyButton)this.FindControl("btnBuy");
            this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
            this.ltlSaleCount            = (Literal)this.FindControl("ltlSaleCount");
            this.ltlReviewCount          = (Literal)this.FindControl("ltlReviewCount");
            this.litReviewCount          = (Literal)this.FindControl("litReviewCount");
            this.ltlConsultation         = (Literal)this.FindControl("ltlConsultation");
            this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
            this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
            this.rptOnlineService        = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService");
            this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
            this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
            this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.hidden_skuItem          = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidIsOpenMultiStore     = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore");
            this.aCountDownUrl           = (HyperLink)this.FindControl("aCountDownUrl");
            this.imgQrCode               = (Image)this.FindControl("imgQrCode");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divGift                 = (HtmlGenericControl)this.FindControl("divGift");
            this.ltlGiftName             = (Literal)this.FindControl("ltlGiftName");
            this.ltlGiftNum              = (Literal)this.FindControl("ltlGiftNum");
            this.aBrand                  = (HtmlAnchor)this.FindControl("aBrand");
            this.imgBrand                = (HiImage)this.FindControl("imgBrand");
            this.imgCustomerService      = (HtmlImage)this.FindControl("imgCustomerService");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.divOrderPromotions      = (HtmlGenericControl)this.FindControl("divOrderPromotions");
            this.divOrderPromotions2     = (HtmlGenericControl)this.FindControl("divOrderPromotions2");
            this.divOrderPromotions4     = (HtmlGenericControl)this.FindControl("divOrderPromotions4");
            this.divOrderPromotions3     = (HtmlGenericControl)this.FindControl("divOrderPromotions3");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litPhonePriceEndDate    = (Literal)this.FindControl("litPhonePriceEndDate");
            this.divCuxiao               = (HtmlGenericControl)this.FindControl("divCuxiao");
            this.ltlUnit                 = (Literal)this.FindControl("ltlUnit");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.ltlPromotionSendGifts   = (Literal)this.FindControl("ltlPromotionSendGifts");
            this.setDeliverRegion        = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion");
            this.divqq = (HtmlGenericControl)this.FindControl("divqq");
            this.lblPaymentStartDate    = (Label)this.FindControl("lblPaymentStartDate");
            this.lblPaymentEndDate      = (Label)this.FindControl("lblPaymentEndDate");
            this.lblDelivery            = (Label)this.FindControl("lblDelivery");
            this.lblDepositPercent      = (Label)this.FindControl("lblDepositPercent");
            this.lblDeposit             = (Label)this.FindControl("lblDeposit");
            this.lblFinalPaymentPercent = (Label)this.FindControl("lblFinalPaymentPercent");
            this.lblFinalPayment        = (Label)this.FindControl("lblFinalPayment");
            this.hidEndDate             = (HtmlInputHidden)this.FindControl("hidEndDate");
            this.hidNowDate             = (HtmlInputHidden)this.FindControl("hidNowDate");
            this.hidDepositPercent      = (HtmlInputHidden)this.FindControl("hidDepositPercent");
            this.hidDeposit             = (HtmlInputHidden)this.FindControl("hidDeposit");
            ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts");

            this.aCountDownUrl.Visible = false;
            if (this.Page.IsPostBack)
            {
                return;
            }
            if (this.imgQrCode != null)
            {
                string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png);
                this.imgQrCode.ImageUrl = text;
            }
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, -1);

            if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("/ProductDelete.aspx");
                return;
            }
            this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId;
            this.setDeliverRegion.Volume             = productBrowseInfo.Product.Weight;
            this.setDeliverRegion.Weight             = productBrowseInfo.Product.Weight;
            this.ActivityBusiness();
            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId);
            }
            IEnumerable value = from item in productBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.Page.Response.Redirect(base.GetRouteUrl("unproductdetails", new
                {
                    ProductId = this.productId
                }));
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
            {
                this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库"));
                return;
            }
            this.hidden_productId.Value = this.productId.ToString();
            this.LoadPageSearch(productBrowseInfo.Product);
            if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage)
            {
                this.lbUserProductRefer.product = productBrowseInfo.Product;
            }
            HyperLink hyperLink = this.hpkProductConsultations;
            int       num       = productBrowseInfo.ConsultationCount;

            hyperLink.Text = "查看全部" + num.ToString() + "条咨询";
            Literal literal = this.ltlConsultation;

            num          = productBrowseInfo.ConsultationCount;
            literal.Text = num.ToString();
            Literal literal2 = this.ltlSaleCount;

            num           = productBrowseInfo.SaleCount;
            literal2.Text = num.ToString();
            Literal literal3 = this.ltlReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal3.Text = num.ToString();
            Literal literal4 = this.litReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal4.Text = num.ToString();
            this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}";
            this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
            HtmlInputHidden htmlInputHidden = this.hidNowDate;
            DateTime        dateTime        = DateTime.Now;

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

            dateTime = productPreSaleInfo.PreSaleEndDate;
            htmlInputHidden2.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            Label label = this.lblPaymentStartDate;

            dateTime   = productPreSaleInfo.PaymentStartDate;
            label.Text = dateTime.ToString("yyyy.MM.dd");
            Label label2 = this.lblPaymentEndDate;

            dateTime    = productPreSaleInfo.PaymentEndDate;
            label2.Text = dateTime.ToString("yyyy.MM.dd");
            Label  label3 = this.lblDelivery;
            object text2;

            if (productPreSaleInfo.DeliveryDays <= 0)
            {
                dateTime = productPreSaleInfo.DeliveryDate.Value;
                text2    = dateTime.ToString("yyyy.MM.dd") + "前发货";
            }
            else
            {
                text2 = "尾款支付后" + productPreSaleInfo.DeliveryDays + "天发货";
            }
            label3.Text = (string)text2;
            decimal d;

            if (productPreSaleInfo.DepositPercent > 0)
            {
                this.lblDepositPercent.Text      = "定金:" + productPreSaleInfo.DepositPercent + "%";
                this.lblFinalPaymentPercent.Text = "尾款:" + (100 - productPreSaleInfo.DepositPercent) + "%";
                decimal num2 = Math.Round(productBrowseInfo.Product.MinSalePrice * (decimal)productPreSaleInfo.DepositPercent / 100m, 2);
                this.lblDeposit.Text      = "¥" + num2;
                this.lblFinalPayment.Text = "¥" + Math.Round(productBrowseInfo.Product.MinSalePrice - num2, 2);
                HtmlInputHidden htmlInputHidden3 = this.hidDepositPercent;
                num = productPreSaleInfo.DepositPercent;
                htmlInputHidden3.Value = num.ToString();
            }
            else
            {
                this.lblDeposit.Text      = "定金:¥" + productPreSaleInfo.Deposit;
                this.lblFinalPayment.Text = "尾款:¥" + Math.Round(productBrowseInfo.Product.MinSalePrice - productPreSaleInfo.Deposit, 2);
                HtmlInputHidden htmlInputHidden4 = this.hidDeposit;
                d = productPreSaleInfo.Deposit;
                htmlInputHidden4.Value = d.ToString();
            }
            this.btnBuy.Stock  = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            this.ltlUnit.Text  = productBrowseInfo.Product.Unit;
            this.divqq.Visible = (this.sitesettings.ServiceIsOpen == "1");
            MemberInfo user = HiContext.Current.User;

            if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productBrowseInfo.Product.SubMemberDeduct.HasValue))
            {
                if (!productBrowseInfo.Product.SubMemberDeduct.HasValue)
                {
                    goto IL_0d79;
                }
                decimal?subMemberDeduct = productBrowseInfo.Product.SubMemberDeduct;
                d = default(decimal);
                if (!(subMemberDeduct.GetValueOrDefault() <= d) || !subMemberDeduct.HasValue)
                {
                    goto IL_0d79;
                }
            }
            goto IL_0d9f;
IL_0da0:
            int num3;

            if (num3 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            BrowsedProductQueue.EnQueue(this.productId);
            this.images.ImageInfo = productBrowseInfo.Product;
            if (productBrowseInfo.DbAttribute != null)
            {
                this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                this.rptExpandAttributes.DataBind();
            }
            if (productBrowseInfo.DbSKUs != null)
            {
                this.skuSelector.ProductId  = this.productId;
                this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
            }
            if (productBrowseInfo.Product.BrandId.HasValue)
            {
                BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo))
                {
                    this.imgBrand.ImageUrl = brandCategory.Logo;
                    this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                    {
                        brandId = brandCategory.BrandId
                    });
                }
            }
            int supplierId = productBrowseInfo.Product.SupplierId;

            if (supplierId > 0)
            {
                SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                if (!string.IsNullOrEmpty(supplierById.Picture))
                {
                    this.imgBrand.ImageUrl = supplierById.Picture;
                }
                else if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory2 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory2 != null && !string.IsNullOrEmpty(brandCategory2.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory2.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory2.BrandId
                        });
                    }
                }
                else
                {
                    this.imgBrand.Visible = false;
                }
                this.litSupplierName.Text = supplierById.SupplierName;
                this.hidSupName.Value     = supplierById.SupplierName;
            }
            else
            {
                this.litSupplierName.Visible = false;
                if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory3 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory3 != null && !string.IsNullOrEmpty(brandCategory3.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory3.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory3.BrandId
                        });
                    }
                }
            }
            if (productBrowseInfo.DBConsultations != null)
            {
                this.consultations.DataSource = productBrowseInfo.DBConsultations;
                this.consultations.DataBind();
            }
            if (productBrowseInfo.DbCorrelatives != null)
            {
                this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
                this.correlative.DataBind();
            }
            this.BindOrderPromotions();
            if (!this.divOrderPromotions.Visible && !this.divOrderPromotions2.Visible && !this.divOrderPromotions3.Visible)
            {
                this.divCuxiao.Style.Add("display", "none");
            }
            if (this.rptOnlineService != null)
            {
                IList <OnlineServiceInfo> allOnlineService  = OnlineServiceHelper.GetAllOnlineService(0, 1);
                IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2);
                if (allOnlineService2 != null)
                {
                    foreach (OnlineServiceInfo item in allOnlineService2)
                    {
                        allOnlineService.Add(item);
                    }
                }
                this.rptOnlineService.DataSource = allOnlineService;
                this.rptOnlineService.DataBind();
            }
            return;

IL_0d9f:
            num3 = 1;
            goto IL_0da0;
IL_0d79:
            if (HiContext.Current.SiteSettings.OpenReferral == 1)
            {
                num3 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0);
                goto IL_0da0;
            }
            goto IL_0d9f;
        }
Ejemplo n.º 11
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(base.GetParameter("productId", false), out this.productId))
            {
                base.GotoResourceNotFound();
            }
            this.hiddenpid               = (HtmlInputHidden)this.FindControl("hiddenpid");
            this.hidCartQuantity         = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.hiddenpid.Value         = this.productId.ToString();
            this.common_Location         = (Common_Location)this.FindControl("common_Location");
            this.litProductName          = (Literal)this.FindControl("litProductName");
            this.lblStock                = (StockLabel)this.FindControl("lblStock");
            this.litUnit                 = (Literal)this.FindControl("litUnit");
            this.litSaleCounts           = (Literal)this.FindControl("litSaleCounts");
            this.lblMarkerPrice          = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice");
            this.lblBuyPrice             = (Label)this.FindControl("lblBuyPrice");
            this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
            this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.btnBuy                  = (BuyButton)this.FindControl("btnBuy");
            this.btnaddgouwu             = (AddCartButton)this.FindControl("btnaddgouwu");
            this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
            this.ltlSaleCount            = (Literal)this.FindControl("ltlSaleCount");
            this.ltlReviewCount          = (Literal)this.FindControl("ltlReviewCount");
            this.litReviewCount          = (Literal)this.FindControl("litReviewCount");
            this.ltlConsultation         = (Literal)this.FindControl("ltlConsultation");
            this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
            this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
            this.rptOnlineService        = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService");
            this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
            this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
            this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.hidden_skuItem          = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidIsOpenMultiStore     = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore");
            this.aCountDownUrl           = (HyperLink)this.FindControl("aCountDownUrl");
            this.imgQrCode               = (Image)this.FindControl("imgQrCode");
            this.phonePriceQrCode        = (Image)this.FindControl("phonePriceQrCode");
            this.liCode                  = (HtmlGenericControl)this.FindControl("liCode");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divGift                 = (HtmlGenericControl)this.FindControl("divGift");
            this.ltlGiftName             = (Literal)this.FindControl("ltlGiftName");
            this.ltlGiftNum              = (Literal)this.FindControl("ltlGiftNum");
            this.aBrand                  = (HtmlAnchor)this.FindControl("aBrand");
            this.imgBrand                = (HiImage)this.FindControl("imgBrand");
            this.imgCustomerService      = (HtmlImage)this.FindControl("imgCustomerService");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.divOrderPromotions      = (HtmlGenericControl)this.FindControl("divOrderPromotions");
            this.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litPhonePriceEndDate    = (Literal)this.FindControl("litPhonePriceEndDate");
            this.divCuxiao               = (HtmlGenericControl)this.FindControl("divCuxiao");
            this.ltlUnit                 = (Literal)this.FindControl("ltlUnit");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.setDeliverRegion        = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion");
            this.hidShowCombinationBuy   = (HtmlInputHidden)this.FindControl("hidShowCombinationBuy");
            this.hidCombinationId        = (HtmlInputHidden)this.FindControl("hidCombinationId");
            this.imgMainPic              = (HtmlImage)this.FindControl("imgMainPic");
            this.divqq = (HtmlGenericControl)this.FindControl("divqq");
            HtmlAnchor htmlAnchor = (HtmlAnchor)this.FindControl("aMainName");

            this.lblMainPrice = (Label)this.FindControl("lblMainPrice");
            ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts");

            this.aCountDownUrl.Visible = false;
            if (this.Page.IsPostBack)
            {
                return;
            }
            if (this.imgQrCode != null)
            {
                string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png);
                this.imgQrCode.ImageUrl = text;
            }
            if (this.phonePriceQrCode != null)
            {
                string text2 = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text2, false, ImageFormats.Png);
                this.phonePriceQrCode.ImageUrl = text2;
            }
            if (this.liCode != null && HiContext.Current.SiteSettings.OpenAliho == 0 && HiContext.Current.SiteSettings.OpenVstore == 0 && HiContext.Current.SiteSettings.OpenWap == 0 && HiContext.Current.SiteSettings.OpenMobbile == 0)
            {
                this.liCode.Visible = false;
            }
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, 0);

            if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("/ProductDelete.aspx");
                return;
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnSale && productBrowseInfo.Product.AuditStatus == ProductAuditStatus.Pass)
            {
                this.Page.Response.Redirect(base.GetRouteUrl("productdetails", new
                {
                    ProductId = this.productId
                }));
            }
            this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId;
            this.setDeliverRegion.Volume             = productBrowseInfo.Product.Weight;
            this.setDeliverRegion.Weight             = productBrowseInfo.Product.Weight;
            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId);
            }
            IEnumerable value = from item in productBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            this.hidden_productId.Value = this.productId.ToString();
            this.LoadPageSearch(productBrowseInfo.Product);
            if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage)
            {
                this.lbUserProductRefer.product = productBrowseInfo.Product;
            }
            HyperLink hyperLink = this.hpkProductConsultations;
            int       num       = productBrowseInfo.ConsultationCount;

            hyperLink.Text = "查看全部" + num.ToString() + "条咨询";
            Literal literal = this.ltlConsultation;

            num          = productBrowseInfo.ConsultationCount;
            literal.Text = num.ToString();
            Literal literal2 = this.ltlSaleCount;

            num           = productBrowseInfo.SaleCount;
            literal2.Text = num.ToString();
            Literal literal3 = this.ltlReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal3.Text = num.ToString();
            Literal literal4 = this.litReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal4.Text = num.ToString();
            this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}";
            this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
            this.btnBuy.Stock   = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            this.btnBuy.Visible = false;
            this.ltlUnit.Text   = productBrowseInfo.Product.Unit;
            this.divqq.Visible  = (this.sitesettings.ServiceIsOpen == "1");
            MemberInfo user = HiContext.Current.User;

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

            goto IL_0af4;
IL_0acd:
            if (HiContext.Current.SiteSettings.OpenReferral == 1)
            {
                num2 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0);
                goto IL_0af4;
            }
            goto IL_0af3;
IL_0af4:
            if (num2 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            this.btnaddgouwu.Stock   = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            this.btnaddgouwu.Visible = false;
            BrowsedProductQueue.EnQueue(this.productId);
            this.images.ImageInfo = productBrowseInfo.Product;
            if (productBrowseInfo.DbAttribute != null)
            {
                this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                this.rptExpandAttributes.DataBind();
            }
            if (productBrowseInfo.DbSKUs != null)
            {
                this.skuSelector.ProductId  = this.productId;
                this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
            }
            if (productBrowseInfo.Product.BrandId.HasValue)
            {
                BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo))
                {
                    this.imgBrand.ImageUrl = brandCategory.Logo;
                    this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                    {
                        brandId = brandCategory.BrandId
                    });
                }
            }
            if (productBrowseInfo.DBConsultations != null)
            {
                this.consultations.DataSource = productBrowseInfo.DBConsultations;
                this.consultations.DataBind();
            }
            if (productBrowseInfo.DbCorrelatives != null)
            {
                this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
                this.correlative.DataBind();
            }
            this.BindOrderPromotions();
            string productPromotionsInfo = this.GetProductPromotionsInfo();

            this.ltlProductSendGifts.Text = productPromotionsInfo;
            if (!this.divOrderPromotions.Visible && productPromotionsInfo == string.Empty)
            {
                this.divCuxiao.Style.Add("display", "none");
            }
            if (this.rptOnlineService != null)
            {
                IList <OnlineServiceInfo> allOnlineService  = OnlineServiceHelper.GetAllOnlineService(0, 1);
                IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2);
                if (allOnlineService2 != null)
                {
                    foreach (OnlineServiceInfo item in allOnlineService2)
                    {
                        allOnlineService.Add(item);
                    }
                }
                this.rptOnlineService.DataSource = allOnlineService;
                this.rptOnlineService.DataBind();
            }
        }
Ejemplo n.º 12
0
        public override ProductBrowseInfo GetProductBrowseInfo(int productId, int?maxReviewNum, int?maxConsultationNum)
        {
            Member user;
            int    memberDiscount = 100;
            int    gradeId        = 0;
            int    num3           = HiContext.Current.SiteSettings.UserId.Value;

            if (HiContext.Current.User.UserRole == UserRole.Underling)
            {
                user           = HiContext.Current.User as Member;
                memberDiscount = MemberProvider.Instance().GetMemberDiscount(user.GradeId);
                gradeId        = user.GradeId;
            }
            ProductBrowseInfo info    = new ProductBrowseInfo();
            StringBuilder     builder = new StringBuilder();

            builder.Append("UPDATE distro_Products SET VistiCounts = VistiCounts + 1 WHERE ProductId = @ProductId AND DistributorUserId = @DistributorUserId;");
            builder.Append(" SELECT dp.*, p.Unit, p.ImageUrl1, p.ImageUrl2, p.ImageUrl3, p.ImageUrl4, p.ImageUrl5, p.LowestSalePrice, p.PenetrationStatus, p.TaobaoProductId");
            builder.Append(",CASE WHEN dp.BrandId IS NULL THEN NULL ELSE (SELECT bc.BrandName FROM Hishop_BrandCategories bc WHERE bc.BrandId=dp.BrandId) END AS BrandName");
            builder.Append(" FROM distro_Products dp JOIN Hishop_Products p ON dp.ProductId = p.ProductId  where dp.ProductId=@ProductId AND dp.DistributorUserId = @DistributorUserId;");
            if (HiContext.Current.User.UserRole == UserRole.Underling)
            {
                user           = HiContext.Current.User as Member;
                memberDiscount = MemberProvider.Instance().GetMemberDiscount(user.GradeId);
                builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock, AlertStock, CostPrice, PurchasePrice,");
                builder.AppendFormat(" CASE WHEN (SELECT COUNT(*) FROM distro_SKUMemberPrice WHERE SkuId = s.SkuId AND GradeId = {0} AND DistributoruserId = {1}) = 1", user.GradeId, num3);
                builder.AppendFormat(" THEN (SELECT MemberSalePrice FROM distro_SKUMemberPrice WHERE SkuId = s.SkuId AND GradeId = {0} AND DistributoruserId = {1})", user.GradeId, num3);
                builder.AppendFormat(" ELSE (SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = s.SkuId AND DistributoruserId = {0})*{1}/100 END AS SalePrice", num3, memberDiscount);
            }
            else
            {
                builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock, AlertStock, CostPrice, PurchasePrice,");
                builder.AppendFormat(" (SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = s.SkuId AND DistributoruserId = {0}) AS SalePrice", num3);
            }
            builder.Append(" FROM Hishop_SKUs s WHERE ProductId = @ProductId");
            if (maxReviewNum.HasValue)
            {
                builder.AppendFormat(" SELECT TOP {0} * FROM distro_ProductReviews where ProductId=@ProductId AND DistributorUserId=@DistributorUserId ORDER BY ReviewId DESC;", maxReviewNum);
            }
            if (maxConsultationNum.HasValue)
            {
                builder.AppendFormat(" SELECT TOP {0} * FROM distro_ProductConsultations where ProductId=@ProductId AND DistributorUserId=@DistributorUserId AND ReplyUserId IS NOT NULL ORDER BY ConsultationId DESC ;", maxConsultationNum);
            }
            builder.Append(" SELECT a.AttributeId, AttributeName, ValueStr FROM Hishop_ProductAttributes pa JOIN Hishop_Attributes a ON pa.AttributeId = a.AttributeId");
            builder.Append(" JOIN Hishop_AttributeValues v ON a.AttributeId = v.AttributeId AND pa.ValueId = v.ValueId  WHERE ProductId = @ProductId ORDER BY a.DisplaySequence DESC, v.DisplaySequence DESC");
            builder.Append(" SELECT SkuId, a.AttributeId, AttributeName, UseAttributeImage, av.ValueId, ValueStr, ImageUrl FROM Hishop_SKUItems s join Hishop_Attributes a on s.AttributeId = a.AttributeId join Hishop_AttributeValues av on s.ValueId = av.ValueId WHERE SkuId IN (SELECT SkuId FROM Hishop_SKUs WHERE ProductId = @ProductId) ORDER BY a.DisplaySequence DESC,av.DisplaySequence DESC;");
            builder.AppendFormat(" SELECT TOP 20 ProductId,ProductName,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,MarketPrice,SalePrice FROM vw_distro_BrowseProductList WHERE SaleStatus = {0}", 1);
            builder.AppendFormat(" AND DistributorUserId = {0}  AND ProductId IN (SELECT RelatedProductId FROM distro_RelatedProducts WHERE ProductId = {1} AND DistributorUserId = {0})", num3, productId);
            builder.AppendFormat(" UNION SELECT TOP 20 ProductId,ProductName,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,MarketPrice,SalePrice FROM vw_distro_BrowseProductList WHERE SaleStatus = {0}", 1);
            builder.AppendFormat(" AND DistributorUserId = {0} AND ProductId<>{1} AND CategoryId = (SELECT CategoryId FROM distro_Products WHERE ProductId={1} AND SaleStatus = {2} AND DistributorUserId = {0})", num3, productId, 1);
            builder.AppendFormat(" AND ProductId NOT IN (SELECT RelatedProductId FROM distro_RelatedProducts WHERE ProductId = {0} AND DistributorUserId = {1})", productId, num3);
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, productId);
            this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, num3);
            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (reader.Read())
                {
                    info.Product = DataMapper.PopulateProduct(reader);
                    if (reader["BrandName"] != DBNull.Value)
                    {
                        info.BrandName = (string)reader["BrandName"];
                    }
                }
                if (reader.NextResult() && (info.Product != null))
                {
                    while (reader.Read())
                    {
                        info.Product.Skus.Add((string)reader["SkuId"], DataMapper.PopulateSKU(reader));
                    }
                }
                if (maxReviewNum.HasValue && reader.NextResult())
                {
                    info.DBReviews = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (maxConsultationNum.HasValue && reader.NextResult())
                {
                    info.DBConsultations = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (reader.NextResult() && (info.Product != null))
                {
                    DataTable table = DataHelper.ConverDataReaderToDataTable(reader);
                    if ((table != null) && (table.Rows.Count > 0))
                    {
                        DataTable table2 = table.Clone();
                        foreach (DataRow row in table.Rows)
                        {
                            bool flag = false;
                            if (table2.Rows.Count > 0)
                            {
                                foreach (DataRow row2 in table2.Rows)
                                {
                                    if (((int)row2["AttributeId"]) == ((int)row["AttributeId"]))
                                    {
                                        DataRow row4;
                                        flag = true;
                                        (row4 = row2)["ValueStr"] = row4["ValueStr"] + ", " + row["ValueStr"];
                                    }
                                }
                            }
                            if (!flag)
                            {
                                DataRow row3 = table2.NewRow();
                                row3["AttributeId"]   = row["AttributeId"];
                                row3["AttributeName"] = row["AttributeName"];
                                row3["ValueStr"]      = row["ValueStr"];
                                table2.Rows.Add(row3);
                            }
                        }
                        info.DbAttribute = table2;
                    }
                }
                if (reader.NextResult())
                {
                    info.DbSKUs = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (reader.NextResult())
                {
                    info.DbCorrelatives = DataHelper.ConverDataReaderToDataTable(reader);
                }
            }
            return(info);
        }
Ejemplo n.º 13
0
        public override ProductBrowseInfo GetProductBrowseInfo(int productId, int?maxReviewNum, int?maxConsultationNum)
        {
            ProductBrowseInfo productBrowseInfo = new ProductBrowseInfo();
            StringBuilder     stringBuilder     = new StringBuilder();

            stringBuilder.Append("UPDATE Hishop_Products SET VistiCounts = VistiCounts + 1 WHERE ProductId = @ProductId;");
            stringBuilder.Append(" SELECT * ,CASE WHEN BrandId IS NULL THEN NULL ELSE (SELECT BrandName FROM Hishop_BrandCategories WHERE BrandId= p.BrandId) END AS BrandName");
            stringBuilder.Append(" FROM Hishop_Products p where ProductId=@ProductId;");
            if (HiContext.Current.User.UserRole == UserRole.Member)
            {
                Hidistro.Membership.Context.Member member = HiContext.Current.User as Hidistro.Membership.Context.Member;
                int memberDiscount = MemberProvider.Instance().GetMemberDiscount(member.GradeId);
                stringBuilder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock, AlertStock, CostPrice, PurchasePrice,");
                stringBuilder.AppendFormat(" (CASE WHEN (SELECT COUNT(*) FROM Hishop_SKUMemberPrice WHERE SkuId = s.SkuId AND GradeId = {0}) = 1", member.GradeId);
                stringBuilder.AppendFormat(" THEN (SELECT MemberSalePrice FROM Hishop_SKUMemberPrice WHERE SkuId = s.SkuId AND GradeId = {0}) ELSE SalePrice*{1}/100 END) AS SalePrice", member.GradeId, memberDiscount);
                stringBuilder.Append(" FROM Hishop_SKUs s WHERE ProductId = @ProductId");
            }
            else
            {
                stringBuilder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock, AlertStock, CostPrice, PurchasePrice, SalePrice FROM Hishop_SKUs WHERE ProductId = @ProductId");
            }
            if (maxReviewNum.HasValue)
            {
                stringBuilder.AppendFormat(" SELECT TOP {0} * FROM Hishop_ProductReviews where ProductId=@ProductId ORDER BY ReviewId DESC ; ", maxReviewNum);
            }
            if (maxConsultationNum.HasValue)
            {
                stringBuilder.AppendFormat(" SELECT TOP {0} * FROM Hishop_ProductConsultations where ProductId=@ProductId AND ReplyUserId IS NOT NULL ORDER BY ConsultationId DESC ;", maxConsultationNum);
            }
            stringBuilder.Append(" SELECT a.AttributeId, AttributeName, ValueStr FROM Hishop_ProductAttributes pa JOIN Hishop_Attributes a ON pa.AttributeId = a.AttributeId");
            stringBuilder.Append(" JOIN Hishop_AttributeValues v ON a.AttributeId = v.AttributeId AND pa.ValueId = v.ValueId  WHERE ProductId = @ProductId ORDER BY a.DisplaySequence DESC, v.DisplaySequence DESC");
            stringBuilder.Append(" SELECT SkuId, a.AttributeId, AttributeName, UseAttributeImage, av.ValueId, ValueStr, ImageUrl FROM Hishop_SKUItems s join Hishop_Attributes a on s.AttributeId = a.AttributeId join Hishop_AttributeValues av on s.ValueId = av.ValueId WHERE SkuId IN (SELECT SkuId FROM Hishop_SKUs WHERE ProductId = @ProductId) ORDER BY a.DisplaySequence DESC,av.DisplaySequence DESC;");
            stringBuilder.Append(" SELECT TOP 20 ProductId,ProductName,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,MarketPrice,SalePrice FROM vw_Hishop_BrowseProductList");
            stringBuilder.AppendFormat(" WHERE SaleStatus = {0} AND ProductId IN (SELECT RelatedProductId FROM Hishop_RelatedProducts WHERE ProductId = {1})", 1, productId);
            stringBuilder.Append(" UNION SELECT TOP 20 ProductId,ProductName,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,MarketPrice,SalePrice FROM vw_Hishop_BrowseProductList");
            stringBuilder.AppendFormat(" WHERE SaleStatus = {0} AND ProductId<>{1}  AND CategoryId = (SELECT CategoryId FROM Hishop_Products WHERE ProductId={1} AND SaleStatus = {0})", 1, productId);
            stringBuilder.AppendFormat(" AND ProductId NOT IN (SELECT RelatedProductId FROM Hishop_RelatedProducts WHERE ProductId = {0})", productId);
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());
            this.database.AddInParameter(sqlStringCommand, "ProductId", System.Data.DbType.Int32, productId);
            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    productBrowseInfo.Product = DataMapper.PopulateProduct(dataReader);
                    if (dataReader["BrandName"] != DBNull.Value)
                    {
                        productBrowseInfo.BrandName = (string)dataReader["BrandName"];
                    }
                }
                if (dataReader.NextResult())
                {
                    while (dataReader.Read())
                    {
                        productBrowseInfo.Product.Skus.Add((string)dataReader["SkuId"], DataMapper.PopulateSKU(dataReader));
                    }
                }
                if (maxReviewNum.HasValue && dataReader.NextResult())
                {
                    productBrowseInfo.DBReviews = DataHelper.ConverDataReaderToDataTable(dataReader);
                }
                if (maxConsultationNum.HasValue && dataReader.NextResult())
                {
                    productBrowseInfo.DBConsultations = DataHelper.ConverDataReaderToDataTable(dataReader);
                }
                if (dataReader.NextResult())
                {
                    System.Data.DataTable dataTable = DataHelper.ConverDataReaderToDataTable(dataReader);
                    if (dataTable != null && dataTable.Rows.Count > 0)
                    {
                        System.Data.DataTable dataTable2 = dataTable.Clone();
                        foreach (System.Data.DataRow dataRow in dataTable.Rows)
                        {
                            bool flag = false;
                            if (dataTable2.Rows.Count > 0)
                            {
                                foreach (System.Data.DataRow dataRow2 in dataTable2.Rows)
                                {
                                    if ((int)dataRow2["AttributeId"] == (int)dataRow["AttributeId"])
                                    {
                                        flag = true;
                                        System.Data.DataRow dataRow3;
                                        (dataRow3 = dataRow2)["ValueStr"] = dataRow3["ValueStr"] + ", " + dataRow["ValueStr"];
                                    }
                                }
                            }
                            if (!flag)
                            {
                                System.Data.DataRow dataRow4 = dataTable2.NewRow();
                                dataRow4["AttributeId"]   = dataRow["AttributeId"];
                                dataRow4["AttributeName"] = dataRow["AttributeName"];
                                dataRow4["ValueStr"]      = dataRow["ValueStr"];
                                dataTable2.Rows.Add(dataRow4);
                            }
                        }
                        productBrowseInfo.DbAttribute = dataTable2;
                    }
                }
                if (dataReader.NextResult())
                {
                    productBrowseInfo.DbSKUs = DataHelper.ConverDataReaderToDataTable(dataReader);
                }
                if (dataReader.NextResult())
                {
                    productBrowseInfo.DbCorrelatives = DataHelper.ConverDataReaderToDataTable(dataReader);
                }
            }
            return(productBrowseInfo);
        }
Ejemplo n.º 14
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages    = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litProdcutName      = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litSalePrice        = (System.Web.UI.WebControls.Literal) this.FindControl("litSalePrice");
            this.litMarketPrice      = (System.Web.UI.WebControls.Literal) this.FindControl("litMarketPrice");
            this.litShortDescription = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.litDescription      = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
            this.litTaxRate          = (System.Web.UI.WebControls.Literal) this.FindControl("litTaxRate");
            this.litShipping         = (System.Web.UI.WebControls.Literal) this.FindControl("litShipping");
            this.litStock            = (System.Web.UI.WebControls.Literal) this.FindControl("litStock");
            this.litBuyCardinality   = (System.Web.UI.WebControls.Literal) this.FindControl("litBuyCardinality");
            this.litSupplier         = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplier");
            this.lblsmalltitle       = (System.Web.UI.WebControls.Literal) this.FindControl("lblsmalltitle");
            this.litDiscrunt         = (System.Web.UI.WebControls.Literal) this.FindControl("litDiscrunt");
            this.litpropricemsg      = (System.Web.UI.WebControls.Literal) this.FindControl("litpropricemsg");
            this.litProPromration    = (System.Web.UI.WebControls.Literal) this.FindControl("litProPromration");
            this.litOrderPromration  = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderPromration");
            this.litFreeShip         = (System.Web.UI.WebControls.Literal) this.FindControl("litFreeShip");

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

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

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

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


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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

                DataTable dtproductpromotion = ProductBrowser.GetAllProductPromotionList(productId);

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


            //this.litProPromration = (System.Web.UI.WebControls.Literal)this.FindControl("litProPromration");
            //this.litOrderPromration = (System.Web.UI.WebControls.Literal)this.FindControl("litOrderPromration");
            //包邮
            if (orderpromotionlist != null)
            {
                for (int i = 0; i < orderpromotionlist.Count; i++)
                {
                    if (orderpromotionlist[i].PromoteType == 17)
                    {
                        this.litFreeShip.Text = "<div><span style=\"color:#999\">" + orderpromotionlist[i].Name + "</span></div>";
                    }
                    else
                    {
                        this.litOrderPromration.Text = "<span>" + orderpromotionlist[i].Name + "</span>";
                    }
                }
            }
            if (productpromotionlist != null)
            {
                for (int i = 0; i < productpromotionlist.Count; i++)
                {
                    this.litProPromration.Text = "<span>" + productpromotionlist[i].Name + "</span>";
                    break;
                }
            }
        }
Ejemplo n.º 15
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(Page.Request.QueryString["productId"], out productId))
     {
         base.GotoResourceNotFound();
     }
     common_Location         = (Common_Location)FindControl("common_Location");
     litProductName          = (Literal)FindControl("litProductName");
     lblProductCode          = (Literal)FindControl("lblProductCode");
     lblSku                  = (SkuLabel)FindControl("lblSku");
     lblStock                = (StockLabel)FindControl("lblStock");
     litUnit                 = (Literal)FindControl("litUnit");
     litWeight               = (WeightLabel)FindControl("litWeight");
     litBrosedNum            = (Literal)FindControl("litBrosedNum");
     litBrand                = (Literal)FindControl("litBrand");
     litSaleCounts           = (Literal)FindControl("litSaleCounts");
     lblMarkerPrice          = (FormatedMoneyLabel)FindControl("lblMarkerPrice");
     lblBuyPrice             = (Label)FindControl("lblBuyPrice");
     lblTotalPrice           = (TotalLabel)FindControl("lblTotalPrice");
     litDescription          = (Literal)FindControl("litDescription");
     litShortDescription     = (Literal)FindControl("litShortDescription");
     btnBuy                  = (BuyButton)FindControl("btnBuy");
     btnaddgouwu             = (AddCartButton)FindControl("btnaddgouwu");
     hpkProductConsultations = (HyperLink)FindControl("hpkProductConsultations");
     hpkProductReviews       = (HyperLink)FindControl("hpkProductReviews");
     images                  = (Common_ProductImages)FindControl("common_ProductImages");
     rptExpandAttributes     = (ThemedTemplatedRepeater)FindControl("rptExpandAttributes");
     skuSelector             = (SKUSelector)FindControl("SKUSelector");
     reviews                 = (Common_ProductReview)FindControl("list_Common_ProductReview");
     consultations           = (Common_ProductConsultations)FindControl("list_Common_ProductConsultations");
     correlative             = (Common_GoodsList_Correlative)FindControl("list_Common_GoodsList_Correlative");
     if (!Page.IsPostBack)
     {
         ProductBrowseInfo info = ProductBrowser.GetProductBrowseInfo(productId, new int?(reviews.MaxNum), new int?(consultations.MaxNum));
         if ((info.Product == null) || (info.Product.SaleStatus == ProductSaleStatus.Delete))
         {
             Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品已经被管理员删除"));
         }
         else
         {
             if (info.Product.SaleStatus == ProductSaleStatus.UnSale)
             {
                 Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("unproductdetails", new object[] { Page.Request.QueryString["productId"] }));
             }
             LoadPageSearch(info.Product);
             hpkProductReviews.Text              = "查看全部" + ProductBrowser.GetProductReviewNumber(productId).ToString() + "条评论";
             hpkProductConsultations.Text        = "查看全部" + ProductBrowser.GetProductConsultationNumber(productId).ToString() + "条咨询";
             hpkProductConsultations.NavigateUrl = string.Format("ProductConsultationsAndReplay.aspx?productId={0}", productId);
             hpkProductReviews.NavigateUrl       = string.Format("LookProductReviews.aspx?productId={0}", productId);
             LoadProductInfo(info.Product, info.BrandName);
             btnBuy.Stock      = info.Product.Stock;
             btnaddgouwu.Stock = info.Product.Stock;
             BrowsedProductQueue.EnQueue(productId);
             images.ImageInfo = info.Product;
             if (info.DbAttribute != null)
             {
                 rptExpandAttributes.DataSource = info.DbAttribute;
                 rptExpandAttributes.DataBind();
             }
             if (info.DbSKUs != null)
             {
                 skuSelector.ProductId  = productId;
                 skuSelector.DataSource = info.DbSKUs;
             }
             if (info.DBReviews != null)
             {
                 reviews.DataSource = info.DBReviews;
                 reviews.DataBind();
             }
             if (info.DBConsultations != null)
             {
                 consultations.DataSource = info.DBConsultations;
                 consultations.DataBind();
             }
             if (info.DbCorrelatives != null)
             {
                 correlative.DataSource = info.DbCorrelatives;
                 correlative.DataBind();
             }
         }
     }
 }
 protected override void AttachChildControls()
 {
     if (!int.TryParse(base.GetParameter("groupBuyId", false), out this.groupBuyId))
     {
         base.GotoResourceNotFound();
     }
     this.ltlConsultation     = (Literal)this.FindControl("ltlConsultation");
     this.ltlSaleCount        = (Literal)this.FindControl("ltlSaleCount");
     this.common_Location     = (Common_Location)this.FindControl("common_Location");
     this.litProductName      = (Literal)this.FindControl("litProductName");
     this.lblSku              = (SkuLabel)this.FindControl("lblSku");
     this.lblStock            = (StockLabel)this.FindControl("lblStock");
     this.litUnit             = (Literal)this.FindControl("litUnit");
     this.litWeight           = (Label)this.FindControl("litWeight");
     this.litBrosedNum        = (Literal)this.FindControl("litBrosedNum");
     this.litBrand            = (Literal)this.FindControl("litBrand");
     this.litContent          = (Literal)this.FindControl("litContent");
     this.lblSalePrice        = (FormatedMoneyLabel)this.FindControl("lblSalePrice");
     this.lblTotalPrice       = (TotalLabel)this.FindControl("lblTotalPrice");
     this.litDescription      = (Literal)this.FindControl("litDescription");
     this.litShortDescription = (Literal)this.FindControl("litShortDescription");
     this.btnOrder            = (BuyButton)this.FindControl("btnOrder");
     this.ltlReviewCount      = (Literal)this.FindControl("ltlReviewCount");
     this.txtMaxCount         = (HtmlInputHidden)this.FindControl("txtMaxCount");
     this.txtSoldCount        = (HtmlInputHidden)this.FindControl("txtSoldCount");
     this.hidden_IsOver       = (HtmlInputHidden)this.FindControl("hidden_IsOver");
     this.hidden_GroupBuyId   = (HtmlInputHidden)this.FindControl("hidden_GroupBuyId");
     this.hidden_productId    = (HtmlInputHidden)this.FindControl("hidden_productId");
     this.lblCurrentSalePrice = (FormatedMoneyLabel)this.FindControl("lblCurrentSalePrice");
     this.litCount            = (Label)this.FindControl("litCount");
     this.lblNeedPrice        = (FormatedMoneyLabel)this.FindControl("lblNeedPrice");
     this.lblEndTime          = (FormatedTimeLabel)this.FindControl("lblEndTime");
     this.lblStartTime        = (FormatedTimeLabel)this.FindControl("lblStartTime");
     this.litRemainTime       = (Literal)this.FindControl("litRemainTime");
     this.litNeedCount        = (Literal)this.FindControl("litNeedCount");
     this.litMaxCount         = (Label)this.FindControl("litMaxCount");
     this.images              = (Common_ProductImages)this.FindControl("common_ProductImages");
     this.rptExpandAttributes = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
     this.skuSelector         = (SKUSelector)this.FindControl("SKUSelector");
     this.consultations       = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
     this.correlative         = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
     this.nowTime             = (HtmlInputHidden)this.FindControl("nowTime");
     this.nowTime.SetWhenIsNotNull(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo));
     this.hidden_skus    = (HtmlInputHidden)this.FindControl("hidden_skus");
     this.hidden_skuItem = (HtmlInputHidden)this.FindControl("hidden_skuItem");
     if (!this.Page.IsPostBack)
     {
         SiteSettings masterSettings = SettingsManager.GetMasterSettings();
         GroupBuyInfo groupBuy       = PromoteHelper.GetGroupBuy(this.groupBuyId);
         if (groupBuy == null)
         {
             base.GotoResourceNotFound();
         }
         HtmlInputHidden htmlInputHidden = this.hidden_GroupBuyId;
         int             num             = groupBuy.GroupBuyId;
         htmlInputHidden.Value = num.ToString();
         ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(groupBuy.ProductId, null, masterSettings.OpenMultStore, 0);
         Literal           literal           = this.ltlSaleCount;
         num          = productBrowseInfo.SaleCount;
         literal.Text = num.ToString();
         if (productBrowseInfo.Product == null)
         {
             this.hidden_IsOver.Value = "pullOff";
         }
         else if (!productBrowseInfo.Product.SaleStatus.Equals(ProductSaleStatus.OnSale))
         {
             this.hidden_IsOver.Value = "pullOff";
         }
         if (productBrowseInfo.Product == null || groupBuy == null)
         {
             this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品参与的团购活动已经结束;或已被管理员删除"));
         }
         else
         {
             if (groupBuy != null)
             {
                 if (groupBuy.Status != GroupBuyStatus.UnderWay)
                 {
                     this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该团购活动已经结束"));
                     return;
                 }
                 HtmlInputHidden htmlInputHidden2 = this.hidden_productId;
                 num = groupBuy.ProductId;
                 htmlInputHidden2.Value = num.ToString();
                 if (groupBuy.StartDate > DateTime.Now)
                 {
                     this.hidden_IsOver.Value = "AboutToBegin";
                 }
                 else if (groupBuy.EndDate < DateTime.Now)
                 {
                     this.hidden_IsOver.Value = "over";
                 }
             }
             Literal literal2 = this.ltlConsultation;
             num           = productBrowseInfo.ConsultationCount;
             literal2.Text = num.ToString();
             Literal literal3 = this.ltlReviewCount;
             num           = productBrowseInfo.ReviewCount;
             literal3.Text = num.ToString();
             IEnumerable value = from item in productBrowseInfo.Product.Skus
                                 select item.Value;
             if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
             {
                 this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
             }
             if (this.hidden_skus != null)
             {
                 this.hidden_skus.Value = JsonConvert.SerializeObject(value);
             }
             this.LoadPageSearch(productBrowseInfo.Product);
             this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
             this.LoadProductGroupBuyInfo(groupBuy);
             this.btnOrder.Stock = productBrowseInfo.Product.Stock;
             BrowsedProductQueue.EnQueue(groupBuy.ProductId);
             this.images.ImageInfo = productBrowseInfo.Product;
             this.litContent.Text  = groupBuy.Content;
             if (productBrowseInfo.DbAttribute != null)
             {
                 this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                 this.rptExpandAttributes.DataBind();
             }
             if (productBrowseInfo.DbSKUs != null)
             {
                 this.skuSelector.ProductId  = groupBuy.ProductId;
                 this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
             }
             if (productBrowseInfo.DBConsultations != null)
             {
                 this.consultations.DataSource = productBrowseInfo.DBConsultations;
                 this.consultations.DataBind();
             }
             if (productBrowseInfo.DbCorrelatives != null)
             {
                 this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
                 this.correlative.DataBind();
             }
         }
     }
 }
Ejemplo n.º 17
0
        public ProductBrowseInfo GetProductBrowseInfo(int productId, int?maxReviewNum, int?maxConsultationNum, int storeStockValidateType, bool MutiStores = false)
        {
            int discount              = 100;
            ProductBrowseInfo info    = new ProductBrowseInfo();
            StringBuilder     builder = new StringBuilder();

            builder.Append("UPDATE Hishop_Products SET VistiCounts = VistiCounts + 1 WHERE ProductId = @ProductId;");
            builder.Append(" SELECT * ,CASE WHEN BrandId IS NULL THEN NULL ELSE (SELECT BrandName FROM Hishop_BrandCategories WHERE BrandId= p.BrandId) END AS BrandName");
            builder.Append(" FROM Hishop_Products p where ProductId=@ProductId;");
            //if (HiContext.Current.User.UserRole == UserRole.Member)
            //{
            //    Member user = HiContext.Current.User as Member;
            //    discount = new MemberGradeDao().GetMemberGrade(user.GradeId).Discount;
            //    if (!MutiStores)
            //    {
            //        builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock,WarningStock, CostPrice,StoreStock=Stock,");
            //    }
            //    else if (storeStockValidateType == 1)
            //    {
            //        builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock,WarningStock, CostPrice,StoreStock=(SELECT ISNULL(MAX(Stock),s.Stock) FROM Hishop_StoreStock WHERE SkuId = s.SkuID),");
            //    }
            //    else if (storeStockValidateType == 2)
            //    {
            //        builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock,WarningStock, CostPrice,StoreStock=(SELECT ISNULL(SUM(Stock),s.Stock) FROM Hishop_StoreStock WHERE SkuId = s.SkuID),");
            //    }
            //    builder.AppendFormat(" (CASE WHEN (SELECT COUNT(*) FROM Hishop_SKUMemberPrice WHERE SkuId = s.SkuId AND GradeId = {0}) = 1", user.GradeId);
            //    builder.AppendFormat(" THEN (SELECT MemberSalePrice FROM Hishop_SKUMemberPrice WHERE SkuId = s.SkuId AND GradeId = {0}) ELSE SalePrice*{1}/100 END) AS SalePrice", user.GradeId, discount);
            //    builder.Append(" FROM Hishop_SKUs s WHERE ProductId = @ProductId");
            //}
            if (!MutiStores)
            {
                builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock, CostPrice,StoreStock=Stock, SalePrice FROM Hishop_SKUs WHERE ProductId = @ProductId");
            }
            else if (storeStockValidateType == 1)
            {
                builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock, CostPrice,StoreStock=(SELECT ISNULL(MAX(stock),Hishop_Skus.Stock) FROM Hishop_StoreStock ss WHERE SkuId = SkuID), SalePrice FROM Hishop_SKUs WHERE ProductId = @ProductId");
            }
            else if (storeStockValidateType == 2)
            {
                builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock, CostPrice,StoreStock=(SELECT ISNULL(SUM(stock),Hishop_Skus.Stock) FROM Hishop_StoreStock ss WHERE SkuId = SkuID), SalePrice FROM Hishop_SKUs WHERE ProductId = @ProductId");
            }
            if (maxReviewNum.HasValue)
            {
                builder.AppendFormat(" SELECT TOP {0} * FROM Hishop_ProductReviews where ProductId=@ProductId ORDER BY ReviewId DESC; ", maxReviewNum);
                builder.Append(" SELECT Count(*) FROM Hishop_ProductReviews where ProductId=@ProductId; ");
            }
            else
            {
                builder.Append(" SELECT * FROM Hishop_ProductReviews where ProductId=@ProductId ORDER BY ReviewId DESC; ");
                builder.Append(" SELECT Count(*) FROM Hishop_ProductReviews where ProductId=@ProductId; ");
            }
            if (maxConsultationNum.HasValue)
            {
                builder.AppendFormat(" SELECT TOP {0} * FROM Hishop_ProductConsultations where ProductId=@ProductId AND ReplyUserId IS NOT NULL ORDER BY ConsultationId DESC ;", maxConsultationNum);
                builder.Append(" SELECT Count(*) FROM Hishop_ProductConsultations where ProductId=@ProductId AND ReplyUserId IS NOT NULL ; ");
            }
            else
            {
                builder.Append(" SELECT * FROM Hishop_ProductConsultations where ProductId=@ProductId AND ReplyUserId IS NOT NULL ORDER BY ConsultationId DESC ;");
                builder.Append(" SELECT Count(*) FROM Hishop_ProductConsultations where ProductId=@ProductId AND ReplyUserId IS NOT NULL ; ");
            }
            builder.Append(" SELECT a.AttributeId, AttributeName, ValueStr FROM Hishop_ProductAttributes pa JOIN Hishop_Attributes a ON pa.AttributeId = a.AttributeId");
            builder.Append(" JOIN Hishop_AttributeValues v ON a.AttributeId = v.AttributeId AND pa.ValueId = v.ValueId  WHERE ProductId = @ProductId ORDER BY a.DisplaySequence DESC, v.DisplaySequence DESC");
            builder.Append(" SELECT SkuId, a.AttributeId, AttributeName, UseAttributeImage, av.ValueId, ValueStr, ImageUrl FROM Hishop_SKUItems s join Hishop_Attributes a on s.AttributeId = a.AttributeId join Hishop_AttributeValues av on s.ValueId = av.ValueId WHERE SkuId IN (SELECT SkuId FROM Hishop_SKUs WHERE ProductId = @ProductId) ORDER BY a.DisplaySequence DESC,av.DisplaySequence DESC;");
            builder.Append(" SELECT TOP 20 ProductId,ProductName,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,MarketPrice,SalePrice FROM vw_Hishop_BrowseProductList");
            builder.AppendFormat(" WHERE SaleStatus = {0} AND ProductId IN (SELECT RelatedProductId FROM Hishop_RelatedProducts WHERE ProductId = {1}) ORDER BY DisplaySequence DESC;", 1, productId);
            builder.Append("SELECT TOP 20 ProductId,ProductName,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,MarketPrice,SalePrice FROM vw_Hishop_BrowseProductList");
            builder.AppendFormat(" WHERE SaleStatus = {0} AND ProductId<>{1}  AND CategoryId = (SELECT CategoryId FROM Hishop_Products WHERE ProductId={1} AND SaleStatus = {0})", 1, productId);
            builder.AppendFormat(" AND ProductId NOT IN (SELECT RelatedProductId FROM Hishop_RelatedProducts WHERE ProductId = {0})", productId);
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, productId);
            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (reader.Read())
                {
                    info.Product = DataMapper.PopulateProduct(reader);
                    if (reader["BrandName"] != DBNull.Value)
                    {
                        info.BrandName = (string)reader["BrandName"];
                    }
                }
                if (reader.NextResult())
                {
                    while (reader.Read())
                    {
                        info.Product.Skus.Add((string)reader["SkuId"], DataMapper.PopulateSKU(reader));
                    }
                }
                if (reader.NextResult())
                {
                    info.DBReviews = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (reader.NextResult() && reader.Read())
                {
                    info.ReviewCount = (int)reader[0];
                }
                if (reader.NextResult())
                {
                    info.DBConsultations = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (reader.NextResult() && reader.Read())
                {
                    info.ConsultationCount = (int)reader[0];
                }
                if (reader.NextResult())
                {
                    DataTable table = DataHelper.ConverDataReaderToDataTable(reader);
                    if ((table != null) && (table.Rows.Count > 0))
                    {
                        DataTable table2 = table.Clone();
                        foreach (DataRow row in table.Rows)
                        {
                            bool flag = false;
                            if (table2.Rows.Count > 0)
                            {
                                foreach (DataRow row2 in table2.Rows)
                                {
                                    if (((int)row2["AttributeId"]) == ((int)row["AttributeId"]))
                                    {
                                        DataRow row4;
                                        flag = true;
                                        (row4 = row2)["ValueStr"] = row4["ValueStr"] + ", " + row["ValueStr"];
                                    }
                                }
                            }
                            if (!flag)
                            {
                                DataRow row3 = table2.NewRow();
                                row3["AttributeId"]   = row["AttributeId"];
                                row3["AttributeName"] = row["AttributeName"];
                                row3["ValueStr"]      = row["ValueStr"];
                                table2.Rows.Add(row3);
                            }
                        }
                        info.DbAttribute = table2;
                    }
                }
                if (reader.NextResult())
                {
                    info.DbSKUs   = DataHelper.ConverDataReaderToDataTable(reader);
                    info.ListSKUs = ReaderConvert.ReaderToList <SKUItem>(reader);
                }
                if (reader.NextResult())
                {
                    info.DbCorrelatives   = DataHelper.ConverDataReaderToDataTable(reader);
                    info.ListCorrelatives = ReaderConvert.ReaderToList <ProductInfo>(reader);
                }
                if (!reader.NextResult())
                {
                    return(info);
                }
                info.DbCorrelatives.Merge(DataHelper.ConverDataReaderToDataTable(reader), true);
                System.Collections.Generic.IList <ProductInfo> list = ReaderConvert.ReaderToList <ProductInfo>(reader);
                if (list == null)
                {
                    return(info);
                }
                foreach (ProductInfo info2 in list)
                {
                    info.ListCorrelatives.Add(info2);
                }
            }
            return(info);
        }
        protected override void AttachChildControls()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

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

            if (productPreSaleInfo == null)
            {
                this.ShowWapMessage("错误的活动ID", "Default.aspx");
                return;
            }
            if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
            {
                this.Page.Response.Redirect("ProductDetails.aspx?ProductId = " + productPreSaleInfo.ProductId);
                return;
            }
            this.productId               = productPreSaleInfo.ProductId;
            this.hidSupplier             = (HtmlInputHidden)this.FindControl("hidSupplier");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.rptCouponList           = (WapTemplatedRepeater)this.FindControl("rptCouponList");
            this.rp_guest                = (WapTemplatedRepeater)this.FindControl("rp_guest");
            this.rp_com                  = (WapTemplatedRepeater)this.FindControl("rp_com");
            this.litProdcutName          = (Literal)this.FindControl("litProdcutName");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.ltlcombinamaininfo      = (Literal)this.FindControl("ltlcombinamaininfo");
            this.skuSubmitOrder          = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.expandAttr              = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount            = (Literal)this.FindControl("litSoldCount");
            this.litConsultationsCount   = (Literal)this.FindControl("litConsultationsCount");
            this.litReviewsCount         = (Literal)this.FindControl("litReviewsCount");
            this.litHasCollected         = (HtmlInputHidden)this.FindControl("litHasCollected");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.ltlOrderPromotion2      = (Literal)this.FindControl("ltlOrderPromotion2");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.ltlProductSendGifts2    = (Literal)this.FindControl("ltlProductSendGifts2");
            this.liOrderPromotions       = (HtmlGenericControl)this.FindControl("liOrderPromotions");
            this.liOrderPromotions2      = (HtmlGenericControl)this.FindControl("liOrderPromotions2");
            this.liProductSendGifts      = (HtmlGenericControl)this.FindControl("liProductSendGifts");
            this.liProductSendGifts2     = (HtmlGenericControl)this.FindControl("liProductSendGifts2");
            this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2");
            this.liOrderPromotions_free  = (HtmlGenericControl)this.FindControl("liOrderPromotions_free");
            this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.divshiptoregion         = (HtmlGenericControl)this.FindControl("divshiptoregion");
            this.divwaplocateaddress     = (HtmlGenericControl)this.FindControl("divwaplocateaddress");
            this.productFreight          = (ProductFreightLiteral)this.FindControl("productFreight");
            this.promote                 = (ProductPromote)this.FindControl("ProductPromote");
            this.hdAppId                 = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTitle                 = (HtmlInputHidden)this.FindControl("hdTitle");
            this.hdDesc                  = (HtmlInputHidden)this.FindControl("hdDesc");
            this.hdImgUrl                = (HtmlInputHidden)this.FindControl("hdImgUrl");
            this.hdLink                  = (HtmlInputHidden)this.FindControl("hdLink");
            this.hidCombinaid            = (HtmlInputHidden)this.FindControl("hidCombinaid");
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.ulConsultations         = (HtmlGenericControl)this.FindControl("ulConsultations");
            this.divShortDescription     = (HtmlGenericControl)this.FindControl("divShortDescription");
            this.hidRegionId             = (HtmlInputHidden)this.FindControl("hidRegionId");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidCouponCount          = (HtmlInputHidden)this.FindControl("hidCouponCount");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divPodrequest           = (HtmlGenericControl)this.FindControl("divPodrequest");
            this.divGuest                = (HtmlGenericControl)this.FindControl("divGuest");
            this.divcombina              = (HtmlGenericControl)this.FindControl("divcombina");
            this.hidUnOnSale             = (HtmlInputHidden)this.FindControl("hidUnOnSale");
            this.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litpresaleprice         = (Literal)this.FindControl("litpresaleprice");
            this.litsaleprice            = (Literal)this.FindControl("litsaleprice");
            this.litRetainage            = (Literal)this.FindControl("litRetainage");
            this.litDeliverGood          = (Literal)this.FindControl("litDeliverGood");
            this.hidEndDate              = (HtmlInputHidden)this.FindControl("hidEndDate");
            this.hidNowDate              = (HtmlInputHidden)this.FindControl("hidNowDate");
            this.hdAppId.Value           = masterSettings.WeixinAppId;
            HtmlInputHidden htmlInputHidden = this.hidRegionId;
            int             num             = HiContext.Current.DeliveryScopRegionId;

            htmlInputHidden.Value = num.ToString();
            this.hidden_skuItem   = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidCartQuantity  = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.lblStock         = (StockLabel)this.FindControl("lblStock");
            this.litUnit          = (Literal)this.FindControl("litUnit");
            ProductBrowseInfo productPreSaleBrowseInfo = ProductBrowser.GetProductPreSaleBrowseInfo(this.productId, true);

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

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

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

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

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

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

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

            if (JsonConvert.SerializeObject(productPreSaleBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productPreSaleBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            if (this.hidden_productId != null)
            {
                this.hidden_productId.Value = this.productId.ToString();
            }
            if (this.promote != null)
            {
                this.promote.ProductId = this.productId;
            }
            int supplierId = productPreSaleBrowseInfo.Product.SupplierId;

            if (supplierId > 0)
            {
                SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                if (supplierById != null)
                {
                    this.hidSupplier.Value    = "true";
                    this.litSupplierName.Text = supplierById.SupplierName;
                }
            }
            else
            {
                this.hidSupplier.Value = "false";
            }
            MemberInfo user = HiContext.Current.User;

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

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

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

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

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

            if (user2 != null)
            {
                flag = ProductBrowser.CheckHasCollect(user2.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            this.BindCouponList();
            PageTitle.AddSiteNameTitle(productPreSaleBrowseInfo.Product.ProductName);
            this.BindPromotionInfo();
            this.BindGuestProducts();
            DataTable dBConsultations = productPreSaleBrowseInfo.DBConsultations;

            for (int i = 0; i < dBConsultations.Rows.Count; i++)
            {
                dBConsultations.Rows[i]["UserName"] = DataHelper.GetHiddenUsername(dBConsultations.Rows[i]["UserName"].ToNullString());
            }
            this.rptProductConsultations.DataSource = dBConsultations;
            this.rptProductConsultations.DataBind();
            this.divConsultationEmpty.Visible = dBConsultations.IsNullOrEmpty();
            this.ulConsultations.Visible      = !dBConsultations.IsNullOrEmpty();
            return;

IL_0c63:
            if (HiContext.Current.SiteSettings.OpenReferral == 1)
            {
                num2 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0);
                goto IL_0c8a;
            }
            goto IL_0c89;
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string    orderId   = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId);

            if (orderInfo == null)
            {
                base.Response.Write("<div><font color='red'>您要付款的订单已经不存在,请联系管理员确定</font></div>");
                return;
            }
            if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.Page.Response.Write("订单当前状态不能支付");
                return;
            }
            if (orderInfo.CountDownBuyId > 0)
            {
                CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(orderInfo.CountDownBuyId);
                if (countDownInfoByCountDownId == null || countDownInfoByCountDownId.EndDate < System.DateTime.Now)
                {
                    this.Page.Response.Write("此订单属于限时抢购类型订单,但限时抢购活动已经结束或不存在");
                    return;
                }
            }
            PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId);

            if (paymentMode == null)
            {
                base.Response.Write("<div><font color='red'>您之前选择的支付方式已经不存在,请联系管理员修改支付方式</font></div>");
                return;
            }
            System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
            foreach (LineItemInfo current in lineItems.Values)
            {
                int productId = current.ProductId;
                ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(productId, new int?(6), new int?(6));
                if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
                {
                    base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除"));
                    return;
                }
                if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
                {
                    base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库"));
                    return;
                }
                ProductInfo product          = productBrowseInfo.Product;
                int         stock            = product.Stock;
                int         shipmentQuantity = current.ShipmentQuantity;
                if (shipmentQuantity > stock)
                {
                    base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品库存不足"));
                    return;
                }
            }
            string showUrl = Globals.GetSiteUrls().UrlData.FormatUrl("user_UserOrders");

            if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest")
            {
                showUrl = base.Server.UrlEncode(string.Format("http://{0}/user/OrderDetails.aspx?OrderId={1}", base.Request.Url.Host, orderInfo.OrderId));
            }
            if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0)
            {
                showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[]
                {
                    orderInfo.OrderId
                }));
            }
            if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0)
            {
                showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[]
                {
                    orderInfo.OrderId
                }));
            }
            string attach = "";

            System.Web.HttpCookie httpCookie = Hidistro.Membership.Context.HiContext.Current.Context.Request.Cookies["Token_" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString()];
            if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
            {
                attach = httpCookie.Value;
            }
            PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[]
            {
                paymentMode.Gateway
            })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[]
            {
                paymentMode.Gateway
            })), attach);

            paymentRequest.SendRequest();
        }
Ejemplo n.º 20
0
        private void SetControlsValue(int countDownId)
        {
            CountDownInfo     countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(countDownId);
            ProductBrowseInfo productBrowseInfo          = ProductBrowser.GetProductBrowseInfo(countDownInfoByCountDownId.ProductId, null, null);

            if (productBrowseInfo == null)
            {
                base.GotoResourceNotFound("此商品已不存在");
            }
            if (productBrowseInfo.Product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已下架");
            }
            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.SetWhenIsNotNull(productBrowseInfo.Product.ProductName);
            this.litminCount.SetWhenIsNotNull(countDownInfoByCountDownId.MaxCount.ToString());
            this.litShortDescription.SetWhenIsNotNull(productBrowseInfo.Product.ShortDescription);
            if (this.litDescription != null && !string.IsNullOrWhiteSpace(productBrowseInfo.Product.Description))
            {
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("<script[^>]*?>.*?</script>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                if (!string.IsNullOrEmpty(productBrowseInfo.Product.MobblieDescription))
                {
                    this.litDescription.Text = regex.Replace(productBrowseInfo.Product.MobblieDescription, "");
                }
                else
                {
                    this.litDescription.Text = regex.Replace(productBrowseInfo.Product.Description, "");
                }
            }
            this.litprice.SetWhenIsNotNull(countDownInfoByCountDownId.CountDownPrice.ToString("F2"));
            this.litLeftSeconds.SetWhenIsNotNull(System.Math.Ceiling((countDownInfoByCountDownId.EndDate - System.DateTime.Now).TotalSeconds).ToString());
            this.litcontent.SetWhenIsNotNull(countDownInfoByCountDownId.Content);
            this.litGroupBuyId.SetWhenIsNotNull(countDownInfoByCountDownId.CountDownId.ToString());
            this.skuSelector.ProductId = countDownInfoByCountDownId.ProductId;
            this.expandAttr.ProductId  = countDownInfoByCountDownId.ProductId;
            this.salePrice.SetWhenIsNotNull(productBrowseInfo.Product.MaxSalePrice.ToString("F2"));
            this.linkDescription.SetWhenIsNotNull("/Vshop/ProductDescription.aspx?productId=" + countDownInfoByCountDownId.ProductId);
            this.txtProductId.SetWhenIsNotNull(countDownInfoByCountDownId.ProductId.ToString());
            this.litConsultationsCount.SetWhenIsNotNull(productBrowseInfo.ConsultationCount.ToString());
            this.litReviewsCount.SetWhenIsNotNull(productBrowseInfo.ReviewCount.ToString());
            this.litGroupbuyDescription.SetWhenIsNotNull(countDownInfoByCountDownId.Content);
            this.litMaxCount.SetWhenIsNotNull(countDownInfoByCountDownId.MaxCount.ToString());
            this.nowTime = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("nowTime");
            this.nowTime.SetWhenIsNotNull(System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo));
            this.startTime.SetWhenIsNotNull(countDownInfoByCountDownId.StartDate.ToString("yyyy/MM/dd HH:mm:ss"));
            this.endTime.SetWhenIsNotNull(countDownInfoByCountDownId.EndDate.ToString("yyyy/MM/dd HH:mm:ss"));
            this.groupBuyMaxCount.SetWhenIsNotNull(countDownInfoByCountDownId.MaxCount.ToString());
        }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
0
        protected override void AttachChildControls()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                this.ShowWapMessage("错误的商品ID", "Default.aspx");
            }
            if (base.ClientType.Equals(ClientType.VShop))
            {
                FightGroupActivitiyModel fightGroupActivitiyModel = VShopHelper.GetFightGroupActivities(new FightGroupActivitiyQuery
                {
                    PageIndex = 1,
                    PageSize  = 1,
                    ProductId = this.productId,
                    Status    = EnumFightGroupActivitiyStatus.BeingCarried
                }).Models.FirstOrDefault();
                if (fightGroupActivitiyModel != null)
                {
                    this.Page.Response.Redirect("FightGroupActivityDetails.aspx?fightGroupActivityId=" + fightGroupActivitiyModel.FightGroupActivityId);
                }
            }
            this.hidStoreId            = (HtmlInputHidden)this.FindControl("hidStoreId");
            this.hidSupplier           = (HtmlInputHidden)this.FindControl("hidSupplier");
            this.litSupplierName       = (Literal)this.FindControl("litSupplierName");
            this.aCountDownUrl         = (HyperLink)this.FindControl("aCountDownUrl");
            this.aCountDownUrl.Visible = false;
            this.divCountDownUrl       = (HtmlGenericControl)this.FindControl("divCountDownUrl");
            this.hidCanTakeOnStore     = (HtmlInputHidden)this.FindControl("hidCanTakeOnStore");
            this.HasActivitiesToJumpUrl();
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.rptCouponList           = (WapTemplatedRepeater)this.FindControl("rptCouponList");
            this.rp_guest                = (WapTemplatedRepeater)this.FindControl("rp_guest");
            this.rp_com                  = (WapTemplatedRepeater)this.FindControl("rp_com");
            this.litProdcutName          = (Literal)this.FindControl("litProdcutName");
            this.litSalePrice            = (Literal)this.FindControl("litSalePrice");
            this.litMarketPrice          = (Literal)this.FindControl("litMarketPrice");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.ltlcombinamaininfo      = (Literal)this.FindControl("ltlcombinamaininfo");
            this.skuSubmitOrder          = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.skuStoreSubmitOrder     = (Common_SKUSubmitStoreOrder)this.FindControl("skuStoreSubmitOrder");
            this.expandAttr              = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount            = (Literal)this.FindControl("litSoldCount");
            this.litConsultationsCount   = (Literal)this.FindControl("litConsultationsCount");
            this.litReviewsCount         = (Literal)this.FindControl("litReviewsCount");
            this.litHasCollected         = (HtmlInputHidden)this.FindControl("litHasCollected");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.ltlOrderPromotion2      = (Literal)this.FindControl("ltlOrderPromotion2");
            this.ltlProductSendGifts2    = (Literal)this.FindControl("ltlProductSendGifts2");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.liOrderPromotions       = (HtmlGenericControl)this.FindControl("liOrderPromotions");
            this.liOrderPromotions2      = (HtmlGenericControl)this.FindControl("liOrderPromotions2");
            this.liProductSendGifts2     = (HtmlGenericControl)this.FindControl("liProductSendGifts2");
            this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2");
            this.liOrderPromotions_free  = (HtmlGenericControl)this.FindControl("liOrderPromotions_free");
            this.divActivities           = (HtmlGenericControl)this.FindControl("divActivities");
            this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.liProductSendGifts      = (HtmlGenericControl)this.FindControl("liProductSendGifts");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.divshiptoregion         = (HtmlGenericControl)this.FindControl("divshiptoregion");
            this.divwaplocateaddress     = (HtmlGenericControl)this.FindControl("divwaplocateaddress");
            this.promote                 = (ProductPromote)this.FindControl("ProductPromote");
            this.hdAppId                 = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTitle                 = (HtmlInputHidden)this.FindControl("hdTitle");
            this.hdDesc                  = (HtmlInputHidden)this.FindControl("hdDesc");
            this.hdImgUrl                = (HtmlInputHidden)this.FindControl("hdImgUrl");
            this.hdLink                  = (HtmlInputHidden)this.FindControl("hdLink");
            this.hidCombinaid            = (HtmlInputHidden)this.FindControl("hidCombinaid");
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.ulConsultations         = (HtmlGenericControl)this.FindControl("ulConsultations");
            this.divShortDescription     = (HtmlGenericControl)this.FindControl("divShortDescription");
            this.hidRegionId             = (HtmlInputHidden)this.FindControl("hidRegionId");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidCouponCount          = (HtmlInputHidden)this.FindControl("hidCouponCount");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divPodrequest           = (HtmlGenericControl)this.FindControl("divPodrequest");
            this.divGuest                = (HtmlGenericControl)this.FindControl("divGuest");
            this.divcombina              = (HtmlGenericControl)this.FindControl("divcombina");
            this.hidUnOnSale             = (HtmlInputHidden)this.FindControl("hidUnOnSale");
            this.hidUnAudit              = (HtmlInputHidden)this.FindControl("hidUnAudit");
            this.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.spdiscount              = (HtmlGenericControl)this.FindControl("spdiscount");
            this.ulsupplier              = (HtmlGenericControl)this.FindControl("ulsupplier");
            this.divGouMai               = (HtmlGenericControl)this.FindControl("divGouMai");
            this.ltlBottomStatus         = (Literal)this.FindControl("ltlBottomStatus");
            this.hdAppId.Value           = masterSettings.WeixinAppId;
            this.hidStoreId.Value        = this.storeId.ToString();
            HtmlInputHidden htmlInputHidden = this.hidRegionId;
            int             num             = HiContext.Current.DeliveryScopRegionId;

            htmlInputHidden.Value = num.ToString();
            this.hidden_skuItem   = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidCartQuantity  = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.lblStock         = (StockLabel)this.FindControl("lblStock");
            this.litUnit          = (Literal)this.FindControl("litUnit");
            this.lit_IsRefund     = (Literal)this.FindControl("lit_IsRefund");
            this.lit_IsOverRefund = (Literal)this.FindControl("lit_IsOverRefund");
            this.lit_RefundTime   = (Literal)this.FindControl("lit_RefundTime");
            ProductBrowseInfo wAPProductBrowseInfo = ProductBrowser.GetWAPProductBrowseInfo(this.productId, null, masterSettings.OpenMultStore, 0);
            StoreProductQuery storeProductQuery    = new StoreProductQuery
            {
                ProductId = this.productId,
                StoreId   = this.storeId
            };
            string cookie = WebHelper.GetCookie("UserCoordinateCookie", "NewCoordinate");

            if (!string.IsNullOrEmpty(cookie))
            {
                string[] array = cookie.Split(',');
                storeProductQuery.Position        = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0));
                storeProductQuery.Position.CityId = WebHelper.GetCookie("UserCoordinateCookie", "CityRegionId").ToInt(0);
                storeProductQuery.Position.AreaId = WebHelper.GetCookie("UserCoordinateCookie", "RegionId").ToInt(0);
            }
            else
            {
                storeProductQuery.Position        = new PositionInfo(0.0, 0.0);
                storeProductQuery.Position.CityId = 0;
                storeProductQuery.Position.AreaId = 0;
            }
            this.hidStoreId.Value = this.storeId.ToString();
            if (this.storeId > 0)
            {
                ProductModel storeProduct = ProductBrowser.GetStoreProduct(storeProductQuery);
                if (storeProduct == null || storeProduct.SaleStatus == ProductSaleStatus.Delete)
                {
                    this.Page.Response.Redirect("ProductDelete.aspx");
                    return;
                }
                if (storeProduct.SaleStatus == ProductSaleStatus.OnStock)
                {
                    base.GotoResourceNotFound("商品已经入库");
                }
                if (wAPProductBrowseInfo.Product.ProductType != 1.GetHashCode())
                {
                    HttpContext.Current.Response.Redirect("ProductDetail?productId=" + this.productId);
                }
                if (storeProduct.SaleStatus == ProductSaleStatus.UnSale)
                {
                    this.hidUnOnSale.Value = "1";
                }
                this.litSalePrice.Text = ((storeProduct.MinSalePrice == storeProduct.MaxSalePrice) ? storeProduct.MinSalePrice.F2ToString("f2") : (storeProduct.MinSalePrice.F2ToString("f2") + "~" + storeProduct.MaxSalePrice.F2ToString("f2")));
                this.skuStoreSubmitOrder.IsServiceProduct = true;
                this.skuStoreSubmitOrder.ProductInfo      = storeProduct;
                this.skuSubmitOrder.Visible = false;
            }
            else
            {
                if (wAPProductBrowseInfo.Product == null || wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
                {
                    this.Page.Response.Redirect("ProductDelete.aspx");
                    return;
                }
                if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
                {
                    base.GotoResourceNotFound("商品已经入库");
                }
                if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
                {
                    this.hidUnOnSale.Value = "1";
                }
                this.litSalePrice.Text           = ((wAPProductBrowseInfo.Product.MinSalePrice == wAPProductBrowseInfo.Product.MaxSalePrice) ? wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") : (wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") + "~" + wAPProductBrowseInfo.Product.MaxSalePrice.F2ToString("f2")));
                this.skuSubmitOrder.ProductInfo  = wAPProductBrowseInfo.Product;
                this.skuStoreSubmitOrder.Visible = false;
            }
            if (masterSettings.OpenMultStore)
            {
                if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId))
                {
                    this.hidHasStores.Value      = "1";
                    this.hidCanTakeOnStore.Value = "1";
                }
            }
            else if (masterSettings.IsOpenPickeupInStore && wAPProductBrowseInfo.Product.SupplierId == 0)
            {
                this.hidCanTakeOnStore.Value = "1";
            }
            if (SalesHelper.IsSupportPodrequest() && wAPProductBrowseInfo.Product.SupplierId == 0)
            {
                this.divPodrequest.Visible = true;
            }
            HtmlInputHidden htmlInputHidden2 = this.hidUnAudit;

            num = (int)wAPProductBrowseInfo.Product.AuditStatus;
            htmlInputHidden2.Value = num.ToString();
            if (this.spdiscount != null && HiContext.Current.User.UserId > 0)
            {
                MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(HiContext.Current.User.GradeId);
                this.spdiscount.Visible   = true;
                this.spdiscount.InnerHtml = "<strong class='vip_price'><img src='/templates/pccommon/images/vip_price.png' />" + memberGrade.Name + "价</strong>";
            }
            this.lbUserProductRefer.product = wAPProductBrowseInfo.Product;
            this.hdTitle.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.Title) ? wAPProductBrowseInfo.Product.ProductName : wAPProductBrowseInfo.Product.Title);
            this.hdDesc.Value  = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : wAPProductBrowseInfo.Product.ShortDescription);
            string oldValue = "/storage/master/product/images/";
            string newValue = "/storage/master/product/thumbs410/410_";

            if (!string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1))
            {
                wAPProductBrowseInfo.Product.ImageUrl1 = wAPProductBrowseInfo.Product.ImageUrl1.ToLower().Replace(oldValue, newValue);
            }
            string local = string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) ? SettingsManager.GetMasterSettings().DefaultProductImage : wAPProductBrowseInfo.Product.ImageUrl1;

            this.hdImgUrl.Value = Globals.FullPath(local);
            this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(this.productId);
            }
            if (this.hidden_productId != null)
            {
                this.hidden_productId.Value = this.productId.ToString();
            }
            if (this.promote != null)
            {
                this.promote.ProductId = this.productId;
            }
            MemberInfo user = HiContext.Current.User;

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

            if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null)
            {
                num2 = (user.Referral.IsRepeled ? 1 : 0);
                goto IL_0f0c;
            }
            goto IL_0f0b;
IL_0f0b:
            num2 = 1;
            goto IL_0f0c;
IL_0f0c:
            if (num2 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            bool flag = true;

            if (this.rptProductImages != null)
            {
                string locationUrl = "javascript:;";
                if (string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl2) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl3) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl4) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl5))
                {
                    wAPProductBrowseInfo.Product.ImageUrl1 = masterSettings.DefaultProductImage;
                }
                DataTable         skus = ProductBrowser.GetSkus(this.productId);
                List <SlideImage> list = new List <SlideImage>();
                int supplierId         = wAPProductBrowseInfo.Product.SupplierId;
                if (supplierId > 0)
                {
                    SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                    if (supplierById != null)
                    {
                        this.hidSupplier.Value    = "true";
                        this.litSupplierName.Text = supplierById.SupplierName;
                    }
                }
                else
                {
                    this.hidSupplier.Value = "false";
                    flag = false;
                    this.ulsupplier.Style.Add(HtmlTextWriterStyle.Display, "none");
                }
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl1, locationUrl));
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl2, locationUrl));
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl3, locationUrl));
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl4, locationUrl));
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl5, locationUrl));
                this.rptProductImages.DataSource = from item in list
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.Text = wAPProductBrowseInfo.Product.ProductName;
            if (wAPProductBrowseInfo.Product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(wAPProductBrowseInfo.Product.MarketPrice.GetValueOrDefault(decimal.Zero).F2ToString("f2"));
            }
            this.litShortDescription.Text    = wAPProductBrowseInfo.Product.ShortDescription;
            this.divShortDescription.Visible = !string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription);
            if (wAPProductBrowseInfo.Product.IsRefund)
            {
                this.lit_IsRefund.Text     = "<img src=\"/templates/common/images/service_gou.png\" /><span class=\"c-green\">随时退</span>";
                this.lit_IsOverRefund.Text = (wAPProductBrowseInfo.Product.IsOverRefund ? "" : "<img src=\"/templates/common/images/service_cha.png\" /><span class=\"c-orange\">过期不退</span>");
            }
            else
            {
                this.lit_IsRefund.Text = "<img src=\"/templates/common/images/service_cha.png\" /><span class=\"c-orange\">不可退</span>";
            }
            if (!wAPProductBrowseInfo.Product.IsValid)
            {
                if (wAPProductBrowseInfo.Product.ValidStartDate.HasValue && wAPProductBrowseInfo.Product.ValidEndDate.HasValue)
                {
                    Literal  literal = this.lit_RefundTime;
                    DateTime value   = wAPProductBrowseInfo.Product.ValidStartDate.Value;
                    string   arg     = value.ToString("yyyy/MM/dd");
                    value        = wAPProductBrowseInfo.Product.ValidEndDate.Value;
                    literal.Text = string.Format("{0}-{1}", arg, value.ToString("yyyy/MM/dd"));
                }
            }
            else
            {
                this.lit_RefundTime.Text = "长期有效";
            }
            if (this.litDescription != null)
            {
                string text  = "";
                Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.MobbileDescription))
                {
                    text = regex.Replace(wAPProductBrowseInfo.Product.MobbileDescription, "");
                }
                else if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.Description))
                {
                    text = regex.Replace(wAPProductBrowseInfo.Product.Description, "");
                }
                text = text.Replace("src", "data-url");
                text = text.Replace("vurl", "src");
                this.litDescription.Text = text;
            }
            Literal control = this.litSoldCount;

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

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

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

            if (user2 != null)
            {
                flag2 = ProductBrowser.CheckHasCollect(user2.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag2 ? "1" : "0");
            this.BindCouponList();
            PageTitle.AddSiteNameTitle(wAPProductBrowseInfo.Product.ProductName);
            this.BindCombinaBuyInfo();
            this.BindPromotionInfo();
            DataTable dBConsultations = wAPProductBrowseInfo.DBConsultations;

            for (int i = 0; i < dBConsultations.Rows.Count; i++)
            {
                dBConsultations.Rows[i]["UserName"] = DataHelper.GetHiddenUsername(dBConsultations.Rows[i]["UserName"].ToNullString());
            }
            this.rptProductConsultations.DataSource = dBConsultations;
            this.rptProductConsultations.DataBind();
            this.divConsultationEmpty.Visible = dBConsultations.IsNullOrEmpty();
            this.ulConsultations.Visible      = !dBConsultations.IsNullOrEmpty();
            string phonePriceByProductId = PromoteHelper.GetPhonePriceByProductId(this.productId);

            if (!string.IsNullOrEmpty(phonePriceByProductId))
            {
                this.divPhonePrice.Visible = true;
                decimal num3 = phonePriceByProductId.Split(',')[0].ToDecimal(0);
                this.litPhonePrice.Text = num3.F2ToString("f2");
                decimal num4 = wAPProductBrowseInfo.Product.MinSalePrice - num3;
                this.litSalePrice.Text = ((num4 > decimal.Zero) ? num4 : decimal.Zero).F2ToString("f2");
                this.lbUserProductRefer.MobileExclusive = num3;
            }
            if (flag || this.liOrderPromotions.Visible || this.liOrderPromotions_free2.Visible || this.liProductSendGifts.Visible || this.rptCouponList.Visible)
            {
                this.divActivities.Visible = true;
            }
            else
            {
                this.divActivities.Visible = false;
            }
            StoresInfo storeById = StoresHelper.GetStoreById(this.storeId);

            if (storeById != null)
            {
                this.ProcessException(storeById);
            }
        }
Ejemplo n.º 23
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
     {
         base.GotoResourceNotFound();
     }
     this.common_Location         = (Common_Location)this.FindControl("common_Location");
     this.litProductName          = (System.Web.UI.WebControls.Literal) this.FindControl("litProductName");
     this.lblProductCode          = (System.Web.UI.WebControls.Literal) this.FindControl("lblProductCode");
     this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
     this.lblStock                = (StockLabel)this.FindControl("lblStock");
     this.litUnit                 = (System.Web.UI.WebControls.Literal) this.FindControl("litUnit");
     this.litWeight               = (System.Web.UI.WebControls.Label) this.FindControl("litWeight");
     this.litBrosedNum            = (System.Web.UI.WebControls.Literal) this.FindControl("litBrosedNum");
     this.litBrand                = (System.Web.UI.WebControls.Literal) this.FindControl("litBrand");
     this.lblMarkerPrice          = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice");
     this.lblBuyPrice             = (System.Web.UI.WebControls.Label) this.FindControl("lblBuyPrice");
     this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
     this.litDescription          = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
     this.litShortDescription     = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
     this.hpkProductConsultations = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductConsultations");
     this.hpkProductReviews       = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductReviews");
     this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
     this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
     this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
     this.reviews                 = (Common_ProductReview)this.FindControl("list_Common_ProductReview");
     this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
     this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
     this.hidden_skus             = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skus");
     this.hidden_skuItem          = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skuItem");
     this.hidCartQuantity         = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txCartQuantity");
     this.litIsDown               = (System.Web.UI.WebControls.Literal) this.FindControl("litIsDown");
     this.litTaxRate              = (System.Web.UI.WebControls.Literal) this.FindControl("litTaxRate");
     if (!this.Page.IsPostBack)
     {
         int value = 0;
         if (this.reviews != null)
         {
             value = this.reviews.MaxNum;
         }
         int value2 = 0;
         if (this.consultations != null)
         {
             value2 = this.consultations.MaxNum;
         }
         ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, new int?(value), new int?(value2));
         if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
         {
             this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品已经被管理员删除"));
             return;
         }
         if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnSale)
         {
             Globals.GetSiteUrls().UrlData.FormatUrl("productdetails", new object[]
             {
                 this.Page.Request.QueryString["productId"]
             });
             return;
         }
         if (this.hidCartQuantity != null)
         {
             this.hidCartQuantity.Value = "0";
         }
         System.Collections.IEnumerable value3 =
             from item in productBrowseInfo.Product.Skus
             select item.Value;
         if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
         {
             this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
         }
         if (this.hidden_skus != null)
         {
             this.hidden_skus.Value = JsonConvert.SerializeObject(value3);
         }
         this.LoadPageSearch(productBrowseInfo.Product);
         if (this.hpkProductReviews != null)
         {
             this.hpkProductReviews.Text        = "查看全部" + productBrowseInfo.ReviewCount.ToString() + "条评论";
             this.hpkProductReviews.NavigateUrl = string.Format("LookProductReviews.aspx?productId={0}", this.productId);
         }
         if (this.hpkProductConsultations != null)
         {
             this.hpkProductConsultations.Text        = "查看全部" + productBrowseInfo.ConsultationCount.ToString() + "条咨询";
             this.hpkProductConsultations.NavigateUrl = string.Format("ProductConsultationsAndReplay.aspx?productId={0}", this.productId);
         }
         this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
         BrowsedProductQueue.EnQueue(this.productId);
         this.images.ImageInfo = productBrowseInfo.Product;
         if (productBrowseInfo.DbAttribute != null)
         {
             this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
             this.rptExpandAttributes.DataBind();
         }
         if (productBrowseInfo.DbSKUs != null)
         {
             this.skuSelector.ProductId  = this.productId;
             this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
         }
         if (this.reviews != null && productBrowseInfo.DBReviews != null)
         {
             this.reviews.DataSource = productBrowseInfo.DBReviews;
             this.reviews.DataBind();
         }
         if (this.consultations != null && productBrowseInfo.DBConsultations != null)
         {
             this.consultations.DataSource = productBrowseInfo.DBConsultations;
             this.consultations.DataBind();
         }
         if (this.correlative != null && productBrowseInfo.DbCorrelatives != null)
         {
             this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
             this.correlative.DataBind();
         }
         if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
         {
             if (this.litIsDown != null)
             {
                 this.litIsDown.Text = "该商品已经下架";
             }
         }
     }
 }
Ejemplo n.º 24
0
        protected override void AttachChildControls()
        {
            if (HiContext.Current.User.UserRole == UserRole.Member && ((Member)HiContext.Current.User).ReferralStatus == 2 && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
            {
                this.Page.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString() + "&ReferralUserId=" + HiContext.Current.User.UserId);
                return;
            }
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound();
            }
            this.hiddenpid         = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddenpid");
            this.hiddeSkuId        = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeSkuId");
            this.hiddeCategoryId   = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeCategoryId");
            this.hiddeCategoryName = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeCategoryName");
            this.hidCartQuantity   = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txCartQuantity");
            this.hiddeProductCode  = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeProductCode");
            this.hiddeUserId       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeUserId");
            this.hiddeProductName  = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddeProductName");
            this.buyCardinality    = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("buyCardinality");
            this.hiddenpid.Value   = this.productId.ToString();
            this.promote           = (ProductPromote)this.FindControl("ProductPromote");
            this.common_Location   = (Common_Location)this.FindControl("common_Location");
            this.litProductName    = (System.Web.UI.WebControls.Literal) this.FindControl("litProductName");
            this.lblProductCode    = (System.Web.UI.WebControls.Literal) this.FindControl("lblProductCode");
            this.lblSku            = (SkuLabel)this.FindControl("lblSku");
            this.lblStock          = (StockLabel)this.FindControl("lblStock");
            this.litUnit           = (System.Web.UI.WebControls.Literal) this.FindControl("litUnit");
            this.litBuyCardinality = (System.Web.UI.WebControls.Literal) this.FindControl("litBuyCardinality");
            this.litWeight         = (System.Web.UI.WebControls.Label) this.FindControl("litWeight");
            this.litBrosedNum      = (System.Web.UI.WebControls.Literal) this.FindControl("litBrosedNum");
            this.litBrand          = (System.Web.UI.WebControls.Literal) this.FindControl("litBrand");
            this.litSaleCounts     = (System.Web.UI.WebControls.Literal) this.FindControl("litSaleCounts");
            this.lblMarkerPrice    = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice");
            this.lblBuyPrice       = (System.Web.UI.WebControls.Label) this.FindControl("lblBuyPrice");
            this.lblsmalltitle     = (System.Web.UI.WebControls.Label) this.FindControl("lblsmalltitle");

            this.lblTotalPrice       = (TotalLabel)this.FindControl("lblTotalPrice");
            this.litDescription      = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
            this.litShortDescription = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.btnBuy                  = (BuyButton)this.FindControl("btnBuy");
            this.btnaddgouwu             = (AddCartButton)this.FindControl("btnaddgouwu");
            this.hpkProductConsultations = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductConsultations");
            this.hpkProductReviews       = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductReviews");
            this.hpkProductSales         = (System.Web.UI.WebControls.HyperLink) this.FindControl("hpkProductSales");
            this.litReviewCount          = (System.Web.UI.WebControls.Literal) this.FindControl("litReviewCount");
            this.litItemNumber           = (System.Web.UI.WebControls.Literal) this.FindControl("litItemNumber");
            this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
            //this.rptExpandAttributes = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
            this.expandAttributes   = (Common_ExpandAttributes1)this.FindControl("expandAttributes");
            this.skuSelector        = (SKUSelector)this.FindControl("SKUSelector");
            this.reviews            = (Common_ProductReview)this.FindControl("list_Common_ProductReview");
            this.consultations      = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
            this.correlative        = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
            this.lbUserProductRefer = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.hidden_skus        = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skus");
            this.hidden_skuItem     = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidden_skuItem");
            this.litTaxRate         = (System.Web.UI.WebControls.Literal) this.FindControl("litTaxRate");
            this.imgIcon            = (HiImage)this.FindControl("imgIcon");
            this.litCnArea          = (System.Web.UI.WebControls.Literal) this.FindControl("litCnArea");
            this.litShipping        = (System.Web.UI.WebControls.Literal) this.FindControl("litShipping");
            this.hotSale            = (Common_GoodsList_HotSale)this.FindControl("list_Common_GoodsList_HotSale"); //销售排行
            this.litCategoryNotes3  = (System.Web.UI.WebControls.Literal) this.FindControl("litCategoryNotes3");
            this.productImg         = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("productImg");       //二维码图片
            this.nowBuyBtn          = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("nowBuyBtn");
            this.litviewcount       = (System.Web.UI.WebControls.Literal) this.FindControl("litviewcount");
            this.hiddensupplierid   = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddensupplierid");
            this.litMarkPrice       = (System.Web.UI.WebControls.Literal) this.FindControl("litMarkPrice");
            this.txtBuyAmount       = (BuyAmountBox)this.FindControl("txtBuyAmount");
            if (!this.Page.IsPostBack)
            {
                ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, new int?(this.reviews.MaxNum), new int?(this.consultations.MaxNum));
                if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
                {
                    this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品已经被管理员删除"));
                    return;
                }
                if (this.hidCartQuantity != null)
                {
                    this.hidCartQuantity.Value = this.GetQuantity_Product(productBrowseInfo.Product.ProductId);
                }
                System.Collections.IEnumerable value =
                    from item in productBrowseInfo.Product.Skus
                    select item.Value;
                if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
                {
                    this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
                }
                if (this.hidden_skus != null)
                {
                    this.hidden_skus.Value = JsonConvert.SerializeObject(value);
                }
                if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
                {
                    this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("unproductdetails", new object[]
                    {
                        this.Page.Request.QueryString["productId"]
                    }));
                }
                if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
                {
                    this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库"));
                    return;
                }

                if (productBrowseInfo.cIsDisable == 1)
                {
                    this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库"));
                    return;
                }


                this.LoadPageSearch(productBrowseInfo.Product);
                if (this.lbUserProductRefer != null)
                {
                    this.lbUserProductRefer.product = productBrowseInfo.Product;
                }
                this.hpkProductReviews.Text       = "查看全部" + productBrowseInfo.ReviewCount.ToString() + "条评论";
                this.litviewcount.Text            = productBrowseInfo.ReviewCount.ToString();
                this.hpkProductConsultations.Text = "查看全部" + productBrowseInfo.ConsultationCount.ToString() + "条咨询";
                string count = ProductBrowser.GetLineItemNumber(this.productId).ToString();
                //this.hpkProductSales.Text = "查看全部" + count + "条成交记录";

                int countt = ProductBrowser.GetLineItemCount(this.productId);
                if (countt > 0)
                {
                    this.hpkProductSales.Text        = "查看全部" + countt + "条成交记录";
                    this.hpkProductSales.NavigateUrl = string.Format("LookLineItems.aspx?productId={0}", this.productId);
                }
                else
                {
                    this.hpkProductSales.Text = "暂无成交记录";
                }

                this.litReviewCount.Text = productBrowseInfo.ReviewCount.ToString();
                this.litItemNumber.Text  = countt.ToString();
                this.hpkProductConsultations.NavigateUrl = string.Format("ProductConsultationsAndReplay.aspx?productId={0}", this.productId);
                this.hpkProductReviews.NavigateUrl       = string.Format("LookProductReviews.aspx?productId={0}", this.productId);
                //this.hpkProductSales.NavigateUrl = string.Format("LookLineItems.aspx?productId={0}", this.productId);
                this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);

                this.hiddeCategoryId.Value   = productBrowseInfo.CategoryId;
                this.hiddeCategoryName.Value = productBrowseInfo.CategoryName;
                this.hiddeProductName.Value  = productBrowseInfo.Product.ProductName;
                this.hiddeProductCode.Value  = productBrowseInfo.Product.ProductCode;
                this.hiddeUserId.Value       = HiContext.Current.User.UserId.ToString();
                this.btnBuy.Stock            = productBrowseInfo.Product.Stock;
                this.txtBuyAmount.Quantity   = productBrowseInfo.Product.BuyCardinality;
                this.btnaddgouwu.Stock       = productBrowseInfo.Product.Stock;
                BrowsedProductQueue.EnQueue(this.productId);
                this.images.ImageInfo = productBrowseInfo.Product;
                if (this.promote != null)
                {
                    this.promote.ProductId = this.productId;
                }
                if (productBrowseInfo.DbAttribute != null)
                {
                    this.expandAttributes.DbAttribute = productBrowseInfo.DbAttribute;//商品扩展属性
                    //this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                    //this.rptExpandAttributes.DataBind();
                }
                if (productBrowseInfo.DbSKUs != null)
                {
                    this.skuSelector.ProductId  = this.productId;
                    this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
                }
                if (productBrowseInfo.DBReviews != null)
                {
                    this.reviews.DataSource = productBrowseInfo.DBReviews;
                    this.reviews.DataBind();
                }
                if (productBrowseInfo.DBConsultations != null)
                {
                    this.consultations.DataSource = productBrowseInfo.DBConsultations;
                    this.consultations.DataBind();
                }
                if (productBrowseInfo.DbCorrelatives != null)
                {
                    this.correlative.DataSource = productBrowseInfo.DbCorrelatives;//推荐 ,捆绑或同类型下的商品
                    this.correlative.DataBind();
                }
                if (productBrowseInfo.DBHotSale != null)
                {
                    this.hotSale.DataSource = productBrowseInfo.DBHotSale;
                    this.hotSale.DataBind();
                }
                if (this.productImg != null)
                {
                    if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.QRcode))
                    {
                        this.productImg.Src = productBrowseInfo.Product.QRcode;
                    }
                    //else
                    //{
                    //    //this.productImg.Attributes.Add("display", "none");
                    //}
                }
                this.litCategoryNotes3.Text = productBrowseInfo.CategoryNote3;
            }
        }
Ejemplo n.º 25
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
     {
         base.GotoResourceNotFound();
     }
     this.common_Location         = (Common_Location)this.FindControl("common_Location");
     this.litProductCode          = (Literal)this.FindControl("litProductCode");
     this.litProductName          = (Literal)this.FindControl("litProductName");
     this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
     this.lblStock                = (StockLabel)this.FindControl("lblStock");
     this.litUnit                 = (Literal)this.FindControl("litUnit");
     this.litWeight               = (WeightLabel)this.FindControl("litWeight");
     this.litBrosedNum            = (Literal)this.FindControl("litBrosedNum");
     this.litBrand                = (Literal)this.FindControl("litBrand");
     this.lblSalePrice            = (FormatedMoneyLabel)this.FindControl("lblSalePrice");
     this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
     this.litDescription          = (Literal)this.FindControl("litDescription");
     this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
     this.btnOrder                = (BuyButton)this.FindControl("btnOrder");
     this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
     this.hpkProductReviews       = (HyperLink)this.FindControl("hpkProductReviews");
     this.lblCurrentSalePrice     = (FormatedMoneyLabel)this.FindControl("lblCurrentSalePrice");
     this.litContent              = (Literal)this.FindControl("litContent");
     this.lblEndTime              = (FormatedTimeLabel)this.FindControl("lblEndTime");
     this.litRemainTime           = (Literal)this.FindControl("litRemainTime");
     this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
     this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
     this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
     this.reviews                 = (Common_ProductReview)this.FindControl("list_Common_ProductReview");
     this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
     this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
     if (!this.Page.IsPostBack)
     {
         ProductBrowseInfo info          = ProductBrowser.GetProductBrowseInfo(this.productId, new int?(this.reviews.MaxNum), new int?(this.consultations.MaxNum));
         CountDownInfo     countDownInfo = ProductBrowser.GetCountDownInfo(this.productId);
         if ((info.Product == null) || (countDownInfo == null))
         {
             this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品参与的限时抢购活动已经结束;或被管理员删除"));
         }
         else
         {
             this.LoadPageSearch(info.Product);
             this.hpkProductReviews.Text              = "查看全部" + ProductBrowser.GetProductReviewNumber(this.productId).ToString() + "条评论";
             this.hpkProductConsultations.Text        = "查看全部" + ProductBrowser.GetProductConsultationNumber(this.productId).ToString() + "条咨询";
             this.hpkProductConsultations.NavigateUrl = string.Format("ProductConsultationsAndReplay.aspx?productId={0}", this.productId);
             this.hpkProductReviews.NavigateUrl       = string.Format("LookProductReviews.aspx?productId={0}", this.productId);
             this.LoadProductInfo(info.Product, info.BrandName);
             this.LoadProductGroupBuyInfo(countDownInfo);
             this.btnOrder.Stock = info.Product.Stock;
             BrowsedProductQueue.EnQueue(this.productId);
             this.images.ImageInfo = info.Product;
             if (info.DbAttribute != null)
             {
                 this.rptExpandAttributes.DataSource = info.DbAttribute;
                 this.rptExpandAttributes.DataBind();
             }
             if (info.DbSKUs != null)
             {
                 this.skuSelector.ProductId  = this.productId;
                 this.skuSelector.DataSource = info.DbSKUs;
             }
             if (info.DBReviews != null)
             {
                 this.reviews.DataSource = info.DBReviews;
                 this.reviews.DataBind();
             }
             if (info.DBConsultations != null)
             {
                 this.consultations.DataSource = info.DBConsultations;
                 this.consultations.DataBind();
             }
             if (info.DbCorrelatives != null)
             {
                 this.correlative.DataSource = info.DbCorrelatives;
                 this.correlative.DataBind();
             }
         }
     }
 }
Ejemplo n.º 26
0
        public override ProductBrowseInfo GetProductBrowseInfo(int productId, int?maxReviewNum, int?maxConsultationNum)
        {
            int memberDiscount        = 100;
            ProductBrowseInfo info    = new ProductBrowseInfo();
            StringBuilder     builder = new StringBuilder();

            builder.Append("UPDATE Hishop_Products SET VistiCounts = VistiCounts + 1 WHERE ProductId = @ProductId;");
            builder.Append(" SELECT * ,CASE WHEN BrandId IS NULL THEN NULL ELSE (SELECT BrandName FROM Hishop_BrandCategories WHERE BrandId= p.BrandId) END AS BrandName");
            builder.Append(" FROM Hishop_Products p where ProductId=@ProductId;");
            if (HiContext.Current.User.UserRole == UserRole.Member)
            {
                Member user = HiContext.Current.User as Member;
                memberDiscount = MemberProvider.Instance().GetMemberDiscount(user.GradeId);
                builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock, AlertStock, CostPrice, PurchasePrice,");
                builder.AppendFormat(" (CASE WHEN (SELECT COUNT(*) FROM Hishop_SKUMemberPrice WHERE SkuId = s.SkuId AND GradeId = {0}) = 1", user.GradeId);
                builder.AppendFormat(" THEN (SELECT MemberSalePrice FROM Hishop_SKUMemberPrice WHERE SkuId = s.SkuId AND GradeId = {0}) ELSE SalePrice*{1}/100 END) AS SalePrice", user.GradeId, memberDiscount);
                builder.Append(" FROM Hishop_SKUs s WHERE ProductId = @ProductId");
            }
            else
            {
                builder.Append("SELECT SkuId, ProductId, SKU,Weight, Stock, AlertStock, CostPrice, PurchasePrice, SalePrice FROM Hishop_SKUs WHERE ProductId = @ProductId");
            }
            if (maxReviewNum.HasValue)
            {
                builder.AppendFormat(" SELECT TOP {0} * FROM Hishop_ProductReviews where ProductId=@ProductId ORDER BY ReviewId DESC ; ", maxReviewNum);
            }
            if (maxConsultationNum.HasValue)
            {
                builder.AppendFormat(" SELECT TOP {0} * FROM Hishop_ProductConsultations where ProductId=@ProductId AND ReplyUserId IS NOT NULL ORDER BY ConsultationId DESC ;", maxConsultationNum);
            }
            builder.Append(" SELECT a.AttributeId, AttributeName, ValueStr FROM Hishop_ProductAttributes pa JOIN Hishop_Attributes a ON pa.AttributeId = a.AttributeId");
            builder.Append(" JOIN Hishop_AttributeValues v ON a.AttributeId = v.AttributeId AND pa.ValueId = v.ValueId  WHERE ProductId = @ProductId ORDER BY a.DisplaySequence DESC, v.DisplaySequence DESC");
            builder.Append(" SELECT SkuId, a.AttributeId, AttributeName, UseAttributeImage, av.ValueId, ValueStr, ImageUrl FROM Hishop_SKUItems s join Hishop_Attributes a on s.AttributeId = a.AttributeId join Hishop_AttributeValues av on s.ValueId = av.ValueId WHERE SkuId IN (SELECT SkuId FROM Hishop_SKUs WHERE ProductId = @ProductId) ORDER BY a.DisplaySequence DESC,av.DisplaySequence DESC;");
            builder.Append(" SELECT TOP 20 ProductId,ProductName,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180 FROM Hishop_Products");
            builder.AppendFormat(" WHERE SaleStatus = {0} AND ProductId IN (SELECT RelatedProductId FROM Hishop_RelatedProducts WHERE ProductId = {1})", 1, productId);
            builder.Append(" SELECT TOP 20 ProductId,ProductName,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180 FROM Hishop_Products");
            builder.AppendFormat(" WHERE SaleStatus = {0} AND ProductId<>{1}  AND CategoryId = (SELECT CategoryId FROM Hishop_Products WHERE ProductId={1} AND SaleStatus = {0})", 1, productId);
            builder.AppendFormat(" AND ProductId NOT IN (SELECT RelatedProductId FROM Hishop_RelatedProducts WHERE ProductId = {0})", productId);
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, productId);
            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                DataRow current;
                if (reader.Read())
                {
                    info.Product = DataMapper.PopulateProduct(reader);
                    if (reader["BrandName"] != DBNull.Value)
                    {
                        info.BrandName = (string)reader["BrandName"];
                    }
                }
                if (reader.NextResult())
                {
                    while (reader.Read())
                    {
                        info.Product.Skus.Add((string)reader["SkuId"], DataMapper.PopulateSKU(reader));
                    }
                }
                if (maxReviewNum.HasValue && reader.NextResult())
                {
                    info.DBReviews = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (maxConsultationNum.HasValue && reader.NextResult())
                {
                    info.DBConsultations = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (reader.NextResult())
                {
                    DataTable table = DataHelper.ConverDataReaderToDataTable(reader);
                    if ((table != null) && (table.Rows.Count > 0))
                    {
                        DataTable   table2     = table.Clone();
                        IEnumerator enumerator = table.Rows.GetEnumerator();
                        {
                            while (enumerator.MoveNext())
                            {
                                current = (DataRow)enumerator.Current;
                                bool flag = false;
                                if (table2.Rows.Count > 0)
                                {
                                    foreach (DataRow row2 in table2.Rows)
                                    {
                                        if (((int)row2["AttributeId"]) == ((int)current["AttributeId"]))
                                        {
                                            DataRow row4;
                                            flag = true;
                                            (row4 = row2)["ValueStr"] = row4["ValueStr"] + ", " + current["ValueStr"];
                                        }
                                    }
                                }
                                if (!flag)
                                {
                                    DataRow row = table2.NewRow();
                                    row["AttributeId"]   = current["AttributeId"];
                                    row["AttributeName"] = current["AttributeName"];
                                    row["ValueStr"]      = current["ValueStr"];
                                    table2.Rows.Add(row);
                                }
                            }
                        }
                        info.DbAttribute = table2;
                    }
                }
                if (reader.NextResult())
                {
                    info.DbSKUs = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (reader.NextResult())
                {
                    info.DbCorrelatives = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (!reader.NextResult())
                {
                    return(info);
                }
                while (reader.Read())
                {
                    current = info.DbCorrelatives.NewRow();
                    current["ProductId"]       = reader["ProductId"];
                    current["ProductName"]     = reader["ProductName"];
                    current["ThumbnailUrl60"]  = reader["ThumbnailUrl60"];
                    current["ThumbnailUrl100"] = reader["ThumbnailUrl100"];
                    current["ThumbnailUrl160"] = reader["ThumbnailUrl160"];
                    current["ThumbnailUrl180"] = reader["ThumbnailUrl180"];
                    info.DbCorrelatives.Rows.Add(current);
                }
            }
            return(info);
        }
Ejemplo n.º 27
0
        public static ProductBrowseInfo GetProductBrowseInfo(int productId, int?maxConsultationNum, bool MutiStores = false, int gradeId = 0)
        {
            BrowsedProductQueue.EnQueue(productId);
            ProductBrowseDao productBrowseDao = new ProductBrowseDao();

            productBrowseDao.AddVistiCounts(productId);
            if (gradeId == 0)
            {
                MemberInfo user = HiContext.Current.User;
                if (user.UserId != 0)
                {
                    gradeId = user.GradeId;
                }
            }
            string            key = $"DataCache-Product-{productId}-{gradeId}-{MutiStores}";
            ProductBrowseInfo productBrowseInfo = HiCache.Get <ProductBrowseInfo>(key);

            if (productBrowseInfo == null)
            {
                productBrowseInfo = productBrowseDao.GetProductBrowseInfo(productId, gradeId, maxConsultationNum, MutiStores);
                if (productBrowseInfo.DbCorrelatives != null && productBrowseInfo.DbCorrelatives.Rows.Count > 0)
                {
                    int num = 0;
                    foreach (DataRow row in productBrowseInfo.DbCorrelatives.Rows)
                    {
                        if (string.IsNullOrEmpty(row["ThumbnailUrl60"].ToNullString()))
                        {
                            productBrowseInfo.DbCorrelatives.Rows[num]["ThumbnailUrl60"] = HiContext.Current.SiteSettings.DefaultProductThumbnail2;
                        }
                        if (string.IsNullOrEmpty(row["ThumbnailUrl100"].ToNullString()))
                        {
                            productBrowseInfo.DbCorrelatives.Rows[num]["ThumbnailUrl100"] = HiContext.Current.SiteSettings.DefaultProductThumbnail3;
                        }
                        if (string.IsNullOrEmpty(row["ThumbnailUrl160"].ToNullString()))
                        {
                            productBrowseInfo.DbCorrelatives.Rows[num]["ThumbnailUrl160"] = HiContext.Current.SiteSettings.DefaultProductThumbnail4;
                        }
                        if (string.IsNullOrEmpty(row["ThumbnailUrl180"].ToNullString()))
                        {
                            productBrowseInfo.DbCorrelatives.Rows[num]["ThumbnailUrl180"] = HiContext.Current.SiteSettings.DefaultProductThumbnail5;
                        }
                        if (string.IsNullOrEmpty(row["ThumbnailUrl220"].ToNullString()))
                        {
                            productBrowseInfo.DbCorrelatives.Rows[num]["ThumbnailUrl220"] = HiContext.Current.SiteSettings.DefaultProductThumbnail6;
                        }
                        if (string.IsNullOrEmpty(row["ThumbnailUrl310"].ToNullString()))
                        {
                            productBrowseInfo.DbCorrelatives.Rows[num]["ThumbnailUrl310"] = HiContext.Current.SiteSettings.DefaultProductThumbnail7;
                        }
                        num++;
                    }
                }
                if (productBrowseInfo.ListCorrelatives != null && productBrowseInfo.ListCorrelatives.Count > 0)
                {
                    int num2 = 0;
                    foreach (ProductInfo listCorrelative in productBrowseInfo.ListCorrelatives)
                    {
                        if (string.IsNullOrEmpty(listCorrelative.ThumbnailUrl60.ToNullString()))
                        {
                            productBrowseInfo.ListCorrelatives[num2].ThumbnailUrl60 = HiContext.Current.SiteSettings.DefaultProductThumbnail2;
                        }
                        if (string.IsNullOrEmpty(listCorrelative.ThumbnailUrl100.ToNullString()))
                        {
                            productBrowseInfo.ListCorrelatives[num2].ThumbnailUrl100 = HiContext.Current.SiteSettings.DefaultProductThumbnail3;
                        }
                        if (string.IsNullOrEmpty(listCorrelative.ThumbnailUrl160.ToNullString().ToNullString()))
                        {
                            productBrowseInfo.ListCorrelatives[num2].ThumbnailUrl160 = HiContext.Current.SiteSettings.DefaultProductThumbnail4;
                        }
                        if (string.IsNullOrEmpty(listCorrelative.ThumbnailUrl180.ToNullString()))
                        {
                            productBrowseInfo.ListCorrelatives[num2].ThumbnailUrl180 = HiContext.Current.SiteSettings.DefaultProductThumbnail5;
                        }
                        if (string.IsNullOrEmpty(listCorrelative.ThumbnailUrl220.ToNullString()))
                        {
                            productBrowseInfo.ListCorrelatives[num2].ThumbnailUrl220 = HiContext.Current.SiteSettings.DefaultProductThumbnail6;
                        }
                        if (string.IsNullOrEmpty(listCorrelative.ThumbnailUrl310.ToNullString()))
                        {
                            productBrowseInfo.ListCorrelatives[num2].ThumbnailUrl310 = HiContext.Current.SiteSettings.DefaultProductThumbnail7;
                        }
                        num2++;
                    }
                }
                HiCache.Insert(key, productBrowseInfo, 600);
            }
            return(productBrowseInfo);
        }
        private void SetControlsValue(int groupbuyId)
        {
            this.hdSource.Value = "groupbuy";
            GroupBuyInfo groupBuy = ProductBrowser.GetGroupBuy(groupbuyId);

            if (groupBuy == null)
            {
                base.GotoResourceNotFound("团购已经被管理员删除");
            }
            else if (groupBuy.Status != GroupBuyStatus.UnderWay)
            {
                this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该团购活动已经结束"));
            }
            else
            {
                this.skuSubmitOrder.OrderBusiness = 3;
                int soldCount = PromoteHelper.GetSoldCount(groupbuyId);
                this.skuSubmitOrder.GroupBuyInfo      = groupBuy;
                this.skuSubmitOrder.GroupBuySoldCount = soldCount;
                SiteSettings      masterSettings    = SettingsManager.GetMasterSettings();
                ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(groupBuy.ProductId, null, masterSettings.OpenMultStore, 0);
                if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
                {
                    base.GotoResourceNotFound("团购商品已经被管理员删除");
                }
                else
                {
                    if (productBrowseInfo.Product.SaleStatus != ProductSaleStatus.OnSale)
                    {
                        base.GotoResourceNotFound("此商品已下架");
                    }
                    if (this.rptProductImages != null)
                    {
                        string            locationUrl = "javascript:;";
                        List <SlideImage> list        = new List <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)
                        };
                        IEnumerable <SlideImage> source = from item in list
                                                          where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                          select item;
                        if (source.Count() == 0)
                        {
                            list.Add(new SlideImage(masterSettings.DefaultProductImage, locationUrl));
                        }
                        this.rptProductImages.DataSource = from item in list
                                                           where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                           select item;
                        this.rptProductImages.DataBind();
                    }
                    this.skuSubmitOrder.ProductInfo = productBrowseInfo.Product;
                    this.hdTitle.Value  = Globals.StripAllTags(string.IsNullOrEmpty(productBrowseInfo.Product.Title) ? productBrowseInfo.Product.ProductName : productBrowseInfo.Product.Title);
                    this.hdDesc.Value   = Globals.StripAllTags(string.IsNullOrEmpty(productBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : productBrowseInfo.Product.ShortDescription);
                    this.hdImgUrl.Value = Globals.FullPath(productBrowseInfo.Product.ImageUrl1);
                    this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
                    this.litProdcutName.SetWhenIsNotNull(productBrowseInfo.Product.ProductName);
                    this.litSoldCount.SetWhenIsNotNull(soldCount.ToString());
                    Literal control = this.litminCount;
                    int     num     = groupBuy.Count;
                    control.SetWhenIsNotNull(num.ToString());
                    this.litShortDescription.SetWhenIsNotNull(productBrowseInfo.Product.ShortDescription);
                    if (this.litDescription != null)
                    {
                        string text  = "";
                        Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                        if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.MobbileDescription))
                        {
                            text = regex.Replace(productBrowseInfo.Product.MobbileDescription, "");
                        }
                        else if (!string.IsNullOrWhiteSpace(productBrowseInfo.Product.Description))
                        {
                            text = regex.Replace(productBrowseInfo.Product.Description, "");
                        }
                        text = text.Replace("src", "data-url");
                        this.litDescription.Text = text;
                    }
                    this.litprice.SetWhenIsNotNull(groupBuy.Price.F2ToString("f2"));
                    this.litLeftSeconds.SetWhenIsNotNull(Math.Ceiling((groupBuy.EndDate - DateTime.Now).TotalSeconds).ToString());
                    this.litcontent.SetWhenIsNotNull(groupBuy.Content);
                    HtmlInputControl control2 = this.litGroupBuyId;
                    num = groupBuy.GroupBuyId;
                    control2.SetWhenIsNotNull(num.ToString());
                    this.salePrice.SetWhenIsNotNull(productBrowseInfo.Product.MaxSalePrice.F2ToString("f2"));
                    Literal control3 = this.leftCount;
                    num = groupBuy.MaxCount - soldCount;
                    control3.SetWhenIsNotNull(num.ToString());
                    int     num2     = groupBuy.Count - soldCount;
                    Literal control4 = this.minSuccessCount;
                    num = ((num2 > 0) ? num2 : 0);
                    control4.SetWhenIsNotNull(num.ToString());
                    HtmlInputControl control5 = this.txtProductId;
                    num = groupBuy.ProductId;
                    control5.SetWhenIsNotNull(num.ToString());
                    this.groupBuySoldCount.SetWhenIsNotNull(soldCount.ToString());
                    Literal control6 = this.litConsultationsCount;
                    num = productBrowseInfo.ConsultationCount;
                    control6.SetWhenIsNotNull(num.ToString());
                    HtmlInputHidden control7 = this.groupBuyMinCount;
                    num = groupBuy.Count;
                    control7.SetWhenIsNotNull(num.ToString());
                    Literal control8 = this.litReviewsCount;
                    num = productBrowseInfo.ReviewCount;
                    control8.SetWhenIsNotNull(num.ToString());
                    this.litGroupbuyDescription.SetWhenIsNotNull(groupBuy.Content);
                    Literal control9 = this.litMaxCount;
                    num = groupBuy.MaxCount;
                    control9.SetWhenIsNotNull(num.ToString());
                    this.nowTime = (HtmlInputHidden)this.FindControl("nowTime");
                    HtmlInputHidden control10 = this.nowTime;
                    DateTime        dateTime  = DateTime.Now;
                    control10.SetWhenIsNotNull(dateTime.ToString("yyyy/MM/dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo));
                    HtmlInputHidden control11 = this.startTime;
                    dateTime = groupBuy.StartDate;
                    control11.SetWhenIsNotNull(dateTime.ToString("yyyy/MM/dd HH:mm:ss"));
                    HtmlInputHidden control12 = this.endTime;
                    dateTime = groupBuy.EndDate;
                    control12.SetWhenIsNotNull(dateTime.ToString("yyyy/MM/dd HH:mm:ss"));
                    HtmlInputHidden control13 = this.groupBuyMaxCount;
                    num = groupBuy.MaxCount;
                    control13.SetWhenIsNotNull(num.ToString());
                    HtmlInputHidden control14 = this.skuStock;
                    num = productBrowseInfo.Product.DefaultSku.Stock;
                    control14.SetWhenIsNotNull(num.ToString());
                    this.litUnit1.SetWhenIsNotNull(productBrowseInfo.Product.Unit);
                    this.litUnit2.SetWhenIsNotNull(productBrowseInfo.Product.Unit);
                    this.litUnit3.SetWhenIsNotNull(productBrowseInfo.Product.Unit);
                }
            }
        }
Ejemplo n.º 29
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(base.GetParameter("productId", false), out this.productId))
            {
                base.GotoResourceNotFound();
            }
            this.hidSupName              = (HtmlInputHidden)this.FindControl("hidSupName");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.hiddenpid               = (HtmlInputHidden)this.FindControl("hiddenpid");
            this.hidCartQuantity         = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.hiddenpid.Value         = this.productId.ToString();
            this.common_Location         = (Common_Location)this.FindControl("common_Location");
            this.litProductName          = (Literal)this.FindControl("litProductName");
            this.lblStock                = (StockLabel)this.FindControl("lblStock");
            this.litUnit                 = (Literal)this.FindControl("litUnit");
            this.litSaleCounts           = (Literal)this.FindControl("litSaleCounts");
            this.lblMarkerPrice          = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice");
            this.lblBuyPrice             = (Label)this.FindControl("lblBuyPrice");
            this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
            this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.btnBuy                  = (BuyButton)this.FindControl("btnBuy");
            this.btnaddgouwu             = (AddCartButton)this.FindControl("btnaddgouwu");
            this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
            this.ltlSaleCount            = (Literal)this.FindControl("ltlSaleCount");
            this.ltlReviewCount          = (Literal)this.FindControl("ltlReviewCount");
            this.litReviewCount          = (Literal)this.FindControl("litReviewCount");
            this.ltlConsultation         = (Literal)this.FindControl("ltlConsultation");
            this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
            this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
            this.rptOnlineService        = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService");
            this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
            this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
            this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.hidden_skuItem          = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidIsOpenMultiStore     = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore");
            this.aCountDownUrl           = (HyperLink)this.FindControl("aCountDownUrl");
            this.imgQrCode               = (Image)this.FindControl("imgQrCode");
            this.phonePriceQrCode        = (Image)this.FindControl("phonePriceQrCode");
            this.liCode                  = (HtmlGenericControl)this.FindControl("liCode");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divGift                 = (HtmlGenericControl)this.FindControl("divGift");
            this.ltlGiftName             = (Literal)this.FindControl("ltlGiftName");
            this.ltlGiftNum              = (Literal)this.FindControl("ltlGiftNum");
            this.aBrand                  = (HtmlAnchor)this.FindControl("aBrand");
            this.imgBrand                = (HiImage)this.FindControl("imgBrand");
            this.imgpdorequest           = (HtmlImage)this.FindControl("imgpdorequest");
            this.imgTakeonstore          = (HtmlImage)this.FindControl("imgTakeonstore");
            this.imgCustomerService      = (HtmlImage)this.FindControl("imgCustomerService");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.divOrderPromotions      = (HtmlGenericControl)this.FindControl("divOrderPromotions");
            this.divOrderPromotions2     = (HtmlGenericControl)this.FindControl("divOrderPromotions2");
            this.divOrderPromotions3     = (HtmlGenericControl)this.FindControl("divOrderPromotions3");
            this.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litPhonePriceEndDate    = (Literal)this.FindControl("litPhonePriceEndDate");
            this.divCuxiao               = (HtmlGenericControl)this.FindControl("divCuxiao");
            this.ltlUnit                 = (Literal)this.FindControl("ltlUnit");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.setDeliverRegion        = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion");
            this.hidShowCombinationBuy   = (HtmlInputHidden)this.FindControl("hidShowCombinationBuy");
            this.hidCombinationId        = (HtmlInputHidden)this.FindControl("hidCombinationId");
            this.imgMainPic              = (HtmlImage)this.FindControl("imgMainPic");
            this.divqq = (HtmlGenericControl)this.FindControl("divqq");
            HtmlAnchor htmlAnchor = (HtmlAnchor)this.FindControl("aMainName");

            this.lblMainPrice = (Label)this.FindControl("lblMainPrice");
            ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts");

            this.spdiscount            = (HtmlGenericControl)this.FindControl("spdiscount");
            this.aCountDownUrl.Visible = false;
            this.buyProduct            = (HtmlTableRow)this.FindControl("buyProduct");
            this.serviceProduct        = (HtmlTableRow)this.FindControl("serviceProduct");
            if (this.Page.IsPostBack)
            {
                return;
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (this.spdiscount != null && HiContext.Current.User.UserId > 0)
            {
                MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(HiContext.Current.User.GradeId);
                this.spdiscount.Visible   = true;
                this.spdiscount.InnerHtml = "<strong class='vip_price'><img src='/templates/pccommon/images/vip_price.png' />" + memberGrade.Name + "价</strong>";
            }
            if (this.imgQrCode != null)
            {
                string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png);
                this.imgQrCode.ImageUrl = text;
            }
            if (this.phonePriceQrCode != null)
            {
                string text2 = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text2, false, ImageFormats.Png);
                this.phonePriceQrCode.ImageUrl = text2;
            }
            if (this.liCode != null && HiContext.Current.SiteSettings.OpenAliho == 0 && HiContext.Current.SiteSettings.OpenVstore == 0 && HiContext.Current.SiteSettings.OpenWap == 0 && HiContext.Current.SiteSettings.OpenMobbile == 0)
            {
                this.liCode.Visible = false;
            }
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, 0);

            if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("/ProductDelete.aspx");
                return;
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.Page.Response.Redirect(base.GetRouteUrl("unproductdetails", new
                {
                    ProductId = this.productId
                }));
            }
            if (productBrowseInfo.Product.SupplierId > 0 && productBrowseInfo.Product.AuditStatus != ProductAuditStatus.Pass)
            {
                this.Page.Response.Redirect(base.GetRouteUrl("unproductdetailsaudit", new
                {
                    ProductId = this.productId
                }));
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
            {
                this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库"));
                return;
            }
            this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId;
            this.setDeliverRegion.Volume             = productBrowseInfo.Product.Weight;
            this.setDeliverRegion.Weight             = productBrowseInfo.Product.Weight;
            this.ActivityBusiness();
            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId);
            }
            IEnumerable value = from item in productBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            this.hidden_productId.Value = this.productId.ToString();
            this.LoadPageSearch(productBrowseInfo.Product);
            if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage)
            {
                this.lbUserProductRefer.product = productBrowseInfo.Product;
            }
            HyperLink hyperLink = this.hpkProductConsultations;
            int       num       = productBrowseInfo.ConsultationCount;

            hyperLink.Text = "查看全部" + num.ToString() + "条咨询";
            Literal literal = this.ltlConsultation;

            num          = productBrowseInfo.ConsultationCount;
            literal.Text = num.ToString();
            Literal literal2 = this.ltlSaleCount;

            num           = productBrowseInfo.SaleCount;
            literal2.Text = num.ToString();
            Literal literal3 = this.ltlReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal3.Text = num.ToString();
            Literal literal4 = this.litReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal4.Text = num.ToString();
            this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}";
            this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
            this.btnBuy.Stock  = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            this.ltlUnit.Text  = productBrowseInfo.Product.Unit;
            this.divqq.Visible = (this.sitesettings.ServiceIsOpen == "1");
            MemberInfo user = HiContext.Current.User;

            if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productBrowseInfo.Product.SubMemberDeduct.HasValue))
            {
                if (!productBrowseInfo.Product.SubMemberDeduct.HasValue)
                {
                    goto IL_0c9e;
                }
                decimal?subMemberDeduct = productBrowseInfo.Product.SubMemberDeduct;
                if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue)
                {
                    goto IL_0c9e;
                }
            }
            goto IL_0cd8;
IL_0cd9:
            int num2;

            if (num2 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            this.btnaddgouwu.Stock = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            BrowsedProductQueue.EnQueue(this.productId);
            this.images.ImageInfo = productBrowseInfo.Product;
            if (productBrowseInfo.DbAttribute != null)
            {
                this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                this.rptExpandAttributes.DataBind();
            }
            if (productBrowseInfo.DbSKUs != null)
            {
                this.skuSelector.ProductId  = this.productId;
                this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
            }
            int supplierId = productBrowseInfo.Product.SupplierId;

            if (supplierId > 0)
            {
                SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                if (!string.IsNullOrEmpty(supplierById.Picture))
                {
                    this.imgBrand.ImageUrl = supplierById.Picture;
                }
                else if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory.BrandId
                        });
                    }
                }
                else
                {
                    this.imgBrand.Visible = false;
                }
                this.litSupplierName.Text = "<a href=\"/SupplierAbout?SupplierId=" + supplierById.SupplierId + "\">" + supplierById.SupplierName + "</a>";
                this.hidSupName.Value     = supplierById.SupplierName;
            }
            else
            {
                this.litSupplierName.Visible = false;
                if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory2 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory2 != null && !string.IsNullOrEmpty(brandCategory2.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory2.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory2.BrandId
                        });
                    }
                }
            }
            if (SalesHelper.IsSupportPodrequest() && productBrowseInfo.Product.SupplierId == 0)
            {
                this.imgpdorequest.Visible = true;
            }
            if (masterSettings.OpenMultStore)
            {
                if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId))
                {
                    this.imgTakeonstore.Visible = true;
                }
            }
            else if (masterSettings.IsOpenPickeupInStore && productBrowseInfo.Product.SupplierId == 0)
            {
                this.imgTakeonstore.Visible = true;
            }
            if (productBrowseInfo.DBConsultations != null)
            {
                this.consultations.DataSource = productBrowseInfo.DBConsultations;
                this.consultations.DataBind();
            }
            if (productBrowseInfo.DbCorrelatives != null)
            {
                this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
                this.correlative.DataBind();
            }
            this.BindOrderPromotions();
            if (!this.divOrderPromotions.Visible && !this.divOrderPromotions2.Visible && !this.divOrderPromotions3.Visible && !this.divPhonePrice.Visible)
            {
                this.divCuxiao.Style.Add("display", "none");
            }
            if (this.rptOnlineService != null)
            {
                IList <OnlineServiceInfo> allOnlineService  = OnlineServiceHelper.GetAllOnlineService(0, 1);
                IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2);
                if (allOnlineService2 != null)
                {
                    foreach (OnlineServiceInfo item in allOnlineService2)
                    {
                        allOnlineService.Add(item);
                    }
                }
                this.rptOnlineService.DataSource = allOnlineService;
                this.rptOnlineService.DataBind();
            }
            if (productBrowseInfo.Product.Stock > 0)
            {
                CombinationBuyInfo combinationBuyByMainProductId = CombinationBuyHelper.GetCombinationBuyByMainProductId(this.productId);
                if (combinationBuyByMainProductId != null)
                {
                    List <CombinationBuyandProductUnionInfo> combinationProductListByProductId = CombinationBuyHelper.GetCombinationProductListByProductId(this.productId);
                    CombinationBuyandProductUnionInfo        combinationBuyandProductUnionInfo = combinationProductListByProductId.FirstOrDefault((CombinationBuyandProductUnionInfo c) => c.ProductId == this.productId);
                    if (combinationBuyandProductUnionInfo != null)
                    {
                        HtmlInputHidden htmlInputHidden = this.hidCombinationId;
                        num = combinationBuyandProductUnionInfo.CombinationId;
                        htmlInputHidden.Value = num.ToString();
                        string value2 = string.IsNullOrEmpty(combinationBuyandProductUnionInfo.ThumbnailUrl100) ? this.sitesettings.DefaultProductThumbnail3 : combinationBuyandProductUnionInfo.ThumbnailUrl100;
                        this.imgMainPic.Attributes["data-url"] = value2;
                        htmlAnchor.InnerText   = combinationBuyandProductUnionInfo.ProductName;
                        this.lblMainPrice.Text = combinationBuyandProductUnionInfo.MinCombinationPrice.F2ToString("f2");
                        this.lblMainPrice.Attributes["salePrice"] = combinationBuyandProductUnionInfo.MinSalePrice.F2ToString("f2");
                    }
                    combinationProductListByProductId.Remove(combinationBuyandProductUnionInfo);
                    if (combinationProductListByProductId != null && combinationProductListByProductId.Count > 0)
                    {
                        for (int i = 0; i < combinationProductListByProductId.Count; i++)
                        {
                            string thumbnailUrl = string.IsNullOrEmpty(combinationProductListByProductId[i].ThumbnailUrl100) ? this.sitesettings.DefaultProductThumbnail3 : combinationProductListByProductId[i].ThumbnailUrl100;
                            combinationProductListByProductId[i].ThumbnailUrl100 = thumbnailUrl;
                            combinationProductListByProductId[i].Index           = i + 1;
                        }
                        themedTemplatedRepeater.DataSource = combinationProductListByProductId;
                        themedTemplatedRepeater.DataBind();
                        this.hidShowCombinationBuy.Value = "1";
                    }
                }
            }
            return;

IL_0cd8:
            num2 = 1;
            goto IL_0cd9;
IL_0c9e:
            if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null)
            {
                num2 = (user.Referral.IsRepeled ? 1 : 0);
                goto IL_0cd9;
            }
            goto IL_0cd8;
        }