Esempio n. 1
0
        protected override void PageLoad()
        {
            ProductClassList = ProductClassBLL.ReadList();
            TopBanner        = AdImageBLL.ReadList((int)AdImageType.TopBanner).FirstOrDefault() ?? new AdImageInfo();

            hotKeyword = ShopConfig.ReadConfigInfo().HotKeyword;
            //productClassList = ProductClassBLL.ReadRootList();
            helpClassList = ArticleClassBLL.ReadChilds(ArticleClass.Help);
            bottomList    = ArticleBLL.ReadBottomList();

            topNavMenuList = NavMenuBLL.ReadList(true);
        }
Esempio n. 2
0
        protected override void PageLoad()
        {
            ProductClassList = ProductClassBLL.ReadList();
            TopBanner        = AdImageBLL.ReadList((int)AdImageType.TopBanner).FirstOrDefault() ?? new AdImageInfo();

            hotKeyword       = ShopConfig.ReadConfigInfo().HotKeyword;
            productClassList = ProductClassBLL.ReadRootList();
            helpClassList    = ArticleClassBLL.ReadChilds(ArticleClass.Help);
            bottomList       = ArticleBLL.ReadBottomList();

            strHistorySearch = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistorySearch"));

            textLinkList = LinkBLL.ReadLinkCacheListByClass((int)LinkType.Text);

            topNavMenuList = NavMenuBLL.ReadList(true);

            ReadCart();
        }
Esempio n. 3
0
        protected override void PageLoad()
        {
            base.PageLoad();

            var queryClass = RequestHelper.GetQueryString <string>("cat").Split(',');
            int classLevel1 = 0, classLevel2 = 0, classLevel3 = 0;

            if (queryClass.Length > 0)
            {
                classLevel1 = ShopCommon.ConvertToT <int>(queryClass[0]);
            }
            if (queryClass.Length > 1)
            {
                classLevel2 = ShopCommon.ConvertToT <int>(queryClass[1]);
            }
            if (queryClass.Length > 2)
            {
                classLevel3 = ShopCommon.ConvertToT <int>(queryClass[2]);
            }
            int currentClassId = classLevel3 > 0 ? classLevel3 : classLevel2 > 0 ? classLevel2 : classLevel1;

            if (currentClassId < 1)
            {
                ResponseHelper.Redirect("/");
            }

            if (classLevel1 > 0)
            {
                switch (classLevel1)
                {
                case 1:
                    topNav = 2;
                    break;

                case 2:
                    topNav = 3;
                    break;

                case 4:
                    topNav = 4;
                    break;

                case 6:
                    topNav = 5;
                    break;
                }
            }
            //面包屑区域--分类
            showClassList = ProductClassBLL.ReadList();
            currentClass  = showClassList.FirstOrDefault(k => k.Id == currentClassId) ?? new ProductClassInfo();
            levelClass.Add("level1", showClassList.FirstOrDefault(k => k.Id == classLevel1) ?? new ProductClassInfo());
            levelClass.Add("level2", showClassList.FirstOrDefault(k => k.Id == classLevel2) ?? new ProductClassInfo());
            levelClass.Add("level3", showClassList.FirstOrDefault(k => k.Id == classLevel3) ?? new ProductClassInfo());

            //热门商品
            int hotCount = 0;

            hotProductList = ProductBLL.SearchList(1, 7, new ProductSearchInfo {
                IsHot = (int)BoolType.True, IsSale = (int)BoolType.True
            }, ref hotCount);

            //商品列表
            currentPage = RequestHelper.GetQueryString <int>("Page");
            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int    pageSize = 15; int count = 0;
            string brandIds        = RequestHelper.GetQueryString <string>("brand");
            string attributeIds    = RequestHelper.GetQueryString <string>("at");
            string attributeValues = RequestHelper.GetQueryString <string>("ex");
            string orderField      = RequestHelper.GetQueryString <string>("sort");
            string orderType       = "";
            var    orderParams     = orderField.Split('_');

            if (orderParams.Length > 1)
            {
                orderField = orderParams[0];
                orderType  = orderParams[1];
            }
            int    minPrice  = RequestHelper.GetQueryString <int>("min");
            int    maxPrice  = RequestHelper.GetQueryString <int>("max");
            string keywords  = RequestHelper.GetQueryString <string>("kw");
            int    isNew     = RequestHelper.GetQueryString <int>("isNew");
            int    isHot     = RequestHelper.GetQueryString <int>("isHot");
            int    isSpecial = RequestHelper.GetQueryString <int>("isSpecial");
            int    isTop     = RequestHelper.GetQueryString <int>("isTop");

            productList = ProductBLL.SearchList(currentPage, pageSize, currentClassId, brandIds, attributeIds, attributeValues, orderField, orderType, minPrice, maxPrice, keywords, "", isNew, isHot, isSpecial, isTop, ref count, ref showAttributeList, ref showBrandList);

            pager.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile));
            //pager.CurrentPage = currentPage;
            //pager.PageSize = pageSize;
            //pager.Count = count;
            //pager.FirstPage = "<<首页";
            //pager.PreviewPage = "<<上一页";
            //pager.NextPage = "下一页>>";
            //pager.LastPage = "末页>>";
            //pager.ListType = false;
            //pager.DisCount = false;
            //pager.PrenextType = true;
            ProductClassInfo thisProductClass = new ProductClassInfo();

            if (classLevel3 > 0)
            {
                thisProductClass = ProductClassBLL.Read(classLevel3);
            }
            else if (classLevel2 > 0)
            {
                thisProductClass = ProductClassBLL.Read(classLevel2);
            }
            else
            {
                thisProductClass = ProductClassBLL.Read(classLevel1);
            }

            Title       = thisProductClass.PageTitle.Trim() == "" ? thisProductClass.Name : thisProductClass.PageTitle;
            Keywords    = thisProductClass.PageKeyWord.Trim() == "" ? thisProductClass.Name : thisProductClass.PageKeyWord;
            Description = thisProductClass.PageSummary.Trim() == "" ? thisProductClass.Remark : thisProductClass.PageSummary;
        }
