private void BindOrderPromotions()
        {
            DataTable productDetailOrderPromotions = PromoteHelper.GetProductDetailOrderPromotions();

            if (productDetailOrderPromotions.Rows.Count > 0)
            {
                this.divOrderPromotions.Visible = true;
                string text = string.Empty;
                foreach (DataRow row in productDetailOrderPromotions.Rows)
                {
                    text = text + row["Name"].ToNullString() + ",";
                }
                text = text.TrimEnd(',');
                this.ltlOrderPromotion.Text = text;
            }
            string phonePriceByProductId = PromoteHelper.GetPhonePriceByProductId(this.productId);

            if (!string.IsNullOrEmpty(phonePriceByProductId) && (this.sitesettings.OpenAliho == 1 || this.sitesettings.OpenMobbile == 1 || this.sitesettings.OpenVstore == 1 || this.sitesettings.OpenWap == 1))
            {
                this.divPhonePrice.Visible = true;
                string   s     = phonePriceByProductId.Split(',')[0];
                string[] array = this.lblBuyPrice.Text.Split('-');
                decimal  num   = decimal.Parse(array[0].Trim()) - decimal.Parse(s);
                this.litPhonePrice.Text        = ((num > decimal.Zero) ? num : decimal.Zero).F2ToString("f2");
                this.litPhonePriceEndDate.Text = phonePriceByProductId.Split(',')[1];
            }
        }
