コード例 #1
0
ファイル: VSubmmitOrder.cs プロジェクト: tyriankid/WFX
        public decimal DiscountMoney(IList <ShoppingCartItemInfo> infoList)
        {
            decimal   num  = 0M;
            decimal   num2 = 0M;
            decimal   num3 = 0M;
            DataTable type = ProductBrowser.GetType();

            for (int i = 0; i < type.Rows.Count; i++)
            {
                decimal num5 = 0M;
                foreach (ShoppingCartItemInfo info in infoList)
                {
                    if (!string.IsNullOrEmpty(info.MainCategoryPath) && ((int.Parse(type.Rows[i]["ActivitiesType"].ToString()) == int.Parse(info.MainCategoryPath.Split(new char[] { '|' })[0].ToString())) || (int.Parse(type.Rows[i]["ActivitiesType"].ToString()) == 0)))
                    {
                        num5 += info.SubTotal;
                    }
                }
                if (num5 != 0M)
                {
                    DataTable allFull = ProductBrowser.GetAllFull(int.Parse(type.Rows[i]["ActivitiesType"].ToString()));
                    if (allFull.Rows.Count > 0)
                    {
                        for (int j = 0; j < allFull.Rows.Count; j++)
                        {
                            if (num5 >= decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString()))
                            {
                                num2 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString());
                                num  = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["ReductionMoney"].ToString());
                                break;
                            }
                            if (num5 <= decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString()))
                            {
                                num2 = decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString());
                                num += decimal.Parse(allFull.Rows[0]["ReductionMoney"].ToString());
                                break;
                            }
                            if (num5 >= decimal.Parse(allFull.Rows[j]["MeetMoney"].ToString()))
                            {
                                num2 = decimal.Parse(allFull.Rows[j]["MeetMoney"].ToString());
                                num  = decimal.Parse(allFull.Rows[j]["ReductionMoney"].ToString());
                            }
                        }
                        if (num5 >= num2)
                        {
                            num3 += num;
                        }
                    }
                }
            }
            return(num3);
        }
コード例 #2
0
ファイル: ActivityHandler.cs プロジェクト: tyriankid/WFX
        /// <summary>
        /// 满减活动等打折活动
        /// </summary>
        /// <param name="order"></param>
        /// <param name="ActivitiesId"></param>
        /// <param name="ActivitiesName"></param>
        /// <returns></returns>
        public void getDiscountTotal(System.Web.HttpContext context)
        {
            ShoppingCartInfo shoppingCart;

            shoppingCart = ShoppingCartProcessor.GetShoppingCart(ManagerHelper.GetCurrentManager().UserId);
            OrderInfo order = ShoppingProcessor.ConvertShoppingCartToOrder(shoppingCart, false, false, false);

            if (null == order)
            {
                context.Response.Write("{\"success\":false,\"discount\":\"" + 0 + "\"}");
                return;
            }

            decimal      num          = new decimal(0);
            decimal      num1         = new decimal(0);
            decimal      num2         = new decimal(0);
            LineItemInfo lineItemInfo = new LineItemInfo();

            System.Data.DataTable type = ProductBrowser.GetType();
            for (int i = 0; i < type.Rows.Count; i++)
            {
                string  str      = "";
                string  str1     = "";
                decimal subTotal = new decimal(0);
                foreach (KeyValuePair <string, LineItemInfo> lineItem in order.LineItems)
                {
                    lineItemInfo = lineItem.Value;
                    if (string.IsNullOrEmpty(lineItemInfo.MainCategoryPath))
                    {
                        continue;
                    }
                    int    num3             = int.Parse(type.Rows[i]["ActivitiesType"].ToString());
                    string mainCategoryPath = lineItemInfo.MainCategoryPath;
                    char[] chrArray         = new char[] { '|' };
                    if (num3 == int.Parse(mainCategoryPath.Split(chrArray)[0].ToString()))
                    {
                        subTotal = subTotal + lineItemInfo.GetSubTotal();
                    }
                    if (int.Parse(type.Rows[i]["ActivitiesType"].ToString()) != 0)
                    {
                        continue;
                    }
                    subTotal = subTotal + lineItemInfo.GetSubTotal();
                }
                if (subTotal != new decimal(0))
                {
                    //获取所有活动列表
                    System.Data.DataTable allFull = ProductBrowser.GetAllFull(int.Parse(type.Rows[i]["ActivitiesType"].ToString()));



                    if (allFull.Rows.Count > 0)//如果存在活动时进入
                    {
                        //2017-2 如果活动实体类包含了门店id,那么该活动仅对当前门店生效,

                        int currentOrderStoreId    = Convert.ToInt32(context.Request["storeid"]); //当前订单的门店id
                        int currentActivityStoreId = 0;                                           //当前活动的门店id
                        int num0 = 0;

                        int num4 = 0;
                        while (true)
                        {
                            if (num4 >= allFull.Rows.Count)
                            {
                                break;
                            }

                            else if (subTotal >= decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString()))
                            {
                                num1 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString());
                                num  = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["ReductionMoney"].ToString());
                                currentActivityStoreId = int.TryParse(allFull.Rows[allFull.Rows.Count - 1]["storeid"].ToString(), out num0)?Convert.ToInt32(allFull.Rows[allFull.Rows.Count - 1]["storeid"]):num0;
                                str  = string.Concat(allFull.Rows[allFull.Rows.Count - 1]["ActivitiesId"].ToString(), ",");
                                str1 = string.Concat(allFull.Rows[allFull.Rows.Count - 1]["ActivitiesName"].ToString(), ",");
                                break;
                            }
                            else if (subTotal <= decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString()))
                            {
                                num1 = decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString());
                                num  = num + decimal.Parse(allFull.Rows[0]["ReductionMoney"].ToString());
                                currentActivityStoreId = int.TryParse(allFull.Rows[allFull.Rows.Count - 1]["storeid"].ToString(), out num0) ? Convert.ToInt32(allFull.Rows[allFull.Rows.Count - 1]["storeid"]) : num0;
                                str  = string.Concat(allFull.Rows[0]["ActivitiesId"].ToString(), ",");
                                str1 = string.Concat(allFull.Rows[0]["ActivitiesName"].ToString(), ",");
                                break;
                            }
                            else
                            {
                                if (subTotal >= decimal.Parse(allFull.Rows[num4]["MeetMoney"].ToString()))
                                {
                                    num1 = decimal.Parse(allFull.Rows[num4]["MeetMoney"].ToString());
                                    num  = decimal.Parse(allFull.Rows[num4]["ReductionMoney"].ToString());
                                    currentActivityStoreId = int.TryParse(allFull.Rows[allFull.Rows.Count - 1]["storeid"].ToString(), out num0) ? Convert.ToInt32(allFull.Rows[allFull.Rows.Count - 1]["storeid"]) : num0;
                                    str  = string.Concat(allFull.Rows[num4]["ActivitiesId"].ToString(), ",");
                                    str1 = string.Concat(allFull.Rows[num4]["ActivitiesName"].ToString(), ",");
                                }
                                num4++;
                            }
                        }
                        if (subTotal >= num1)
                        {
                            //如果当前门店id不等于当前活动门店id,返回0元,活动id与活动名为null
                            if (currentOrderStoreId != 0 && currentOrderStoreId != currentActivityStoreId)
                            {
                                context.Response.Write("{\"success\":false,\"discount\":\"" + 0 + "\"}");
                                return;
                            }

                            num2 = num2 + num;
                            foreach (KeyValuePair <string, LineItemInfo> keyValuePair in order.LineItems)
                            {
                                LineItemInfo value = keyValuePair.Value;
                                if (string.IsNullOrEmpty(value.MainCategoryPath))
                                {
                                    continue;
                                }
                                int    num5 = int.Parse(type.Rows[i]["ActivitiesType"].ToString());
                                string mainCategoryPath1 = value.MainCategoryPath;
                                char[] chrArray1         = new char[] { '|' };
                                if (num5 != int.Parse(mainCategoryPath1.Split(chrArray1)[0].ToString()) && int.Parse(type.Rows[i]["ActivitiesType"].ToString()) != 0)
                                {
                                    continue;
                                }
                                value.PromotionName = str1.Substring(0, str1.Length - 1);
                                value.PromotionId   = int.Parse(str.Substring(0, str.Length - 1));
                            }
                        }
                    }
                }
            }
            context.Response.Write("{\"success\":true,\"discount\":\"" + num2.ToString("F0") + "\"}");
            return;
        }