Esempio n. 4
0
        protected override void PageLoad()
        {
            base.PageLoad();

            var queryClass = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("cat"))).Split(',');
            int classLevel1 = 0, classLevel2 = 0, classLevel3 = 0;

            if (queryClass.Length > 0)
            {
                classLevel1 = ShopCommon.ConvertToT <int>(queryClass[0]);
            }
            if (queryClass.Length > 1)
            {
                classLevel2 = ShopCommon.ConvertToT <int>(queryClass[1]);
            }
            if (queryClass.Length > 2)
            {
                classLevel3 = ShopCommon.ConvertToT <int>(queryClass[2]);
            }
            int currentClassId = classLevel3 > 0 ? classLevel3 : classLevel2 > 0 ? classLevel2 : classLevel1;

            if (currentClassId < 0)
            {
                currentClassId = 0;
            }
            //if (currentClassId < 1) ResponseHelper.Redirect("/");

            //面包屑区域--分类
            showClassList = ProductClassBLL.ReadList();
            currentClass  = showClassList.FirstOrDefault(k => k.Id == currentClassId) ?? new ProductClassInfo();
            levelClass.Add("level1", showClassList.FirstOrDefault(k => k.Id == classLevel1) ?? new ProductClassInfo());
            levelClass.Add("level2", showClassList.FirstOrDefault(k => k.Id == classLevel2) ?? new ProductClassInfo());
            levelClass.Add("level3", showClassList.FirstOrDefault(k => k.Id == classLevel3) ?? new ProductClassInfo());

            //热门商品
            int hotCount = 0;

            hotProductList = ProductBLL.SearchList(1, 7, new ProductSearchInfo {
                IsHot = (int)BoolType.True, IsSale = (int)BoolType.True
            }, ref hotCount);

            //商品列表
            currentPage = RequestHelper.GetQueryString <int>("Page");
            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int    pageSize = 6; int count = 0;
            string brandIds        = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("brand")));
            string attributeIds    = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("at")));
            string attributeValues = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("ex").Trim()));
            string orderField      = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("sort")));
            string orderType       = "";
            var    orderParams     = orderField.Split('_');

            if (orderParams.Length > 1)
            {
                orderField = orderParams[0];
                orderType  = orderParams[1];
            }
            int    minPrice = RequestHelper.GetQueryString <int>("min");
            int    maxPrice = RequestHelper.GetQueryString <int>("max");
            string keywords = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("kw")));

            #region 添加到搜索记录
            if (keywords != string.Empty)
            {
                var historySearch = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistorySearch"));
                if (("," + historySearch + ",").IndexOf("," + Server.UrlDecode(keywords) + ",") == -1)
                {
                    if (historySearch == "")
                    {
                        historySearch = Server.UrlDecode(keywords);
                    }
                    else
                    {
                        historySearch = Server.UrlDecode(keywords) + "," + historySearch;
                    }
                    if (historySearch.ToString().IndexOf(",") > -1)
                    {
                        if (historySearch.Split(',').Length > 8)
                        {
                            historySearch = historySearch.Substring(0, historySearch.LastIndexOf(","));
                        }
                    }
                    CookiesHelper.AddCookie("HistorySearch", Server.UrlEncode(historySearch));
                }
            }
            #endregion
            int isNew     = RequestHelper.GetQueryString <int>("isNew");
            int isHot     = RequestHelper.GetQueryString <int>("isHot");
            int isSpecial = RequestHelper.GetQueryString <int>("isSpecial");
            int isTop     = RequestHelper.GetQueryString <int>("isTop");

            productList = ProductBLL.SearchList(currentPage, pageSize, currentClassId, brandIds, attributeIds, attributeValues, orderField, orderType, minPrice, maxPrice, keywords, "", isNew, isHot, isSpecial, isTop, ref count, ref showAttributeList, ref showBrandList);

            //手机端特殊,显示所有当前产品类型下的品牌和属性,不会判断有无产品
            if (currentClassId > 0)
            {
                //取得当前分类所属类型
                ProductTypeInfo productType = ProductTypeBLL.Read(ProductClassBLL.Read(currentClassId).ProductTypeId);
                showBrandList     = ProductBrandBLL.ReadList(Array.ConvertAll <string, int>(productType.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)));
                showAttributeList = ProductTypeAttributeBLL.ReadList(productType.Id);
            }
            #region 添加热门关键词
            //如果有搜索结果且关键词不为空
            if (productList.Count > 0 && !string.IsNullOrEmpty(keywords))
            {
                var theSearchKey = HotSearchKeyBLL.Read(keywords);
                //之前没有则增加
                if (theSearchKey.Id <= 0)
                {
                    theSearchKey.Name        = keywords;
                    theSearchKey.SearchTimes = 1;
                    HotSearchKeyBLL.Add(theSearchKey);
                }
                else
                { //有则修改更新搜索次数
                    theSearchKey.SearchTimes += 1;
                    HotSearchKeyBLL.Update(theSearchKey);
                }
            }
            #endregion
            ProductClassInfo thisProductClass = new ProductClassInfo();
            if (classLevel3 > 0)
            {
                thisProductClass = ProductClassBLL.Read(classLevel3);
            }
            else if (classLevel2 > 0)
            {
                thisProductClass = ProductClassBLL.Read(classLevel2);
            }
            else
            {
                thisProductClass = ProductClassBLL.Read(classLevel1);
            }

            Title    = thisProductClass.PageTitle.Trim() == "" ? thisProductClass.Name : thisProductClass.PageTitle;
            Keywords = thisProductClass.PageKeyWord.Trim() == "" ? thisProductClass.Name : thisProductClass.PageKeyWord;
            //Description = thisProductClass.PageSummary.Trim() == "" ? thisProductClass.Remark : thisProductClass.PageSummary;
            Description = thisProductClass.PageSummary;
        }