Ejemplo n.º 2
0
 private void ProductBusiness()
 {
     if (this.ProductInfo != null)
     {
         HtmlInputHidden htmlInputHidden = this.hidden_SKUSubmitOrderProductId;
         int             num             = this.ProductInfo.ProductId;
         htmlInputHidden.Value = num.ToString();
         this.SKUSubmitOrderSelector.ProductId = this.ProductInfo.ProductId;
         Dictionary <string, SKUItem> dictionary;
         if (this.PreSaleId == 0)
         {
             dictionary = ProductBrowser.GetProductSkuSaleInfo(this.ProductInfo.ProductId, 0);
         }
         else
         {
             if (this.productPreSaleInfo != null)
             {
                 this.lblSKUSubmitOrderPrePrice.Text = ((this.productPreSaleInfo.Deposit > decimal.Zero) ? this.productPreSaleInfo.Deposit.F2ToString("f2") : ((decimal)this.productPreSaleInfo.DepositPercent * this.ProductInfo.MinSalePrice / 100m).F2ToString("f2"));
             }
             else
             {
                 this.lblSKUSubmitOrderPrePrice.Text = "0";
             }
             HtmlInputHidden htmlInputHidden2 = this.hidden_SKUSubmitOrderDepositPercent;
             num = this.productPreSaleInfo.DepositPercent;
             htmlInputHidden2.Value = num.ToString();
             HtmlInputHidden htmlInputHidden3 = this.hidden_SKUSubmitOrderPreSaleId;
             num = this.PreSaleId;
             htmlInputHidden3.Value = num.ToString();
             dictionary             = ProductBrowser.GetPreSaleProductSkuSaleInfo(this.ProductInfo.ProductId);
         }
         if (dictionary != null)
         {
             this.imgSKUSubmitOrderProduct.ImageUrl = Globals.GetImageServerUrl("http://", string.IsNullOrEmpty(this.ProductInfo.ThumbnailUrl160) ? base.site.DefaultProductThumbnail4 : this.ProductInfo.ThumbnailUrl160);
             this.lblSKUSubmitOrderPrice.Text       = this.ProductInfo.MinSalePrice.F2ToString("f2");
             Label label = this.lblSKUSubmitOrderStockNow;
             num        = this.ProductInfo.Stock;
             label.Text = num.ToString();
             this.hidden_SKUSubmitOrderSelectedSkuId.Value   = this.ProductInfo.DefaultSku.SkuId;
             this.hidden_SKUSubmitOrderProductMinPrice.Value = MemberProcessor.GetMemberPrice(this.ProductInfo).F2ToString("f2");
             HtmlInputHidden htmlInputHidden4 = this.hidden_SKUSubmitOrderProductStock;
             num = this.ProductInfo.Stock;
             htmlInputHidden4.Value = num.ToString();
             if (this.PreSaleId == 0)
             {
                 string phonePriceByProductId = PromoteHelper.GetPhonePriceByProductId(this.ProductInfo.ProductId);
                 if (!string.IsNullOrEmpty(phonePriceByProductId))
                 {
                     string          s                = phonePriceByProductId.Split(',')[0];
                     decimal         num2             = (this.ProductInfo.MinSalePrice - decimal.Parse(s) > decimal.Zero) ? (this.ProductInfo.MinSalePrice - decimal.Parse(s)) : decimal.Zero;
                     HtmlInputHidden htmlInputHidden5 = this.hidden_SKUSubmitOrderProductMinPrice;
                     Label           label2           = this.lblSKUSubmitOrderPrice;
                     string          text3            = htmlInputHidden5.Value = (label2.Text = num2.F2ToString("f2"));
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
        private void BindOrderPromotions()
        {
            string phonePriceByProductId = PromoteHelper.GetPhonePriceByProductId(this.productId);
            StoreActivityEntityList storeActivityEntity = PromoteHelper.GetStoreActivityEntity(0, 0);

            if (storeActivityEntity.FullAmountReduceList.Count > 0)
            {
                HtmlGenericControl htmlGenericControl = this.divOrderPromotions;
                Literal            literal            = this.ltlOrderPromotion;
                bool visible = literal.Visible = true;
                htmlGenericControl.Visible = visible;
                string text = (from t in storeActivityEntity.FullAmountReduceList
                               select t.ActivityName).Aggregate((string t, string n) => t + "," + n);
                this.ltlOrderPromotion.Text = text;
            }
            string productPromotionsInfo = this.GetProductPromotionsInfo();

            if (!string.IsNullOrEmpty(productPromotionsInfo))
            {
                this.ltlPromotionSendGifts.Text = productPromotionsInfo;
                HtmlGenericControl htmlGenericControl2 = this.divOrderPromotions4;
                Literal            literal2            = this.ltlPromotionSendGifts;
                bool visible = literal2.Visible = true;
                htmlGenericControl2.Visible = visible;
            }
            if (storeActivityEntity.FullAmountSentGiftList.Count > 0 && storeActivityEntity.FullAmountSentGiftList.Count > 0)
            {
                string text2 = (from t in storeActivityEntity.FullAmountSentGiftList
                                select t.ActivityName).Aggregate((string t, string n) => t + "," + n);
                HtmlGenericControl htmlGenericControl3 = this.divOrderPromotions2;
                Literal            literal3            = this.ltlProductSendGifts;
                bool visible = literal3.Visible = true;
                htmlGenericControl3.Visible   = visible;
                this.ltlProductSendGifts.Text = text2;
            }
            if (storeActivityEntity.FullAmountSentFreightList.Count > 0)
            {
                HtmlGenericControl htmlGenericControl4 = this.divOrderPromotions3;
                Literal            literal4            = this.ltlOrderPromotion_free;
                bool visible = literal4.Visible = true;
                htmlGenericControl4.Visible = visible;
                string text3 = (from t in storeActivityEntity.FullAmountSentFreightList
                                select t.ActivityName).Aggregate((string t, string n) => t + "," + n);
                this.ltlOrderPromotion_free.Text = text3;
            }
        }
Ejemplo n.º 4
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.º 5
0
        private void ProcessProductSkus(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int       num         = context.Request["sourceId"].ToInt(0);
            int       productId   = int.Parse(context.Request["productId"], NumberStyles.None);
            int       attributeId = int.Parse(context.Request["AttributeId"], NumberStyles.None);
            int       valueId     = int.Parse(context.Request["ValueId"], NumberStyles.None);
            int       num2        = context.Request["StoreId"].ToInt(0);
            DataTable skuItems    = ShoppingProcessor.GetUnUpUnUpsellingSkus(productId, attributeId, valueId);

            if (skuItems == null || skuItems.Rows.Count == 0)
            {
                context.Response.Write("{\"Status\":\"1\"}");
            }
            else
            {
                skuItems.Columns.Add(new DataColumn
                {
                    ColumnName = "SalePrice",
                    DataType   = typeof(decimal)
                });
                bool flag = false;
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("fightgroup".ToLower()) && num > 0)
                {
                    IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(num);
                    if (fightGroupSkus.Count > 0)
                    {
                        flag = true;
                        for (int j = 0; j < skuItems.Rows.Count; j++)
                        {
                            DataRow           row = skuItems.Rows[j];
                            FightGroupSkuInfo fightGroupSkuInfo = (from c in fightGroupSkus
                                                                   where c.SkuId == row["SkuId"].ToString()
                                                                   select c).FirstOrDefault();
                            if (fightGroupSkuInfo == null)
                            {
                                string    skuId  = skuItems.Rows[j]["skuId"].ToString();
                                DataTable theSku = new SkuDao().GetTheSku(skuId);
                                if (theSku != null && theSku.Rows.Count > 0)
                                {
                                    skuItems.Rows[j]["Stock"]     = 0;
                                    skuItems.Rows[j]["SalePrice"] = theSku.Rows[0]["SalePrice"].ToDecimal(0).F2ToString("f2");
                                }
                            }
                            else
                            {
                                int totalCount  = fightGroupSkuInfo.TotalCount;
                                int boughtCount = fightGroupSkuInfo.BoughtCount;
                                int num3        = totalCount - boughtCount;
                                if (num3 > fightGroupSkuInfo.Stock)
                                {
                                    num3 = fightGroupSkuInfo.Stock;
                                }
                                decimal salePrice = fightGroupSkuInfo.SalePrice;
                                skuItems.Rows[j]["Stock"]     = ((num3 >= 0) ? num3 : 0);
                                skuItems.Rows[j]["SalePrice"] = salePrice.F2ToString("f2");
                            }
                        }
                    }
                }
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("countdown"))
                {
                    CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num, num2);
                    if (countDownInfo != null && countDownInfo.CountDownSkuInfo != null && countDownInfo.CountDownSkuInfo.Count > 0)
                    {
                        flag = true;
                        skuItems.Columns.Add(new DataColumn
                        {
                            ColumnName = "OldSalePrice",
                            DataType   = typeof(decimal)
                        });
                        List <CountDownSkuInfo> countDownSkuInfo = countDownInfo.CountDownSkuInfo;
                        int i;
                        for (i = 0; i < skuItems.Rows.Count; i++)
                        {
                            List <CountDownSkuInfo> list = (from s in countDownSkuInfo
                                                            where s.SkuId == skuItems.Rows[i]["SkuId"].ToNullString()
                                                            select s).ToList();
                            if (list == null || list.Count == 0)
                            {
                                string    skuId2  = list[0].SkuId.ToString();
                                DataTable theSku2 = new SkuDao().GetTheSku(skuId2);
                                if (theSku2 != null && theSku2.Rows.Count > 0)
                                {
                                    skuItems.Rows[i]["Stock"]        = 0;
                                    skuItems.Rows[i]["SalePrice"]    = theSku2.Rows[0]["SalePrice"].ToDecimal(0).F2ToString("f2");
                                    skuItems.Rows[i]["OldSalePrice"] = theSku2.Rows[0]["MarketPrice"].ToDecimal(0).F2ToString("f2");
                                }
                            }
                            else
                            {
                                int totalCount2  = list[0].TotalCount;
                                int boughtCount2 = list[0].BoughtCount;
                                int num4         = totalCount2 - boughtCount2;
                                skuItems.Rows[i]["Stock"] = ((num4 >= 0) ? num4 : 0);
                                decimal salePrice2   = list[0].SalePrice;
                                decimal oldSalePrice = list[0].OldSalePrice;
                                skuItems.Rows[i]["SalePrice"]    = salePrice2.F2ToString("f2");
                                skuItems.Rows[i]["OldSalePrice"] = oldSalePrice.F2ToString("f2");
                            }
                        }
                    }
                }
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("groupbuy"))
                {
                    GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num);
                    if (groupBuy != null)
                    {
                        flag = true;
                        skuItems.Columns.Add(new DataColumn
                        {
                            ColumnName = "OldSalePrice",
                            DataType   = typeof(decimal)
                        });
                        Dictionary <string, SKUItem> productSkuSaleInfo = ProductBrowser.GetProductSkuSaleInfo(productId, 0);
                        int soldCount = PromoteHelper.GetSoldCount(groupBuy.GroupBuyId);
                        for (int k = 0; k < skuItems.Rows.Count; k++)
                        {
                            DataRow dataRow = skuItems.Rows[k];
                            if (productSkuSaleInfo.ContainsKey(dataRow["SkuId"].ToNullString()))
                            {
                                SKUItem sKUItem = productSkuSaleInfo[dataRow["SkuId"].ToNullString()];
                                int     num5    = skuItems.Rows[k]["Stock"].ToInt(0);
                                int     num6    = groupBuy.MaxCount - soldCount;
                                if (num5 < num6)
                                {
                                    skuItems.Rows[k]["Stock"] = num5;
                                }
                                else
                                {
                                    skuItems.Rows[k]["Stock"] = num6;
                                }
                                skuItems.Rows[k]["SalePrice"]    = groupBuy.Price.F2ToString("f2");
                                skuItems.Rows[k]["OldSalePrice"] = sKUItem.SalePrice.F2ToString("f2");
                            }
                        }
                    }
                }
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("presaleproductdetails") && num > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(num);
                    if (productPreSaleInfo != null)
                    {
                        flag = true;
                        Dictionary <string, SKUItem> preSaleProductSkuSaleInfo = ProductBrowser.GetPreSaleProductSkuSaleInfo(productId);
                        foreach (DataRow row2 in skuItems.Rows)
                        {
                            if (preSaleProductSkuSaleInfo.ContainsKey(row2["SkuId"].ToString()))
                            {
                                SKUItem sKUItem2 = preSaleProductSkuSaleInfo[row2["SkuId"].ToString()];
                                row2["SalePrice"] = sKUItem2.SalePrice;
                                row2["Stock"]     = sKUItem2.Stock;
                            }
                        }
                    }
                }
                if (!flag)
                {
                    Dictionary <string, SKUItem> productSkuSaleInfo2 = ProductBrowser.GetProductSkuSaleInfo(productId, num2);
                    string text = "";
                    if (num2 == 0)
                    {
                        text = PromoteHelper.GetPhonePriceByProductId(productId);
                    }
                    foreach (DataRow row3 in skuItems.Rows)
                    {
                        if (productSkuSaleInfo2.ContainsKey(row3["SkuId"].ToString()))
                        {
                            SKUItem sKUItem3 = productSkuSaleInfo2[row3["SkuId"].ToString()];
                            if (!string.IsNullOrEmpty(text))
                            {
                                string  s2   = text.Split(',')[0];
                                decimal num7 = (sKUItem3.SalePrice - decimal.Parse(s2) > decimal.Zero) ? (sKUItem3.SalePrice - decimal.Parse(s2)) : decimal.Zero;
                                row3["SalePrice"] = num7.F2ToString("f2");
                            }
                            else
                            {
                                row3["SalePrice"] = sKUItem3.SalePrice;
                            }
                            row3["Stock"] = sKUItem3.Stock;
                        }
                        else
                        {
                            row3["Stock"]     = "0";
                            row3["SalePrice"] = "0.00";
                        }
                    }
                }
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("{");
                stringBuilder.Append("\"Status\":\"OK\",");
                stringBuilder.Append("\"SkuItems\":[");
                foreach (DataRow row4 in skuItems.Rows)
                {
                    stringBuilder.Append("{");
                    if (skuItems.Columns.Contains("SkuId"))
                    {
                        stringBuilder.AppendFormat("\"SkuId\":\"{0}\",", row4["SkuId"].ToString());
                    }
                    if (skuItems.Columns.Contains("SalePrice"))
                    {
                        stringBuilder.AppendFormat("\"SalePrice\":\"{0}\",", row4["SalePrice"].ToDecimal(0).F2ToString("f2"));
                    }
                    if (skuItems.Columns.Contains("OldSalePrice"))
                    {
                        stringBuilder.AppendFormat("\"OldSalePrice\":\"{0}\",", row4["OldSalePrice"].ToDecimal(0).F2ToString("f2"));
                    }
                    if (skuItems.Columns.Contains("Stock"))
                    {
                        stringBuilder.AppendFormat("\"Stock\":\"{0}\",", row4["Stock"].ToString());
                    }
                    stringBuilder.AppendFormat("\"AttributeId\":\"{0}\",", row4["AttributeId"].ToString());
                    stringBuilder.AppendFormat("\"ValueId\":\"{0}\"", row4["ValueId"].ToString());
                    stringBuilder.Append("},");
                }
                stringBuilder.Remove(stringBuilder.Length - 1, 1);
                stringBuilder.Append("]");
                stringBuilder.Append("}");
                context.Response.Write(stringBuilder.ToString());
            }
        }