コード例 #3
0
ファイル: VDefault.cs プロジェクト: tyriankid/WFX
        protected override void AttachChildControls()
        {
            if (SettingsManager.GetMasterSettings(true).VTheme.ToLower() == "common")
            {
                this.Page.Response.Redirect("index.aspx");
                return;
            }
            this.rptCategories                = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.rptProducts                  = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptProducts.ItemDataBound   += new RepeaterItemEventHandler(this.rptProducts_ItemDataBound);
            this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound);
            this.img            = (HtmlImage)this.FindControl("imgDefaultBg");
            this.pager          = (Pager)this.FindControl("pager");
            this.litstorename   = (Literal)this.FindControl("litstorename");
            this.litdescription = (Literal)this.FindControl("litdescription");
            this.litattention   = (Literal)this.FindControl("litattention");
            this.imglogo        = (HiImage)this.FindControl("imglogo");
            if (CustomConfigHelper.Instance.IsLogoOn == "false")
            {
                imglogo.Visible = false;
            }
            this.litImgae      = (Literal)this.FindControl("litImgae");
            this.litActivity   = (Literal)this.FindControl("litActivity");//大图展示页面
            this.litItemParams = (Literal)this.FindControl("litItemParams");

            //店铺推广码送过来的地址(参数:ReferralId)
            if (string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralId"]))
            {
                //无传参,取COOKIE
                HttpCookie cookie = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value))
                {
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + cookie.Value);
                }
            }
            if (this.rptCategories.Visible)
            {
                DataTable brandCategories = CategoryBrowser.GetBrandCategories();
                this.itemcount = brandCategories.Rows.Count;
                if (brandCategories.Rows.Count > 0)
                {
                    this.rptCategories.DataSource = brandCategories;
                    this.rptCategories.DataBind();
                }
            }
            this.Page.Session["stylestatus"] = "3";
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            PageTitle.AddSiteNameTitle(masterSettings.SiteName);
            this.litstorename.Text   = masterSettings.SiteName;
            this.litdescription.Text = masterSettings.ShopIntroduction;
            if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
            {
                this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[] { '|' })[0];
            }
            if (base.referralId <= 0)
            {
                HttpCookie cookie2 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if ((cookie2 != null) && !string.IsNullOrEmpty(cookie2.Value))
                {
                    base.referralId = int.Parse(cookie2.Value);
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true);
                }
            }
            else
            {
                HttpCookie cookie3 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (((cookie3 != null) && !string.IsNullOrEmpty(cookie3.Value)) && (this.referralId.ToString() != cookie3.Value))
                {
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true);//跳转到自己的店铺
                }
            }
            IList <BannerInfo> allBanners = new List <BannerInfo>();

            allBanners = VshopBrowser.GetAllBanners();
            foreach (BannerInfo info in allBanners)
            {
                TplCfgInfo info2 = new NavigateInfo
                {
                    LocationType = info.LocationType,
                    Url          = info.Url
                };
                string loctionUrl = "javascript:";
                if (!string.IsNullOrEmpty(info.Url))
                {
                    loctionUrl = info2.LoctionUrl;
                }
                string text = this.litImgae.Text;
                this.litImgae.Text = text + "<li><a  id=\"ahref\" href='" + loctionUrl + "'><img src=\"" + info.ImageUrl + "\" title=\"" + info.ShortDesc + "\" alt=\"" + info.ShortDesc + "\" /></a></li>";
                //this.litActivity.Text = text + "<a  id=\"ahref\" href='" + loctionUrl + "'><img src=\"" + info.ImageUrl + "\" title=\"" + info.ShortDesc + "\" alt=\"" + info.ShortDesc + "\" /></a>";
            }
            if (allBanners.Count == 0)
            {
                this.litImgae.Text = "<li><a id=\"ahref\"  href='javascript:'><img src=\"/Utility/pics/default.jpg\" title=\"\"  /></a></li>";
            }


            DistributorsInfo userIdDistributors = new DistributorsInfo();

            userIdDistributors = DistributorsBrower.GetUserIdDistributors(base.referralId);
            if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
            {
                PageTitle.AddSiteNameTitle(userIdDistributors.StoreName);
                this.litdescription.Text = userIdDistributors.StoreDescription;
                this.litstorename.Text   = userIdDistributors.StoreName;
                if (!string.IsNullOrEmpty(userIdDistributors.Logo))
                {
                    this.imglogo.ImageUrl = userIdDistributors.Logo;
                }
                else if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
                {
                    this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[] { '|' })[0];
                }
                if (!string.IsNullOrEmpty(userIdDistributors.BackImage))
                {
                    this.litImgae.Text = "";
                    foreach (string str2 in userIdDistributors.BackImage.Split(new char[] { '|' }))
                    {
                        if (!string.IsNullOrEmpty(str2))
                        {
                            this.litImgae.Text = this.litImgae.Text + "<a ><img src=\"" + str2 + "\" title=\"\"  /></a>";
                        }
                    }
                }
            }
            this.dtpromotion = ProductBrowser.GetAllFull();
            if (this.rptProducts != null)
            {
                ProductQuery query = new ProductQuery
                {
                    PageSize  = this.pager.PageSize,
                    PageIndex = this.pager.PageIndex,
                    SortBy    = "DisplaySequence",
                    SortOrder = SortAction.Desc
                };
                //查询条件处理
                switch (SettingsManager.GetMasterSettings(true).VTheme.ToLower())
                {
                case "underwear":
                    this.pager.Visible = false;
                    query.PageSize     = 1000;
                    query.PageIndex    = 1;
                    query.SortBy       = "ShowSaleCounts";
                    query.SortOrder    = SortAction.Desc;
                    query.TypeId       = 1;
                    break;
                }
                DbQueryResult homeProduct = ProductBrowser.GetHomeProduct(MemberProcessor.GetCurrentMember(), query);
                this.rptProducts.DataSource = homeProduct.Data;
                this.rptProducts.DataBind();
                this.pager.TotalRecords = homeProduct.TotalRecords;
                if (this.pager.TotalRecords <= this.pager.PageSize)
                {
                    this.pager.Visible = false;
                }
            }

            if (this.img != null)
            {
                this.img.Src = new VTemplateHelper().GetDefaultBg();
            }
            if (!string.IsNullOrEmpty(masterSettings.GuidePageSet))
            {
                this.litattention.Text = masterSettings.GuidePageSet;
            }
            string str3 = "";

            if (!string.IsNullOrEmpty(masterSettings.ShopHomePic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.ShopHomePic;
            }
            string str4 = "";
            string str5 = (userIdDistributors == null) ? masterSettings.SiteName : userIdDistributors.StoreName;

            if (!string.IsNullOrEmpty(masterSettings.DistributorBackgroundPic))
            {
                str4 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[] { '|' })[0];
            }
            this.litItemParams.Text = str3 + "|" + masterSettings.ShopHomeName + "|" + masterSettings.ShopHomeDescription + "$";
            this.litItemParams.Text = string.Concat(new object[] { this.litItemParams.Text, str4, "|好店推荐之", str5, "商城|一个购物赚钱的好去处|", HttpContext.Current.Request.Url });

            int    userid         = 18;
            string userFomartCode = userid.ToString("000000000000000");

            LoadProductTop();
            getImgBanner();         //载入大图
            getMyCoupon();          //获取首页赠送优惠券
            InitDataByTheme();
            distributorVisitCont(); //更新店铺访问信息
        }
