Пример #1
0
 private void InitDataByTheme()
 {
     switch (SettingsManager.GetMasterSettings(true).VTheme.ToLower())
     {
     case "underwear":    //内衣
         this.ShopName = (Literal)this.FindControl("ShopName");
         if (Globals.GetCurrentDistributorId() != 0)
         {
             this.ShopName.Text = DistributorsBrower.GetDistributorInfo(Globals.GetCurrentDistributorId()).StoreName;
         }
         if (this.imglogo.ImageUrl.Equals("/Utility/pics/headLogo.jpg"))
         {
             this.imglogo.ImageUrl = "/Templates/vshop/underwear/images/LOGO.jpg";
         }
         this.rptCategories1            = (VshopTemplatedRepeater)this.FindControl("rptCategories1");
         this.rptCategories1.DataSource = CategoryBrowser.GetCategoriesByPruductType(4, 2);   //根据ProductType查询分类
         this.rptCategories1.DataBind();
         this.rptCategories2            = (VshopTemplatedRepeater)this.FindControl("rptCategories2");
         this.rptCategories3            = (VshopTemplatedRepeater)this.FindControl("rptCategories3");
         this.rptCategories3.DataSource = CategoryBrowser.GetCategoriesByPruductType(12, 1);   //根据ProductType查询分类
         this.rptCategories3.DataBind();
         this.rptCategories4            = (VshopTemplatedRepeater)this.FindControl("rptCategories4");
         this.rptCategories4.DataSource = CategoryBrowser.GetCategoriesByPruductType(11, 4);   //根据ProductType查询分类
         this.rptCategories4.DataBind();
         this.rptProductqqg = (VshopTemplatedRepeater)this.FindControl("rptProductqqg");
         ProductQuery query = new ProductQuery
         {
             PageSize  = 6,
             PageIndex = 1,
             SortBy    = "ShowSaleCounts",
             SortOrder = SortAction.Desc,
             TypeId    = 2
         };
         this.rptProductqqg.DataSource = ProductBrowser.GetHomeProduct(MemberProcessor.GetCurrentMember(), query).Data;
         this.rptProductqqg.DataBind();
         DataTable dt = ProductBrowser.GetHomeProductTop(0, ProductInfo.ProductTop.New);
         this.ProductCount = (Literal)this.FindControl("ProductCount");
         ProductCount.Text = dt.Rows[0][0] + "";
         this.Gonggao      = (Literal)this.FindControl("Gonggao");
         IList <ArticleInfo> artlist = CommentBrowser.GetArticleList(4, 1);
         if (artlist.Count > 0)
         {
             this.Gonggao.Text = artlist[0].Content;
         }
         this.Erweima = (Literal)this.FindControl("Erweima");
         if (Globals.GetCurrentDistributorId() == 0)
         {
             this.Erweima.Text = "<li><a href='QRcode.aspx?ReferralId='><i><img src='/Templates/vshop/underwear/images/iconfont-erweima.png' /></i><p>二维码</p></a></li>";
         }
         else
         {
             this.Erweima.Text = "<li><a href='QRcode.aspx?ReferralId=" + Globals.GetCurrentDistributorId() + "'><i><img src='/Templates/vshop/underwear/images/iconfont-erweima.png' /></i><p>二维码</p></a></li>";
         }
         break;
     }
     ;
 }