Ejemplo n.º 6
0
        private void BindOrderPromotions()
        {
            string phonePriceByProductId = PromoteHelper.GetPhonePriceByProductId(this.productId);
            StoreActivityEntityList storeActivityEntity = PromoteHelper.GetStoreActivityEntity(0, this.productId);

            if (storeActivityEntity.FullAmountReduceList.Count > 0)
            {
                HtmlGenericControl htmlGenericControl = this.divOrderPromotions;
                Literal            literal            = this.ltlOrderPromotion;
                bool visible = literal.Visible = true;
                htmlGenericControl.Visible = visible;
                string text = (from t in storeActivityEntity.FullAmountReduceList
                               select t.ActivityName).Aggregate((string t, string n) => t + "," + n);
                this.ltlOrderPromotion.Text = text;
            }
            string productPromotionsInfo = this.GetProductPromotionsInfo();

            if (storeActivityEntity.FullAmountSentGiftList.Count > 0 || !string.IsNullOrEmpty(productPromotionsInfo))
            {
                if (storeActivityEntity.FullAmountSentGiftList.Count > 0)
                {
                    string text2 = (from t in storeActivityEntity.FullAmountSentGiftList
                                    select t.ActivityName).Aggregate((string t, string n) => t + "," + n);
                    HtmlGenericControl htmlGenericControl2 = this.divOrderPromotions2;
                    Literal            literal2            = this.ltlProductSendGifts;
                    bool visible = literal2.Visible = true;
                    htmlGenericControl2.Visible   = visible;
                    this.ltlProductSendGifts.Text = text2;
                }
                if (!string.IsNullOrEmpty(productPromotionsInfo))
                {
                    HtmlGenericControl htmlGenericControl3 = this.divOrderPromotions2;
                    Literal            literal3            = this.ltlProductSendGifts;
                    bool visible = literal3.Visible = true;
                    htmlGenericControl3.Visible = visible;
                    Literal literal4 = this.ltlProductSendGifts;
                    literal4.Text = literal4.Text + (string.IsNullOrEmpty(this.ltlProductSendGifts.Text) ? "" : ",") + productPromotionsInfo;
                }
            }
            if (storeActivityEntity.FullAmountSentFreightList.Count > 0)
            {
                HtmlGenericControl htmlGenericControl4 = this.divOrderPromotions3;
                Literal            literal5            = this.ltlOrderPromotion_free;
                bool visible = literal5.Visible = true;
                htmlGenericControl4.Visible = visible;
                string text3 = (from t in storeActivityEntity.FullAmountSentFreightList
                                select t.ActivityName).Aggregate((string t, string n) => t + "," + n);
                this.ltlOrderPromotion_free.Text = text3;
            }
            if (!string.IsNullOrEmpty(phonePriceByProductId) && (this.sitesettings.OpenAliho == 1 || this.sitesettings.OpenMobbile == 1 || this.sitesettings.OpenVstore == 1 || this.sitesettings.OpenWap == 1))
            {
                this.divPhonePrice.Visible = true;
                string   s     = phonePriceByProductId.Split(',')[0];
                string[] array = this.lblBuyPrice.Text.Split('-');
                decimal  num   = decimal.Parse(array[0].Trim()) - decimal.Parse(s);
                this.litPhonePrice.Text        = ((num > decimal.Zero) ? num : decimal.Zero).F2ToString("f2");
                this.litPhonePriceEndDate.Text = phonePriceByProductId.Split(',')[1];
            }
            else
            {
                this.divPhonePrice.Visible = false;
            }
        }