コード例 #4
0
 private void rptCartProducts_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
     {
         Literal literal  = (Literal)e.Item.Controls[0].FindControl("litpromotion");
         Literal literal1 = (Literal)e.Item.Controls[0].FindControl("litline");
         decimal num      = 0M;
         foreach (ShoppingCartInfo info in this.cart)
         {
             if (info.CategoryId == ((int)DataBinder.Eval(e.Item.DataItem, "CategoryId")))
             {
                 num += info.GetAmount();
             }
         }
         DataTable allFull = ProductBrowser.GetAllFull((int)DataBinder.Eval(e.Item.DataItem, "CategoryId"));
         string    str     = "";
         decimal   num2    = 0M;
         decimal   num3    = 0M;
         string    str2    = "";
         string    str3    = "";
         if (allFull.Rows.Count > 0)
         {
             for (int i = 0; i < allFull.Rows.Count; i++)
             {
                 if (num >= decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString()))
                 {
                     str  = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesName"].ToString();
                     num2 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString());
                     num3 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["ReductionMoney"].ToString());
                     str3 = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesType"].ToString();
                     str2 = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesId"].ToString();
                     break;
                 }
                 if (num <= decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString()))
                 {
                     str  = allFull.Rows[0]["ActivitiesName"].ToString();
                     num2 = decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString());
                     num3 = decimal.Parse(allFull.Rows[0]["ReductionMoney"].ToString());
                     str3 = allFull.Rows[0]["ActivitiesType"].ToString();
                     str2 = allFull.Rows[0]["ActivitiesId"].ToString();
                     break;
                 }
                 if (num >= decimal.Parse(allFull.Rows[i]["MeetMoney"].ToString()))
                 {
                     str  = allFull.Rows[i]["ActivitiesName"].ToString();
                     num2 = decimal.Parse(allFull.Rows[i]["MeetMoney"].ToString());
                     num3 = decimal.Parse(allFull.Rows[i]["ReductionMoney"].ToString());
                     str3 = allFull.Rows[i]["ActivitiesType"].ToString();
                     str2 = allFull.Rows[i]["ActivitiesId"].ToString();
                 }
             }
             if (allFull.Rows[0]["ActivitiesType"].ToString() != "0")
             {
                 literal.Text = "";
                 if (num >= num2)
                 {
                     string text = literal.Text;
                     literal.Text            = text + "<div class=\"price-sale\"><span class=\"title\">促销活动:</span><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=" + str2 + "&CategoryId=" + str3 + "\">" + str + "</a></span><span>已满" + num2.ToString("0") + "已减" + num3.ToString("0") + "</span></div>";
                     this.ReductionMoneyALL += num3;
                 }
                 else
                 {
                     string str5 = literal.Text;
                     literal.Text = str5 + "<div class=\"price-sale\"><span class=\"title\">促销活动:</span><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=" + str2 + "&CategoryId=" + str3 + "\">" + str + "</a></span><span>满" + num2.ToString("0") + "减" + num3.ToString("0") + "</span></div>";
                 }
                 this.litExemption.Text = this.ReductionMoneyALL.ToString("0.00");
             }
         }
         if (num == 0M)
         {
             literal.Text = "";
         }
     }
 }