Пример #2
0
        protected override void AttachChildControls()
        {
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.keyWord       = this.Page.Request.QueryString["keyWord"];
            this.imgUrl        = (HiImage)this.FindControl("imgUrl");
            this.litContent    = (Literal)this.FindControl("litContent");
            this.rptProducts   = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptCategories = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.Page.Session["stylestatus"] = "4";
            switch (Hidistro.Core.SettingsManager.GetMasterSettings(true).VTheme.ToLower())
            {
            case "common":
                DataTable dt = CategoryBrowser.GetCategoriesRange(ProductInfo.ProductRanage.NormalSelect);
                this.rptCategories.DataSource = dt;
                this.rptCategories.DataBind();
                int total = 0;
                if (categoryId == 0)
                {
                    if (dt.Rows.Count > 0)
                    {
                        int FirstCategoryID = Convert.ToInt32(dt.Rows[0]["categoryId"]);
                        this.rptProducts.DataSource = ProductBrowser.GetProducts(MemberProcessor.GetCurrentMember(), null, 0, FirstCategoryID, this.keyWord, 1, 200, out total, "ShowSaleCounts", "desc");
                        this.rptProducts.DataBind();
                    }
                }
                else
                {
                    this.rptProducts.DataSource = ProductBrowser.GetProducts(MemberProcessor.GetCurrentMember(), null, 0, categoryId, this.keyWord, 1, 200, out total, "ShowSaleCounts", "desc");
                    this.rptProducts.DataBind();
                }
                break;

            default:
                this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound);
                if (this.Page.Request.QueryString["TypeId"] != null)
                {
                    this.rptCategories.DataSource = CategoryBrowser.GetCategoriesByPruductType(100, Convert.ToInt32(this.Page.Request.QueryString["TypeId"]));
                    this.rptCategories.DataBind();
                }
                else
                {
                    IList <CategoryInfo> maxSubCategories = CategoryBrowser.GetMaxSubCategoriesRange(this.categoryId, 0x3e8, DistributorsBrower.GetCurrStoreProductRange());
                    this.rptCategories.DataSource = maxSubCategories;
                    this.rptCategories.DataBind();
                }

                PageTitle.AddSiteNameTitle("分类搜索页");
                break;
            }
        }
