Exemple #1
0
        private void BindCombinaBuyInfo()
        {
            List <CombinationBuyandProductUnionInfo> combinationProductListByProductId = CombinationBuyHelper.GetCombinationProductListByProductId(this.productId);

            if (combinationProductListByProductId == null || combinationProductListByProductId.Count > 1)
            {
                CombinationBuyandProductUnionInfo combinationBuyandProductUnionInfo = combinationProductListByProductId.FirstOrDefault((CombinationBuyandProductUnionInfo c) => c.ProductId == this.productId);
                if (combinationBuyandProductUnionInfo != null)
                {
                    string text = string.IsNullOrEmpty(combinationBuyandProductUnionInfo.ThumbnailUrl180) ? HiContext.Current.SiteSettings.DefaultProductImage : combinationBuyandProductUnionInfo.ThumbnailUrl180;
                    this.ltlcombinamaininfo.Text = "<div class=\"pic\"><a href=\"CombinationBuyDetail.aspx?combinaId=" + combinationBuyandProductUnionInfo.CombinationId + "\"><img src=\"" + text + "\"></a></div><div class=\"price\"> <a href=\"CombinationBuyDetail.aspx?combinaId=" + combinationBuyandProductUnionInfo.CombinationId + "\"><label><b>¥" + combinationBuyandProductUnionInfo.MinCombinationPrice + "</b></label></a></div>";
                    this.hidCombinaid.Value      = combinationBuyandProductUnionInfo.CombinationId.ToString();
                    this.divcombina.Visible      = true;
                    combinationProductListByProductId.Remove(combinationBuyandProductUnionInfo);
                    this.rp_com.DataSource = combinationProductListByProductId;
                    this.rp_com.DataBind();
                    return;
                }
            }
            this.divcombina.Visible = false;
        }
        public void GetProductAttrList()
        {
            int num = 0;

            int.TryParse(this.context.Request["CombinationId"], out num);
            string text = this.context.Request["ProductIds"];

            if (num != 0 && !string.IsNullOrEmpty(text))
            {
                if (HiContext.Current.UserId == 0)
                {
                    this.context.Response.ContentType = "text/json";
                    this.context.Response.Write("{\"error\":\"noLogin\"}");
                }
                else
                {
                    StringBuilder stringBuilder  = new StringBuilder();
                    SiteSettings  masterSettings = SettingsManager.GetMasterSettings();
                    stringBuilder.Append("[");
                    DataTable combinationProducts = CombinationBuyHelper.GetCombinationProducts(num, text);
                    for (int i = 0; i < combinationProducts.Rows.Count; i++)
                    {
                        stringBuilder.Append("{");
                        stringBuilder.AppendFormat("\"ProductId\":\"{0}\",", combinationProducts.Rows[i]["ProductId"]);
                        stringBuilder.AppendFormat("\"ProductName\":\"{0}\",", combinationProducts.Rows[i]["ProductName"]);
                        string arg = string.IsNullOrEmpty(combinationProducts.Rows[i]["ThumbnailUrl40"].ToString()) ? masterSettings.DefaultProductThumbnail1 : combinationProducts.Rows[i]["ThumbnailUrl40"].ToString();
                        stringBuilder.AppendFormat("\"ThumbnailUrl40\":\"{0}\",", arg);
                        string arg2 = string.IsNullOrEmpty(combinationProducts.Rows[i]["ThumbnailUrl100"].ToString()) ? masterSettings.DefaultProductThumbnail3 : combinationProducts.Rows[i]["ThumbnailUrl100"].ToString();
                        stringBuilder.AppendFormat("\"ThumbnailUrl100\":\"{0}\",", arg2);
                        stringBuilder.AppendFormat("\"MinCombinationPrice\":\"{0}\",", combinationProducts.Rows[i]["MinCombinationPrice"]);
                        stringBuilder.AppendFormat("\"AllStock\":\"{0}\",", combinationProducts.Rows[i]["AllStock"]);
                        stringBuilder.AppendFormat("\"SingleSkuId\":\"{0}\",", combinationProducts.Rows[i]["SingleSkuId"]);
                        int       productId          = int.Parse(combinationProducts.Rows[i]["ProductId"].ToString());
                        DataTable skuItemByProductId = CombinationBuyHelper.GetSkuItemByProductId(productId);
                        if (skuItemByProductId != null && skuItemByProductId.Rows.Count > 0)
                        {
                            stringBuilder.Append("\"details\":[");
                            for (int j = 0; j < skuItemByProductId.Rows.Count; j++)
                            {
                                stringBuilder.Append("{");
                                stringBuilder.AppendFormat("\"SkuId\":\"{0}\",", skuItemByProductId.Rows[j]["SkuId"]);
                                stringBuilder.AppendFormat("\"AttributeId\":\"{0}\",", skuItemByProductId.Rows[j]["AttributeId"]);
                                stringBuilder.AppendFormat("\"AttributeName\":\"{0}\",", skuItemByProductId.Rows[j]["AttributeName"]);
                                stringBuilder.AppendFormat("\"UseAttributeImage\":\"{0}\",", skuItemByProductId.Rows[j]["UseAttributeImage"]);
                                stringBuilder.AppendFormat("\"ValueId\":\"{0}\",", skuItemByProductId.Rows[j]["ValueId"]);
                                stringBuilder.AppendFormat("\"ValueStr\":\"{0}\",", skuItemByProductId.Rows[j]["ValueStr"]);
                                stringBuilder.AppendFormat("\"ImageUrl\":\"{0}\",", skuItemByProductId.Rows[j]["ImageUrl"]);
                                stringBuilder.AppendFormat("\"ThumbnailUrl40\":\"{0}\",", skuItemByProductId.Rows[j]["ThumbnailUrl40"]);
                                stringBuilder.AppendFormat("\"ThumbnailUrl410\":\"{0}\"", skuItemByProductId.Rows[j]["ThumbnailUrl410"]);
                                if (j == skuItemByProductId.Rows.Count - 1)
                                {
                                    stringBuilder.Append("}");
                                }
                                else
                                {
                                    stringBuilder.Append("},");
                                }
                            }
                            stringBuilder.Append("]");
                        }
                        else
                        {
                            stringBuilder.Append("\"details\":[]");
                        }
                        if (i == combinationProducts.Rows.Count - 1)
                        {
                            stringBuilder.Append("}");
                        }
                        else
                        {
                            stringBuilder.Append("},");
                        }
                    }
                    stringBuilder.Append("]");
                    this.context.Response.ContentType = "text/json";
                    this.context.Response.Write(stringBuilder);
                }
            }
        }
        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;
        }