コード例 #5
0
        private HtmlInputHidden specialHideShow;     //特殊客户屏蔽展示功能

        protected override void AttachChildControls()
        {
            this.rptCartProducts                = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.rptCartGifts                   = (VshopTemplatedRepeater)this.FindControl("rptCartGifts"); //礼品列表
            this.gifts                          = (HtmlControl)this.FindControl("gifts");                   //礼物板块
            this.products                       = (HtmlControl)this.FindControl("products");                //商品板块
            this.litTotalPoint                  = (Literal)this.FindControl("litTotalPoint");               //总积分
            this.litPointLeft                   = (Literal)this.FindControl("litPointLeft");                //剩余积分
            this.litTotalPoint.Text             = "0";
            this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound);
            this.rptCartGifts.ItemDataBound    += new RepeaterItemEventHandler(this.rptCartGifts_ItemDataBound);
            this.litTotal                       = (Literal)this.FindControl("litTotal");
            this.littext                        = (Literal)this.FindControl("littext");
            this.litStoreMoney                  = (Literal)this.FindControl("litStoreMoney");
            this.litExemption                   = (Literal)this.FindControl("litExemption");
            this.litcount                       = (Literal)this.FindControl("litcount");
            this.divShowTotal                   = (HtmlGenericControl)this.FindControl("divShowTotal");
            this.aLink                          = (HtmlAnchor)this.FindControl("aLink");
            this.specialHideShow                = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("specialHideShow");
            this.Page.Session["stylestatus"]    = "0";
            this.litExemption.Text              = "0.00";
            //this.cart = ShoppingCartProcessor.GetShoppingCartAviti();
            this.cart = ShoppingCartProcessor.GetShoppingCartList();//获取购物车信息
            int num = 0;

            //购物车数据源
            if (this.cart != null)
            {
                this.rptCartProducts.DataSource = this.cart;
                this.rptCartProducts.DataBind();
                for (int i = 0; i < this.cart.Count; i++)
                {
                    num += this.cart[i].GetQuantity();
                }
            }
            else
            {
                if (products != null)
                {
                    products.Visible = false;
                }
            }
            //绑定礼品数据
            if (cart != null && cart.Count > 0)
            {
                this.rptCartGifts.DataSource = cart;
                this.rptCartGifts.DataBind();
                for (int i = 0; i < this.cart.Count; i++)
                {
                    num += this.cart[i].GetGiftQuantity();
                }
            }
            else
            {
                if (gifts != null)
                {
                    gifts.Visible = false;
                }
            }
            this.litcount.Text = num.ToString();
            //传递爽爽挝啡的特殊名到前端,前端用jquery进行相应的功能隐藏
            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.AutoShipping)
            {
                specialHideShow.Value = "sswk";//爽爽挝啡
            }

            this.litTotal.Text = "¥" + "0.00";
            if (MemberProcessor.GetCurrentMember() != null)
            {
                //显示剩余积分
                this.litPointLeft.Text = MemberProcessor.GetCurrentMember().Points.ToString();
                decimal num3 = 0M;
                if (this.cart != null)
                {
                    foreach (ShoppingCartInfo info in this.cart)
                    {
                        num3 += info.GetAmount();
                    }
                }
                PageTitle.AddSiteNameTitle("购物车");
                DataTable allFull = ProductBrowser.GetAllFull(0);
                if (allFull.Rows.Count > 0)
                {
                    #region 获取相关活动
                    decimal num4 = 0M;
                    decimal num5 = 0M;
                    string  str  = "";
                    string  str2 = "";
                    string  str3 = "";
                    for (int j = 0; j < allFull.Rows.Count; j++)
                    {
                        if (num3 >= decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString()))
                        {
                            str  = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesName"].ToString();
                            num5 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString());
                            num4 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["ReductionMoney"].ToString());
                            str3 = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesType"].ToString();
                            str2 = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesId"].ToString();
                            break;
                        }
                        if (num3 <= decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString()))
                        {
                            str  = allFull.Rows[0]["ActivitiesName"].ToString();
                            num5 = decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString());
                            num4 = decimal.Parse(allFull.Rows[0]["ReductionMoney"].ToString());
                            str3 = allFull.Rows[0]["ActivitiesType"].ToString();
                            str2 = allFull.Rows[0]["ActivitiesId"].ToString();
                            break;
                        }
                        if (num3 >= decimal.Parse(allFull.Rows[j]["MeetMoney"].ToString()))
                        {
                            str  = allFull.Rows[j]["ActivitiesName"].ToString();
                            num5 = decimal.Parse(allFull.Rows[j]["MeetMoney"].ToString());
                            num4 = decimal.Parse(allFull.Rows[j]["ReductionMoney"].ToString());
                            str3 = allFull.Rows[j]["ActivitiesType"].ToString();
                            str2 = allFull.Rows[j]["ActivitiesId"].ToString();
                        }
                    }
                    this.littext.Text = "";
                    if (num3 >= num5)
                    {
                        string text = this.littext.Text;
                        this.littext.Text       = text + "<div id=\"cartProducts\" class=\"well shopcart\"><div class=\"price-sale\"><span class=\"title\">促销活动:</span><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=" + str2 + "&CategoryId=" + str3 + "\">" + str + "</a></span><span>已满" + num5.ToString("0") + "已减" + num4.ToString("0") + "</span></div></div>";
                        this.ReductionMoneyALL += num4;
                    }
                    else
                    {
                        string str5 = this.littext.Text;
                        this.littext.Text = str5 + "<div id=\"cartProducts\" class=\"well shopcart\"><div class=\"price-sale\"><span class=\"title\">促销活动:</span><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=" + str2 + "&CategoryId=" + str3 + "\">" + str + "</a></span><span>满" + num5.ToString("0") + "减" + num4.ToString("0") + "</span></div></div>";
                    }
                    this.litExemption.Text = this.ReductionMoneyALL.ToString("0.00");
                    if (num3 == 0M)
                    {
                        this.littext.Text = "";
                    }
                    #endregion
                }
                this.litStoreMoney.Text = "¥" + num3.ToString("0.00");
                this.litTotal.Text      = "¥" + ((num3 - this.ReductionMoneyALL)).ToString("0.00");
                //如果有gift,则需要提示需要支付的积分总额
                if (cart.Count > 0)
                {
                    this.litTotalPoint.Text = getTotalPoints().ToString() == "0" ? "0" : getTotalPoints().ToString();
                }

                //隐藏
                if (getTotalPoints() == 0)
                {
                    gifts.Visible = false;
                }
            }
        }