Пример #3
0
        public int managerId;          //当前pc端点餐管理员id

        protected override void AttachChildControls()
        {
            if (!Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.AnonymousOrder)
            {
                GotoResourceNotFound("pc点餐功能暂未开启!");
            }
            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["Id"]))
            {
                System.Web.HttpCookie cookie = new System.Web.HttpCookie("Vshop-Manager")
                {
                    Value   = this.Page.Request.QueryString["Id"].ToString(),
                    Expires = System.DateTime.Now.AddDays(1.0)
                };
                System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
            }


            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.keyWord                 = this.Page.Request.QueryString["keyWord"];
            this.imgUrl                  = (HiImage)this.FindControl("imgUrl");
            this.litContent              = (Literal)this.FindControl("litContent");
            this.rptProducts             = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptCategories           = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.litCategoryId           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litCategoryId");
            this.txtTotal                = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtTotal");
            this.defaultShippingtype     = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("defaultShippingtype");
            this.txtStoreId              = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtStoreId");
            this.txtThirdWayDiscountInfo = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtThirdWayDiscountInfo");
            this.litBuyToGive            = (Literal)this.FindControl("litBuyToGive");
            this.litHalf                 = (Literal)this.FindControl("litHalf");//第二杯半价
            this.litOrderList            = (Literal)this.FindControl("litOrderList");
            this.litCategoryId.SetWhenIsNotNull(this.categoryId.ToString());
            this.Page.Session["stylestatus"] = "4";
            this.litStoreName = (Literal)this.FindControl("litStoreName");

            //获取所有活动列表
            //this.dtpromotion = ProductBrowser.GetAllFull();
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            this.txtThirdWayDiscountInfo.Value = masterSettings.thirdWayDiscountInfo;

            //获取当前点餐门店信息
            ManagerInfo currentManager = ManagerHelper.GetCurrentManager();

            storeId               = currentManager.ClientUserId;
            litStoreName.Text     = ManagerHelper.GetStoreName(storeId);
            this.txtStoreId.Value = this.storeId.ToString();

            switch (Hidistro.Core.SettingsManager.GetMasterSettings(true).VTheme.ToLower())
            {
            case "common":
            case "hotel":
                //this.rptProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptProducts_ItemDataBound);

                DataTable dtProducts = new DataTable();                               //商品dt
                DataTable dt         = CategoryBrowser.GetCategoriesByRange(rangeId); //CategoryBrowser.GetCategoriesRange(ProductInfo.ProductRanage.All);
                int       total      = 0;
                int       num;
                int       num2;
                if (!int.TryParse(this.Page.Request.QueryString["page"], out num))
                {
                    num = 1;
                }
                if (!int.TryParse(this.Page.Request.QueryString["size"], out num2))
                {
                    num2 = 16;
                }
                if (categoryId == 0)
                {
                    if (dt.Rows.Count > 0)
                    {
                        //获取第一个分类id
                        int FirstCategoryID = Convert.ToInt32(dt.Rows[0]["categoryId"]);
                        this.litCategoryId.SetWhenIsNotNull(FirstCategoryID.ToString());
                        //匿名点餐情况下,商品为总店的所有商品,用户则是匿名用户(无需登录)

                        dtProducts = ProductBrowser.GetProducts(MemberProcessor.GetAnonymousMember(this.Page.Request.QueryString["type"].ToString()), null, 0, FirstCategoryID, this.keyWord, num, num2, out total, "ShowSaleCounts", "desc", "", rangeId, storeId);
                    }
                }
                else
                {
                    dtProducts = ProductBrowser.GetProducts(MemberProcessor.GetAnonymousMember(this.Page.Request.QueryString["type"].ToString()), null, 0, categoryId, this.keyWord, num, num2, out total, "ShowSaleCounts", "desc", "", rangeId, storeId);
                }
                //绑定购物车的信息
                this.cart = ShoppingCartProcessor.GetShoppingCartAviti(Globals.GetCurrentManagerUserId());

                //根据商品id判断是否包含其余规格,如果有,则新增一个字段存入规格号
                dtProducts.Columns.Add("skuCounts");
                foreach (DataRow row in dtProducts.Rows)
                {
                    DataTable skus = ProductBrowser.GetSkus(Convert.ToInt32(row["ProductId"]));
                    row["skuCounts"] = skus.Rows.Count;
                }

                this.rptProducts.DataSource = dtProducts;
                this.rptProducts.DataBind();

                if (!dt.Columns.Contains("PType"))
                {
                    dt.Columns.Add("PType", typeof(string));
                }
                foreach (DataRow dr in dt.Rows)
                {
                    dr["PType"] = this.Page.Request.QueryString["type"];
                }
                this.rptCategories.DataSource = dt;
                this.rptCategories.DataBind();



                if (cart != null)
                {
                    this.litOrderList.Text = "";
                    //根据购物车的信息绑定左侧点单列表的信息
                    foreach (ShoppingCartInfo cartInfo in cart)
                    {
                        foreach (ShoppingCartItemInfo info in cartInfo.LineItems)
                        {
                            this.litOrderList.Text += string.Format(@"<li><span>{4}</span><div class='guige'><d type='skuName'>{8}</d><b style='display:none'>{3}</b>{7}</div>
                                                <span>
                                                    <a id='spSub_{0}' class='shopcart-minus'>-</a>
                                                    <input type='tel' id='buyNum_{0}' class='form-control' value='{2}' disabled='disabled' />
                                                    <input type='hidden' id='skuid_{1}' value='{1}'/>
                                                    <a id='spAdd_{0}' class='shopcart-add'>+</a>
                                                    <input type='hidden' id='giveNum' value='{5}'/>
                                                    <input type='hidden' id='halfNum' value='{6}'/>
                                                </span></li>
                                                ", info.ProductId, info.SkuId, info.Quantity, info.AdjustedPrice.ToString("F2"), info.Name, info.GiveQuantity, info.HalfPriceQuantity, info.GiveQuantity <= 0 ? (info.HalfPriceQuantity <= 0 ? "" : "(半价" + info.HalfPriceQuantity + ")") : "(送" + info.GiveQuantity + ")", skuContentFormat(info.SkuContent));
                        }
                    }
                }
                this.txtTotal.SetWhenIsNotNull(total.ToString());
                break;

            default:
                this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound);
                if (this.Page.Request.QueryString["TypeId"] != null)
                {
                    this.rptCategories.DataSource = CategoryBrowser.GetCategoriesByPruductType(100, Convert.ToInt32(this.Page.Request.QueryString["TypeId"]));
                    this.rptCategories.DataBind();
                }
                else
                {
                    IList <CategoryInfo> maxSubCategories = CategoryBrowser.GetMaxSubCategoriesRange(this.categoryId, 0x3e8, DistributorsBrower.GetCurrStoreProductRange());
                    this.rptCategories.DataSource = maxSubCategories;
                    this.rptCategories.DataBind();
                }

                PageTitle.AddSiteNameTitle("电脑点餐");
                break;
            }

            if (masterSettings.BuyOrGive)
            {
                this.litBuyToGive.Text = "<a id=\"btnGiveBuy\" class=\"account-all\" onclick=\"BuyGive()\">买一送一</a>";
            }
            if (masterSettings.BuyOrHalf)
            {
                this.litHalf.Text = "<a id=\"btnHalf\" class=\"account-all\" onclick=\"BuyHalf()\">第二杯半价</a>";
            }

            IList <ShippingModeInfo> shippingmodesList = SalesHelper.GetShippingModes();

            this.defaultShippingtype.Value = shippingmodesList[0].ModeId.ToString();
        }
