Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int classId   = RequestHelper.GetQueryString <int>("classId");
            int productId = RequestHelper.GetQueryString <int>("productId");

            var cls = ProductClassBLL.Read(classId);

            attributeList = ProductTypeAttributeBLL.JoinAttribute(cls.ProductTypeId, productId);
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int classId   = RequestHelper.GetQueryString <int>("classId");
            int productId = RequestHelper.GetQueryString <int>("productId");

            var cls = ProductClassBLL.Read(classId);

            standardList = ProductTypeStandardBLL.ReadList(cls.ProductTypeId);

            if (productId > 0)
            {
                standardRecordList = ProductTypeStandardRecordBLL.ReadList(productId);
            }
        }
Пример #3
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                FatherID.DataSource     = ProductClassBLL.ReadNamedList();
                FatherID.DataTextField  = "Name";
                FatherID.DataValueField = "ID";
                FatherID.DataBind();
                FatherID.Items.Insert(0, new ListItem("作为最大类", "0"));
                //foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                //{
                //    FatherID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                //}
                //FatherID.Items.Insert(0, new ListItem("作为最大类", "0"));

                ProductType.DataSource     = ProductTypeBLL.ReadList();
                ProductType.DataTextField  = "Name";
                ProductType.DataValueField = "ID";
                ProductType.DataBind();
                ProductType.Items.Insert(0, new ListItem("请选择类型", "0"));

                int productClassID = RequestHelper.GetQueryString <int>("ID");
                int fatherID       = RequestHelper.GetQueryString <int>("FatherID");
                if (productClassID != int.MinValue)
                {
                    CheckAdminPower("ReadProductClass", PowerCheckType.Single);
                    ProductClassInfo productClass = ProductClassBLL.Read(productClassID);
                    FatherID.Text     = productClass.ParentId.ToString();
                    OrderID.Text      = productClass.OrderId.ToString();
                    ClassName.Text    = productClass.Name;
                    Keywords.Text     = productClass.Keywords;
                    Description.Value = productClass.Remark;
                    Photo.Text        = productClass.Photo;
                    ProductType.Text  = productClass.ProductTypeId.ToString();

                    EnClassName.Text = productClass.EnClassName;
                    PageTitle.Text   = productClass.PageTitle;
                    PageKeyWord.Text = productClass.PageKeyWord;
                    PageSummary.Text = productClass.PageSummary;
                }
                else
                {
                    FatherID.Text = fatherID.ToString();
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 根据商品分类逐级获取分类的Remark(售后服务)
        /// </summary>
        /// <param name="classId">商品分类</param>
        /// <returns></returns>
        protected string GetProductClassRemark(string classId)
        {
            string result = string.Empty;

            if (classId.IndexOf("|") >= 0)
            {
                foreach (string _cid in classId.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    int cid = 0;
                    if (int.TryParse(_cid, out cid))
                    {
                        if (cid > 0)
                        {
                            ProductClassInfo proClass = ProductClassBLL.Read(cid);
                            if (!string.IsNullOrEmpty(proClass.Remark))
                            {
                                result = proClass.Remark;
                            }
                        }
                    }
                }
            }
            else
            {
                int cid = 0;
                if (int.TryParse(classId, out cid))
                {
                    if (cid > 0)
                    {
                        ProductClassInfo proClass = ProductClassBLL.Read(cid);
                        if (!string.IsNullOrEmpty(proClass.Remark))
                        {
                            result = proClass.Remark;
                        }
                    }
                }
            }
            return(result);
        }
Пример #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("/");
            }

            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;
        }
Пример #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 < 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;
        }
Пример #7
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;
        }