コード例 #6
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
            this.litActivities         = (Literal)this.FindControl("litActivities");
            this.litSalePrice          = (Literal)this.FindControl("litSalePrice");
            this.litMemberGradeInfo    = (Literal)this.FindControl("litMemberGradeInfo");
            this.litMarketPrice        = (Literal)this.FindControl("litMarketPrice");
            this.litShortDescription   = (Literal)this.FindControl("litShortDescription");
            this.litDescription        = (Literal)this.FindControl("litDescription");
            this.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            this.expandAttr            = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount          = (Literal)this.FindControl("litSoldCount");
            this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (Literal)this.FindControl("litReviewsCount");
            this.litHasCollected       = (HtmlInputHidden)this.FindControl("litHasCollected");
            this.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litproductid          = (HtmlInputHidden)this.FindControl("litproductid");
            this.specialHideShow       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("specialHideShow");
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

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

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

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

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

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

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

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

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

            if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
            }
            this.litItemParams.Text = string.Concat(new object[] { str3, "|", masterSettings.GoodsName, "|", masterSettings.GoodsDescription, "$", Globals.HostPath(HttpContext.Current.Request.Url), product.ImageUrl1, "|", this.litProdcutName.Text, "|", product.ShortDescription, "|", HttpContext.Current.Request.Url });
        }