Пример #4
0
        public int rangeId = 1;//范围id 1:pc端,0:微信端,


        protected override void AttachChildControls()
        {
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.keyWord            = this.Page.Request.QueryString["keyWord"];
            this.imglogo            = (HiImage)this.FindControl("imglogo");
            this.litTitle           = (Literal)this.FindControl("litTitle");
            this.litDes             = (Literal)this.FindControl("litDes");
            this.litMemberGradeInfo = (Literal)this.FindControl("litMemberGradeInfo");
            this.imgUrl             = (HiImage)this.FindControl("imgUrl");
            this.litContent         = (Literal)this.FindControl("litContent");
            this.rptProducts        = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptCategories      = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.litCategoryId      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litCategoryId");
            this.litCategoryId.SetWhenIsNotNull(this.categoryId.ToString());
            this.Page.Session["stylestatus"] = "4";

            this.storeId = !string.IsNullOrEmpty(this.Page.Request.QueryString["storeid"]) ? int.Parse(this.Page.Request.QueryString["storeid"]) : 0;

            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember == null)
            {
                this.Page.Response.Redirect("UserLogin.aspx");
            }
            HttpCookie cookie         = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
            int        ReferralUserId = 0;

            if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value))
            {
                ReferralUserId = Convert.ToInt32(cookie.Value);
            }

            Hidistro.Entities.Members.DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(ReferralUserId);
            Hidistro.Core.Entities.SiteSettings        masterSettings     = Hidistro.Core.SettingsManager.GetMasterSettings(false);
            //店铺logo
            if (userIdDistributors != null && !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 (ReferralUserId == 0)//如果没有上级店铺
            {
                this.litTitle.Text = masterSettings.SiteName;
                this.litDes.Text   = masterSettings.ShopIntroduction;
            }
            else
            {
                this.litTitle.Text = userIdDistributors.StoreName;
                this.litDes.Text   = userIdDistributors.StoreDescription;
            }

            //会员等级优惠信息
            if (this.litMemberGradeInfo != null)
            {
                MemberGradeInfo gradeInfo = MemberHelper.GetMemberGrade(currentMember.GradeId);//会员等级信息
                string          gradeName = gradeInfo.Name;
                string          currentMemberGradeName = (currentMember == null) ? "" :
                                                         string.Format("<span style='font-size:12px; background:#F90; color:#FFF; border-radius:3px; padding:3px 5px; margin-right:5px;'>{0}</span>"
                                                                       , gradeName);
                if (gradeInfo.Discount < 100)
                {
                    litMemberGradeInfo.Text = string.Format("{0}以下商品已获得{1}%折扣!", currentMemberGradeName, 100 - gradeInfo.Discount);
                }
                else
                {
                    litMemberGradeInfo.Text = string.Format("{0}以下商品均无打折", currentMemberGradeName, 100 - gradeInfo.Discount);;
                }
            }
            switch (Hidistro.Core.SettingsManager.GetMasterSettings(true).VTheme.ToLower())
            {
            case "common":
            case "hotel":
                Hidistro.Core.HiCache.Remove("DataCache-CategoriesRange");    //清除分类缓存
                //获取手机端所有商品的分类
                DataTable dt = CategoryBrowser.GetCategoriesByRange(rangeId); //CategoryBrowser.GetCategoriesRange(ProductInfo.ProductRanage.NormalSelect);

                int       total = 0;
                DataTable dt2   = new DataTable();
                if (categoryId == 0)
                {
                    if (dt.Rows.Count > 0)
                    {
                        //获取手机端商品的第一个分类id
                        int FirstCategoryID = Convert.ToInt32(dt.Rows[0]["categoryId"]);
                        this.litCategoryId.SetWhenIsNotNull(FirstCategoryID.ToString());

                        dt2 = ProductBrowser.GetProducts(MemberProcessor.GetCurrentMember(), null, 0, FirstCategoryID, this.keyWord, 1, 20, out total, "ShowSaleCounts", "desc", "", rangeId, storeId);
                    }
                }
                else
                {
                    dt2 = ProductBrowser.GetProducts(MemberProcessor.GetCurrentMember(), null, 0, categoryId, this.keyWord, 1, 20, out total, "ShowSaleCounts", "desc", "", rangeId, storeId);
                }
                //根据商品id判断是否包含其余规格,如果有,则新增一个字段存入规格号
                dt2.Columns.Add("skuCounts");
                dt2.Columns.Add("Quantity");
                List <Hidistro.Entities.Sales.ShoppingCartInfo> cart = ShoppingCartProcessor.GetShoppingCartList();   //获取购物车信息
                foreach (DataRow row in dt2.Rows)
                {
                    DataTable skus = ProductBrowser.GetSkus(Convert.ToInt32(row["ProductId"]));
                    row["skuCounts"] = skus.Rows.Count;
                    row["Quantity"]  = 0;
                    //根据商品id获取购物车中已存在的数量,防止页面刷新后选中的数量遗失
                    foreach (Hidistro.Entities.Sales.ShoppingCartInfo info in cart)
                    {
                        foreach (Hidistro.Entities.Sales.ShoppingCartItemInfo itemInfo in info.LineItems)
                        {
                            if (Convert.ToInt32(row["ProductId"]) == itemInfo.ProductId)
                            {
                                row["Quantity"] = itemInfo.Quantity;
                            }
                        }
                    }
                }
                this.rptCategories.DataSource = dt;
                this.rptCategories.DataBind();

                this.rptProducts.DataSource = dt2;
                this.rptProducts.DataBind();
                break;

            default:
                this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound);
                if (this.Page.Request.QueryString["TypeId"] != null)
                {
                    this.rptCategories.DataSource = CategoryBrowser.GetCategoriesByPruductType(100, Convert.ToInt32(this.Page.Request.QueryString["TypeId"]));
                    this.rptCategories.DataBind();
                }
                else
                {
                    IList <CategoryInfo> maxSubCategories = CategoryBrowser.GetMaxSubCategoriesRange(this.categoryId, 0x3e8, DistributorsBrower.GetCurrStoreProductRange());
                    this.rptCategories.DataSource = maxSubCategories;
                    this.rptCategories.DataBind();
                }
                PageTitle.AddSiteNameTitle("移动点餐");
                break;
            }
        }