Exemple #4
0
        private void btnAddCoupons_Click(object sender, EventArgs e)
        {
            int num = 0;

            int.TryParse(this.hidCombinationId.Value, out num);
            if (num == 0)
            {
                this.ShowMsg("请重新编辑!", false);
            }
            else
            {
                int num2 = 0;
                int.TryParse(this.hidMainProductId.Value, out num2);
                if (num2 <= 0)
                {
                    this.ShowMsg("请选择主商品!", false);
                }
                else if (string.IsNullOrEmpty(this.hidOtherProductIds.Value))
                {
                    this.ShowMsg("请至少选择一个组合商品!", false);
                }
                else
                {
                    DateTime dateTime;
                    DateTime now;
                    if (this.hidEditType.Value != "2")
                    {
                        if (!this.calendarStartDate.SelectedDate.HasValue)
                        {
                            this.ShowMsg("请选择开始日期!", false);
                            return;
                        }
                        dateTime = this.calendarStartDate.SelectedDate.Value;
                        now      = DateTime.Now;
                        if (dateTime.CompareTo(DateTime.Parse(now.ToString("yyyy-MM-dd"))) < 0)
                        {
                            this.ShowMsg("开始日期不能早于当前时间!", false);
                            return;
                        }
                    }
                    if (!this.calendarEndDate.SelectedDate.HasValue)
                    {
                        this.ShowMsg("请选择结束日期!", false);
                    }
                    else
                    {
                        dateTime = this.calendarStartDate.SelectedDate.Value;
                        if (dateTime.CompareTo(this.calendarEndDate.SelectedDate.Value) > 0)
                        {
                            this.ShowMsg("开始日期不能晚于结束日期!", false);
                        }
                        else
                        {
                            dateTime = this.calendarEndDate.SelectedDate.Value;
                            now      = DateTime.Now;
                            if (dateTime.CompareTo(DateTime.Parse(now.ToString("yyyy-MM-dd"))) < 0)
                            {
                                this.ShowMsg("结束日期不能早于当前时间!", false);
                            }
                            else
                            {
                                List <CombinationBuySKUInfo> items = JsonHelper.ParseFormJson <List <CombinationBuySKUInfo> >(this.hidSubmitData.Value);
                                CombinationBuyInfo           combinationBuyInfo = new CombinationBuyInfo();
                                combinationBuyInfo.CombinationId   = num;
                                combinationBuyInfo.OtherProductIds = this.hidOtherProductIds.Value;
                                CombinationBuyInfo combinationBuyInfo2 = combinationBuyInfo;
                                dateTime = this.calendarStartDate.SelectedDate.Value;
                                combinationBuyInfo2.StartDate = dateTime.Date;
                                CombinationBuyInfo combinationBuyInfo3 = combinationBuyInfo;
                                dateTime = this.calendarEndDate.SelectedDate.Value;
                                dateTime = dateTime.Date;
                                dateTime = dateTime.AddDays(1.0);
                                combinationBuyInfo3.EndDate      = dateTime.AddSeconds(-1.0);
                                combinationBuyInfo.MainProductId = num2;
                                if (CombinationBuyHelper.UpdateCombinationBuy(combinationBuyInfo, items))
                                {
                                    this.ShowMsg("编辑组合购活动成功!", true, "CombinationBuy.aspx");
                                }
                                else
                                {
                                    this.ShowMsg("编辑失败!", false);
                                }
                            }
                        }
                    }
                }
            }
        }
        private void SetControlsValue(int productId)
        {
            List <CombinationBuyandProductUnionInfo> combinationProductListByProductId = CombinationBuyHelper.GetCombinationProductListByProductId(productId);

            if (combinationProductListByProductId == null || combinationProductListByProductId.Count > 1)
            {
                CombinationBuyandProductUnionInfo combinationBuyandProductUnionInfo = combinationProductListByProductId.FirstOrDefault((CombinationBuyandProductUnionInfo c) => c.ProductId == productId);
                if (combinationBuyandProductUnionInfo != null)
                {
                    string text = string.Empty;
                    for (int i = 0; i < combinationProductListByProductId.Count; i++)
                    {
                        text = text + combinationProductListByProductId[i].ProductId + ",";
                    }
                    this.hidproductid.Value        = productId.ToString();
                    this.litMasterproductname.Text = "<a href=\"ProductDetails.aspx?ProductId=" + combinationBuyandProductUnionInfo.ProductId + "\">" + combinationBuyandProductUnionInfo.ProductName + "</a>";
                    Literal literal = this.litMasterprice;
                    decimal num     = combinationBuyandProductUnionInfo.MinCombinationPrice;
                    literal.Text = num.ToString();
                    Literal  literal2 = this.litMasterproductpic;
                    string[] obj      = new string[5]
                    {
                        "<a href=\"ProductDetails.aspx?ProductId=",
                        null,
                        null,
                        null,
                        null
                    };
                    int num2 = combinationBuyandProductUnionInfo.ProductId;
                    obj[1]        = num2.ToString();
                    obj[2]        = "\" class=\"cart_1\"><img src=\"";
                    obj[3]        = (string.IsNullOrEmpty(combinationBuyandProductUnionInfo.ThumbnailUrl180) ? HiContext.Current.SiteSettings.DefaultProductImage : combinationBuyandProductUnionInfo.ThumbnailUrl180);
                    obj[4]        = "\"></a>";
                    literal2.Text = string.Concat(obj);
                    Literal literal3 = this.litMastersaleprice;
                    num           = combinationBuyandProductUnionInfo.MinSalePrice;
                    literal3.Text = num.ToString();
                    this.AllSkus  = CombinationBuyHelper.GetSkus(text.Substring(0, text.Length - 1));
                    if (!combinationBuyandProductUnionInfo.HasSKU)
                    {
                        this.selectmainsku.Visible        = false;
                        this.hidmasterproducthassku.Value = "0";
                        this.hidmasterselectsku.Value     = productId + "_0";
                    }
                    else
                    {
                        this.hidmasterselectsku.Value     = "0";
                        this.hidmasterproducthassku.Value = "1";
                        Common_ComBinaSKUSelector common_ComBinaSKUSelector = new Common_ComBinaSKUSelector();
                        common_ComBinaSKUSelector.ProductId           = combinationBuyandProductUnionInfo.ProductId;
                        common_ComBinaSKUSelector.MinCombinationPrice = combinationBuyandProductUnionInfo.MinCombinationPrice;
                        common_ComBinaSKUSelector.TotalStock          = combinationBuyandProductUnionInfo.Totalstock;
                        common_ComBinaSKUSelector.ThumbnailUrl180     = combinationBuyandProductUnionInfo.ThumbnailUrl180;
                        common_ComBinaSKUSelector.Skus = this.AllSkus.Select("productId = " + productId);
                        this.Controls.Add(common_ComBinaSKUSelector);
                    }
                    HtmlInputHidden htmlInputHidden = this.hidmasterstock;
                    num2 = combinationBuyandProductUnionInfo.Totalstock;
                    htmlInputHidden.Value = num2.ToString();
                    HtmlInputHidden htmlInputHidden2 = this.hidcombinaid;
                    num2 = combinationBuyandProductUnionInfo.CombinationId;
                    htmlInputHidden2.Value = num2.ToString();
                    combinationProductListByProductId.Remove(combinationBuyandProductUnionInfo);
                    this.rptcombinaproduct.DataSource = combinationProductListByProductId;
                    this.rptcombinaproduct.DataBind();
                    this.AllSkus.Dispose();
                }
                else
                {
                    this.ShowWapMessage("活动已结束或不存在", "ProductDetails.aspx?productId=" + productId);
                }
            }
            else
            {
                this.ShowWapMessage("活动已结束或不存在", "ProductDetails.aspx?productId=" + productId);
            }
        }