コード例 #7
0
ファイル: VDefault.cs プロジェクト: 123456-cq/xkq34_src
        protected override void AttachChildControls()
        {
            HttpCookie cookie2;

            this.rptCategories                = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.rptProducts                  = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptProducts.ItemDataBound   += new RepeaterItemEventHandler(this.rptProducts_ItemDataBound);
            this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound);
            this.img            = (HtmlImage)this.FindControl("imgDefaultBg");
            this.pager          = (Pager)this.FindControl("pager");
            this.litstorename   = (Literal)this.FindControl("litstorename");
            this.litdescription = (Literal)this.FindControl("litdescription");
            this.litattention   = (Literal)this.FindControl("litattention");
            this.imglogo        = (HiImage)this.FindControl("imglogo");
            this.litImgae       = (Literal)this.FindControl("litImgae");
            this.litItemParams  = (Literal)this.FindControl("litItemParams");
            if (string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralId"]))
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (!((cookie == null) || string.IsNullOrEmpty(cookie.Value)))
                {
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + cookie.Value);
                }
            }
            if (this.rptCategories.Visible)
            {
                DataTable brandCategories = CategoryBrowser.GetBrandCategories();
                this.itemcount = brandCategories.Rows.Count;
                if (brandCategories.Rows.Count > 0)
                {
                    this.rptCategories.DataSource = brandCategories;
                    this.rptCategories.DataBind();
                }
            }
            this.Page.Session["stylestatus"] = "3";
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            PageTitle.AddSiteNameTitle(masterSettings.SiteName);
            this.litstorename.Text   = masterSettings.SiteName;
            this.litdescription.Text = masterSettings.ShopIntroduction;
            if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
            {
                this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[] { '|' })[0];
            }
            if (base.referralId <= 0)
            {
                cookie2 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (!((cookie2 == null) || string.IsNullOrEmpty(cookie2.Value)))
                {
                    base.referralId = int.Parse(cookie2.Value);
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true);
                }
            }
            else
            {
                cookie2 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (((cookie2 != null) && !string.IsNullOrEmpty(cookie2.Value)) && (this.referralId.ToString() != cookie2.Value))
                {
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true);
                }
            }
            IList <BannerInfo> allBanners = new List <BannerInfo>();

            allBanners = VshopBrowser.GetAllBanners();
            foreach (BannerInfo info in allBanners)
            {
                TplCfgInfo info2 = new NavigateInfo {
                    LocationType = info.LocationType,
                    Url          = info.Url
                };
                string loctionUrl = "javascript:";
                if (!string.IsNullOrEmpty(info.Url))
                {
                    loctionUrl = info2.LoctionUrl;
                }
                string text = this.litImgae.Text;
                this.litImgae.Text = text + "<a  id=\"ahref\" href='" + loctionUrl + "'><img src=\"" + info.ImageUrl + "\" title=\"" + info.ShortDesc + "\" alt=\"" + info.ShortDesc + "\" /></a>";
            }
            if (allBanners.Count == 0)
            {
                this.litImgae.Text = "<a id=\"ahref\"  href='javascript:'><img src=\"/Utility/pics/default.jpg\" title=\"\"  /></a>";
            }
            DistributorsInfo userIdDistributors = new DistributorsInfo();

            userIdDistributors = DistributorsBrower.GetUserIdDistributors(base.referralId);
            if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
            {
                PageTitle.AddSiteNameTitle(userIdDistributors.StoreName);
                this.litdescription.Text = userIdDistributors.StoreDescription;
                this.litstorename.Text   = userIdDistributors.StoreName;
                if (!string.IsNullOrEmpty(userIdDistributors.Logo))
                {
                    this.imglogo.ImageUrl = userIdDistributors.Logo;
                }
                else if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
                {
                    this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[] { '|' })[0];
                }
                if (!string.IsNullOrEmpty(userIdDistributors.BackImage))
                {
                    this.litImgae.Text = "";
                    foreach (string str2 in userIdDistributors.BackImage.Split(new char[] { '|' }))
                    {
                        if (!string.IsNullOrEmpty(str2))
                        {
                            this.litImgae.Text = this.litImgae.Text + "<a ><img src=\"" + str2 + "\" title=\"\"  /></a>";
                        }
                    }
                }
            }
            this.dtpromotion = ProductBrowser.GetAllFull();
            if (this.rptProducts != null)
            {
                ProductQuery query = new ProductQuery {
                    PageSize  = this.pager.PageSize,
                    PageIndex = this.pager.PageIndex,
                    SortBy    = "DisplaySequence",
                    SortOrder = SortAction.Desc
                };
                DbQueryResult homeProduct = ProductBrowser.GetHomeProduct(MemberProcessor.GetCurrentMember(), query);
                this.rptProducts.DataSource = homeProduct.Data;
                this.rptProducts.DataBind();
                this.pager.TotalRecords = homeProduct.TotalRecords;
                if (this.pager.TotalRecords <= this.pager.PageSize)
                {
                    this.pager.Visible = false;
                }
            }
            if (this.img != null)
            {
                this.img.Src = new VTemplateHelper().GetDefaultBg();
            }
            if (!string.IsNullOrEmpty(masterSettings.GuidePageSet))
            {
                this.litattention.Text = masterSettings.GuidePageSet;
            }
            if ((this.Page.Request.UserAgent.ToLower().Contains("alipay") && !string.IsNullOrEmpty(masterSettings.AliPayFuwuGuidePageSet)) && !string.IsNullOrEmpty(masterSettings.GuidePageSet))
            {
                this.litattention.Text = masterSettings.AliPayFuwuGuidePageSet;
            }
            string str4 = "";

            if (!string.IsNullOrEmpty(masterSettings.ShopHomePic))
            {
                str4 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.ShopHomePic;
            }
            string str5 = "";
            string str6 = (userIdDistributors == null) ? masterSettings.SiteName : userIdDistributors.StoreName;

            if (!string.IsNullOrEmpty(masterSettings.DistributorBackgroundPic))
            {
                str5 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[] { '|' })[0];
            }
            this.litItemParams.Text = str4 + "|" + masterSettings.ShopHomeName + "|" + masterSettings.ShopHomeDescription + "$";
            this.litItemParams.Text = string.Concat(new object[] { this.litItemParams.Text, str5, "|好店推荐之", str6, "商城|一个购物赚钱的好去处|", HttpContext.Current.Request.Url });
        }
コード例 #8
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
            this.litActivities         = (Literal)this.FindControl("litActivities");
            this.litSalePrice          = (Literal)this.FindControl("litSalePrice");
            this.litMarketPrice        = (Literal)this.FindControl("litMarketPrice");
            this.litShortDescription   = (Literal)this.FindControl("litShortDescription");
            this.litDescription        = (Literal)this.FindControl("litDescription");
            this.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            this.expandAttr            = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount          = (Literal)this.FindControl("litSoldCount");
            this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (Literal)this.FindControl("litReviewsCount");
            this.litHasCollected       = (HtmlInputHidden)this.FindControl("litHasCollected");
            this.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litproductid          = (HtmlInputHidden)this.FindControl("litproductid");
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

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

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

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

            if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
            }
            this.litItemParams.Text = string.Concat(new object[] { str3, "|", masterSettings.GoodsName, "|", masterSettings.GoodsDescription, "$", Globals.HostPath(HttpContext.Current.Request.Url), product.ImageUrl1, "|", this.litProdcutName.Text, "|", product.ShortDescription, "|", HttpContext.Current.Request.Url });
        }