Esempio n. 5
0
        protected override void PageLoad()
        {
            base.PageLoad();

            var queryClass = RequestHelper.GetQueryString <string>("cat").Split(',');
            int classLevel1 = 0, classLevel2 = 0, classLevel3 = 0;

            if (queryClass.Length > 0)
            {
                classLevel1 = ShopCommon.ConvertToT <int>(queryClass[0]);
            }
            if (queryClass.Length > 1)
            {
                classLevel2 = ShopCommon.ConvertToT <int>(queryClass[1]);
            }
            if (queryClass.Length > 2)
            {
                classLevel3 = ShopCommon.ConvertToT <int>(queryClass[2]);
            }
            int currentClassId = classLevel3 > 0 ? classLevel3 : classLevel2 > 0 ? classLevel2 : classLevel1;

            if (currentClassId < 1)
            {
                ResponseHelper.Redirect("/");
            }

            //面包屑区域--分类
            showClassList = ProductClassBLL.ReadList();
            currentClass  = showClassList.FirstOrDefault(k => k.Id == currentClassId) ?? new ProductClassInfo();
            levelClass.Add("level1", showClassList.FirstOrDefault(k => k.Id == classLevel1) ?? new ProductClassInfo());
            levelClass.Add("level2", showClassList.FirstOrDefault(k => k.Id == classLevel2) ?? new ProductClassInfo());
            levelClass.Add("level3", showClassList.FirstOrDefault(k => k.Id == classLevel3) ?? new ProductClassInfo());

            //热门商品
            int hotCount = 0;

            hotProductList = ProductBLL.SearchList(1, 7, new ProductSearchInfo {
                IsHot = (int)BoolType.True, IsSale = (int)BoolType.True
            }, ref hotCount);

            //商品列表
            currentPage = RequestHelper.GetQueryString <int>("Page");
            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int    pageSize = 24; int count = 0;
            string brandIds        = RequestHelper.GetQueryString <string>("brand");
            string attributeIds    = RequestHelper.GetQueryString <string>("at");
            string attributeValues = RequestHelper.GetQueryString <string>("ex");
            string orderField      = RequestHelper.GetQueryString <string>("sort");
            string orderType       = "";
            var    orderParams     = orderField.Split('_');

            if (orderParams.Length > 1)
            {
                orderField = orderParams[0];
                orderType  = orderParams[1];
            }
            int    minPrice  = RequestHelper.GetQueryString <int>("min");
            int    maxPrice  = RequestHelper.GetQueryString <int>("max");
            string keywords  = RequestHelper.GetQueryString <string>("kw");
            string isNew     = RequestHelper.GetQueryString <string>("isNew");
            string isHot     = RequestHelper.GetQueryString <string>("isHot");
            string isSpecial = RequestHelper.GetQueryString <string>("isSpecial");
            string isTop     = RequestHelper.GetQueryString <string>("isTop");

            //productList = ProductBLL.SearchList(currentPage, pageSize, 0, "", "", "", orderField, orderType, minPrice, maxPrice, keywords, isNew,isHot,isSpecial,isTop, ref count, ref showAttributeList, ref showBrandList);

            pager.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile));
        }