コード例 #9
0
ファイル: VDefault.cs プロジェクト: zwkjgs/XKD
        protected override void AttachChildControls()
        {
            this.rptCategories                = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.rptProducts                  = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptProducts.ItemDataBound   += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptProducts_ItemDataBound);
            this.rptCategories.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptCategories_ItemDataBound);
            this.img            = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("imgDefaultBg");
            this.pager          = (Pager)this.FindControl("pager");
            this.litstorename   = (System.Web.UI.WebControls.Literal) this.FindControl("litstorename");
            this.litdescription = (System.Web.UI.WebControls.Literal) this.FindControl("litdescription");
            this.litattention   = (System.Web.UI.WebControls.Literal) this.FindControl("litattention");
            this.imglogo        = (HiImage)this.FindControl("imglogo");
            this.litImgae       = (System.Web.UI.WebControls.Literal) this.FindControl("litImgae");
            this.litItemParams  = (System.Web.UI.WebControls.Literal) this.FindControl("litItemParams");
            if (string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralId"]))
            {
                System.Web.HttpCookie httpCookie = System.Web.HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
                {
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + httpCookie.Value);
                }
            }
            if (this.rptCategories.Visible)
            {
                DataTable brandCategories = CategoryBrowser.GetBrandCategories();
                this.itemcount = brandCategories.Rows.Count;
                if (brandCategories.Rows.Count > 0)
                {
                    this.rptCategories.DataSource = brandCategories;
                    this.rptCategories.DataBind();
                }
            }
            this.Page.Session["stylestatus"] = "3";
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            PageTitle.AddSiteNameTitle(masterSettings.SiteName);
            this.litstorename.Text   = masterSettings.SiteName;
            this.litdescription.Text = masterSettings.ShopIntroduction;
            if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
            {
                this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[]
                {
                    '|'
                })[0];
            }
            if (this.referralId <= 0)
            {
                System.Web.HttpCookie httpCookie2 = System.Web.HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (httpCookie2 != null && !string.IsNullOrEmpty(httpCookie2.Value))
                {
                    this.referralId = int.Parse(httpCookie2.Value);
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true);
                }
            }
            else
            {
                System.Web.HttpCookie httpCookie2 = System.Web.HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (httpCookie2 != null && !string.IsNullOrEmpty(httpCookie2.Value) && this.referralId.ToString() != httpCookie2.Value)
                {
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true);
                }
            }
            System.Collections.Generic.IList <BannerInfo> list = new System.Collections.Generic.List <BannerInfo>();
            list = VshopBrowser.GetAllBanners();
            foreach (BannerInfo current in list)
            {
                TplCfgInfo tplCfgInfo = new NavigateInfo();
                tplCfgInfo.LocationType = current.LocationType;
                tplCfgInfo.Url          = current.Url;
                string text = "javascript:";
                if (!string.IsNullOrEmpty(current.Url))
                {
                    text = tplCfgInfo.LoctionUrl;
                }
                System.Web.UI.WebControls.Literal expr_3E2 = this.litImgae;
                string text2 = expr_3E2.Text;
                expr_3E2.Text = string.Concat(new string[]
                {
                    text2,
                    "<a  id=\"ahref\" href='",
                    text,
                    "'><img src=\"",
                    current.ImageUrl,
                    "\" title=\"",
                    current.ShortDesc,
                    "\" alt=\"",
                    current.ShortDesc,
                    "\" /></a>"
                });
            }
            if (list.Count == 0)
            {
                this.litImgae.Text = "<a id=\"ahref\"  href='javascript:'><img src=\"/Utility/pics/default.jpg\" title=\"\"  /></a>";
            }
            DistributorsInfo distributorsInfo = new DistributorsInfo();

            distributorsInfo = DistributorsBrower.GetUserIdDistributors(this.referralId);
            if (distributorsInfo != null && distributorsInfo.UserId > 0)
            {
                PageTitle.AddSiteNameTitle(distributorsInfo.StoreName);
                this.litdescription.Text = distributorsInfo.StoreDescription;
                this.litstorename.Text   = distributorsInfo.StoreName;
                if (!string.IsNullOrEmpty(distributorsInfo.Logo))
                {
                    this.imglogo.ImageUrl = distributorsInfo.Logo;
                }
                else if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
                {
                    this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[]
                    {
                        '|'
                    })[0];
                }
                if (!string.IsNullOrEmpty(distributorsInfo.BackImage))
                {
                    this.litImgae.Text = "";
                    string[] array = distributorsInfo.BackImage.Split(new char[]
                    {
                        '|'
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        string text3 = array[i];
                        if (!string.IsNullOrEmpty(text3))
                        {
                            System.Web.UI.WebControls.Literal expr_5D7 = this.litImgae;
                            expr_5D7.Text = expr_5D7.Text + "<a ><img src=\"" + text3 + "\" title=\"\"  /></a>";
                        }
                    }
                }
            }
            this.dtpromotion = ProductBrowser.GetAllFull();
            if (this.rptProducts != null)
            {
                ProductQuery productQuery = new ProductQuery();
                productQuery.PageSize  = this.pager.PageSize;
                productQuery.PageIndex = this.pager.PageIndex;
                productQuery.SortBy    = "DisplaySequence";
                productQuery.SortOrder = SortAction.Desc;
                DbQueryResult homeProduct = ProductBrowser.GetHomeProduct(MemberProcessor.GetCurrentMember(), productQuery);
                this.rptProducts.DataSource = homeProduct.Data;
                this.rptProducts.DataBind();
                this.pager.TotalRecords = homeProduct.TotalRecords;
                if (this.pager.TotalRecords <= this.pager.PageSize)
                {
                    this.pager.Visible = false;
                }
            }
            if (this.img != null)
            {
                this.img.Src = new VTemplateHelper().GetDefaultBg();
            }
            if (!string.IsNullOrEmpty(masterSettings.GuidePageSet))
            {
                this.litattention.Text = masterSettings.GuidePageSet;
            }
            string userAgent = this.Page.Request.UserAgent;

            if (userAgent.ToLower().Contains("alipay") && !string.IsNullOrEmpty(masterSettings.AliPayFuwuGuidePageSet))
            {
                if (!string.IsNullOrEmpty(masterSettings.GuidePageSet))
                {
                    this.litattention.Text = masterSettings.AliPayFuwuGuidePageSet;
                }
            }
            string text4 = "";

            if (!string.IsNullOrEmpty(masterSettings.ShopHomePic))
            {
                text4 = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + masterSettings.ShopHomePic;
            }
            string text5 = "";
            string text6 = (distributorsInfo == null) ? masterSettings.SiteName : distributorsInfo.StoreName;

            if (!string.IsNullOrEmpty(masterSettings.DistributorBackgroundPic))
            {
                text5 = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[]
                {
                    '|'
                })[0];
            }
            this.litItemParams.Text = string.Concat(new string[]
            {
                text4,
                "|",
                masterSettings.ShopHomeName,
                "|",
                masterSettings.ShopHomeDescription,
                "$"
            });
            this.litItemParams.Text = string.Concat(new object[]
            {
                this.litItemParams.Text,
                text5,
                "|好店推荐之",
                text6,
                "商城|一个购物赚钱的好去处|",
                System.Web.HttpContext.Current.Request.Url
            });
        }
コード例 #10
0
ファイル: VShoppingCart.cs プロジェクト: tyriankid/WFX
        protected override void AttachChildControls()
        {
            this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound);
            this.litTotal      = (Literal)this.FindControl("litTotal");
            this.littext       = (Literal)this.FindControl("littext");
            this.litStoreMoney = (Literal)this.FindControl("litStoreMoney");
            this.litExemption  = (Literal)this.FindControl("litExemption");
            this.litcount      = (Literal)this.FindControl("litcount");
            this.divShowTotal  = (HtmlGenericControl)this.FindControl("divShowTotal");
            this.aLink         = (HtmlAnchor)this.FindControl("aLink");
            this.Page.Session["stylestatus"] = "0";
            this.litExemption.Text           = "0.00";
            this.cart = ShoppingCartProcessor.GetShoppingCartAviti();
            if (this.cart != null)
            {
                this.rptCartProducts.DataSource = this.cart;
                this.rptCartProducts.DataBind();
                int num = 0;
                for (int i = 0; i < this.cart.Count; i++)
                {
                    num += this.cart[i].LineItems.Count;
                }
                this.litcount.Text = num.ToString();
            }
            decimal num3 = 0M;

            if (this.cart != null)
            {
                foreach (ShoppingCartInfo info in this.cart)
                {
                    num3 += info.GetAmount();
                }
            }
            PageTitle.AddSiteNameTitle("购物车");
            DataTable allFull = ProductBrowser.GetAllFull(0);

            if (allFull.Rows.Count > 0)
            {
                decimal num4 = 0M;
                decimal num5 = 0M;
                string  str  = "";
                string  str2 = "";
                string  str3 = "";
                for (int j = 0; j < allFull.Rows.Count; j++)
                {
                    if (num3 >= decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString()))
                    {
                        str  = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesName"].ToString();
                        num5 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString());
                        num4 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["ReductionMoney"].ToString());
                        str3 = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesType"].ToString();
                        str2 = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesId"].ToString();
                        break;
                    }
                    if (num3 <= decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString()))
                    {
                        str  = allFull.Rows[0]["ActivitiesName"].ToString();
                        num5 = decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString());
                        num4 = decimal.Parse(allFull.Rows[0]["ReductionMoney"].ToString());
                        str3 = allFull.Rows[0]["ActivitiesType"].ToString();
                        str2 = allFull.Rows[0]["ActivitiesId"].ToString();
                        break;
                    }
                    if (num3 >= decimal.Parse(allFull.Rows[j]["MeetMoney"].ToString()))
                    {
                        str  = allFull.Rows[j]["ActivitiesName"].ToString();
                        num5 = decimal.Parse(allFull.Rows[j]["MeetMoney"].ToString());
                        num4 = decimal.Parse(allFull.Rows[j]["ReductionMoney"].ToString());
                        str3 = allFull.Rows[j]["ActivitiesType"].ToString();
                        str2 = allFull.Rows[j]["ActivitiesId"].ToString();
                    }
                }
                this.littext.Text = "";
                if (num3 >= num5)
                {
                    string text = this.littext.Text;
                    this.littext.Text       = text + "<div id=\"cartProducts\" class=\"well shopcart\"><div class=\"price-sale\"><span class=\"title\">促销活动:</span><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=" + str2 + "&CategoryId=" + str3 + "\">" + str + "</a></span><span>已满" + num5.ToString("0") + "已减" + num4.ToString("0") + "</span></div></div>";
                    this.ReductionMoneyALL += num4;
                }
                else
                {
                    string str5 = this.littext.Text;
                    this.littext.Text = str5 + "<div id=\"cartProducts\" class=\"well shopcart\"><div class=\"price-sale\"><span class=\"title\">促销活动:</span><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=" + str2 + "&CategoryId=" + str3 + "\">" + str + "</a></span><span>满" + num5.ToString("0") + "减" + num4.ToString("0") + "</span></div></div>";
                }
                this.litExemption.Text = this.ReductionMoneyALL.ToString("0.00");
                if (num3 == 0M)
                {
                    this.littext.Text = "";
                }
            }
            this.litStoreMoney.Text = "¥" + num3.ToString("0.00");
            this.litTotal.Text      = "¥" + ((num3 - this.ReductionMoneyALL)).ToString("0.00");
        }