Esempio n. 6
0
        protected override void PageLoad()
        {
            base.PageLoad();

            var queryClass = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("cat"))).Split(',');
            int classLevel1 = 0, classLevel2 = 0, classLevel3 = 0;

            if (queryClass.Length > 0)
            {
                classLevel1 = ShopCommon.ConvertToT <int>(queryClass[0]);
            }
            if (queryClass.Length > 1)
            {
                classLevel2 = ShopCommon.ConvertToT <int>(queryClass[1]);
            }
            if (queryClass.Length > 2)
            {
                classLevel3 = ShopCommon.ConvertToT <int>(queryClass[2]);
            }
            int currentClassId = classLevel3 > 0 ? classLevel3 : classLevel2 > 0 ? classLevel2 : classLevel1;

            //if (currentClassId < 1) ResponseHelper.Redirect("/");
            if (currentClassId < 1)
            {
                currentClassId = 0;
            }

            if (classLevel1 > 0)
            {
                switch (classLevel1)
                {
                case 1:
                    topNav = 2;
                    break;

                case 2:
                    topNav = 3;
                    break;

                case 4:
                    topNav = 4;
                    break;

                case 6:
                    topNav = 5;
                    break;
                }
            }
            //面包屑区域--分类
            showClassList = ProductClassBLL.ReadList();
            currentClass  = showClassList.FirstOrDefault(k => k.Id == currentClassId) ?? new ProductClassInfo();
            levelClass.Add("level1", showClassList.FirstOrDefault(k => k.Id == classLevel1) ?? new ProductClassInfo());
            levelClass.Add("level2", showClassList.FirstOrDefault(k => k.Id == classLevel2) ?? new ProductClassInfo());
            levelClass.Add("level3", showClassList.FirstOrDefault(k => k.Id == classLevel3) ?? new ProductClassInfo());
            if (currentClassId < 1)
            {
                currentClassId = 0;
            }

            //热门商品
            int hotCount = 0;

            if (currentClassId > 0)
            {
                hotProductList = ProductBLL.SearchList(1, 5, new ProductSearchInfo {
                    IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsDelete = (int)BoolType.False, ClassId = "|" + currentClassId + "|"
                }, ref hotCount);
            }
            else
            {
                hotProductList = ProductBLL.SearchList(1, 5, new ProductSearchInfo {
                    IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsDelete = (int)BoolType.False
                }, ref hotCount);
            }


            //商品列表
            currentPage = RequestHelper.GetQueryString <int>("Page");
            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int    pageSize = 20; int count = 0;
            string brandIds        = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("brand")));
            string attributeIds    = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("at")));
            string attributeValues = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("ex")));
            string orderField      = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("sort")));
            string orderType       = "";
            var    orderParams     = orderField.Split('_');

            if (orderParams.Length > 1)
            {
                orderField = orderParams[0];
                orderType  = orderParams[1];
            }
            int minPrice = RequestHelper.GetQueryString <int>("min");
            int maxPrice = RequestHelper.GetQueryString <int>("max");

            keywords = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("kw")));
            string stf_Keyword = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("stf_Keyword")));

            if (!string.IsNullOrEmpty(stf_Keyword))
            {
                if (string.IsNullOrEmpty(keywords))
                {
                    keywords = stf_Keyword;
                }
            }
            int isNew     = RequestHelper.GetQueryString <int>("isNew");
            int isHot     = RequestHelper.GetQueryString <int>("isHot");
            int isSpecial = RequestHelper.GetQueryString <int>("isSpecial");
            int isTop     = RequestHelper.GetQueryString <int>("isTop");

            productList = ProductBLL.SearchList(currentPage, pageSize, currentClassId, brandIds, attributeIds, attributeValues, orderField, orderType, minPrice, maxPrice, keywords, stf_Keyword, isNew, isHot, isSpecial, isTop, ref count, ref showAttributeList, ref showBrandList);
            pagecount   = (int)Math.Round((double)(count + 0.1) / pageSize, 0);
            if (pagecount <= 0)
            {
                pagecount = 1;
            }
            pager.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile));
            pager.ShowType = 3;
            #region 如果没有查找到商品则显示RequestHelper.GetQueryString<string>("brand")获取的所有品牌
            if (count <= 0)
            {
                string[] _brandids     = brandIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                int[]    _showbrandids = Array.ConvertAll <string, int>(_brandids, s => Convert.ToInt32(s));
                showBrandList = ProductBrandBLL.ReadList(_showbrandids);
            }
            #endregion
            #region 添加热门关键词
            //如果有搜索结果且关键词不为空
            if (productList.Count > 0 && !string.IsNullOrEmpty(keywords))
            {
                var theSearchKey = HotSearchKeyBLL.Read(keywords);
                //之前没有则增加
                if (theSearchKey.Id <= 0)
                {
                    theSearchKey.Name        = StringHelper.AddSafe(HttpUtility.HtmlEncode(keywords));
                    theSearchKey.SearchTimes = 1;
                    HotSearchKeyBLL.Add(theSearchKey);
                }
                else
                { //有则修改更新搜索次数
                    theSearchKey.SearchTimes += 1;
                    HotSearchKeyBLL.Update(theSearchKey);
                }
            }
            #endregion
            if (classLevel3 > 0)
            {
                thisProductClass = ProductClassBLL.Read(classLevel3);
            }
            else if (classLevel2 > 0)
            {
                thisProductClass = ProductClassBLL.Read(classLevel2);
            }
            else
            {
                thisProductClass = ProductClassBLL.Read(classLevel1);
            }

            //浏览过的商品
            strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct"));
            if (strHistoryProduct.StartsWith(","))
            {
                strHistoryProduct = strHistoryProduct.Substring(1);
            }
            if (strHistoryProduct.EndsWith(","))
            {
                strHistoryProduct = strHistoryProduct.Substring(0, strHistoryProduct.Length - 1);
            }
            ProductSearchInfo productSearch = new ProductSearchInfo();
            productSearch.InProductId = strHistoryProduct;
            productSearch.IsSale      = 1;
            productSearch.IsDelete    = 0;
            tempProductList           = ProductBLL.SearchList(productSearch);

            Title    = thisProductClass.PageTitle.Trim() == "" ? thisProductClass.Name : thisProductClass.PageTitle;
            Keywords = thisProductClass.PageKeyWord.Trim() == "" ? thisProductClass.Name : thisProductClass.PageKeyWord;
            //Description = thisProductClass.PageSummary.Trim() == "" ? thisProductClass.Remark : thisProductClass.PageSummary;
            Description = thisProductClass.PageSummary;
        }
Esempio n. 7
0
 protected override void PageLoad()
 {
     ProductClassList = ProductClassBLL.ReadList();
     TopBanner        = AdImageBLL.ReadList((int)AdImageType.TopBanner).FirstOrDefault() ?? new AdImageInfo();
 }