예제 #1
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadProduct", PowerCheckType.Single);

                ClassID.DataSource     = ProductClassBLL.ReadNamedList();
                ClassID.DataTextField  = "Name";
                ClassID.DataValueField = "ID";
                ClassID.DataBind();
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "ID";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ClassID.Text = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text = RequestHelper.GetQueryString <string>("BrandID");
                Key.Text     = RequestHelper.GetQueryString <string>("Key");

                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.IsSale       = (int)BoolType.True;
                productSearch.IsDelete     = 0;//未删除的
                productSearch.StandardType = (int)ProductStandardType.No;
                productSearch.Key          = RequestHelper.GetQueryString <string>("Key");
                productSearch.ClassId      = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId      = RequestHelper.GetQueryString <int>("BrandID");
                BindControl(ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count), RecordList, MyPager);
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("StatisticsProduct", PowerCheckType.Single);

                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "Id";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ClassID.Text        = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text        = RequestHelper.GetQueryString <string>("BrandID");
                Name.Text           = RequestHelper.GetQueryString <string>("Name");
                StorageAnalyse.Text = RequestHelper.GetQueryString <string>("StorageAnalyse");

                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.IsSale         = (int)BoolType.True;
                productSearch.Name           = RequestHelper.GetQueryString <string>("Name");
                productSearch.ClassId        = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId        = RequestHelper.GetQueryString <int>("BrandID");
                productSearch.StorageAnalyse = RequestHelper.GetQueryString <int>("StorageAnalyse");
                List <ProductInfo> productList = ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count);
                BindControl(productList, RecordList, MyPager);
            }
        }
예제 #3
0
        /// <summary>
        /// 根据首字符筛选品牌
        /// </summary>
        protected void GetBrandsByFirstLetter()
        {
            string firstLetter      = RequestHelper.GetQueryString <string>("FirstLetter");
            string _html            = string.Empty;
            int    attributeClassID = RequestHelper.GetQueryString <int>("ID");

            pageAttr = ProductTypeBLL.Read(attributeClassID);
            List <ProductBrandInfo> proBrandList = new List <ProductBrandInfo>();

            if (!string.IsNullOrEmpty(firstLetter))
            {
                if (firstLetter == "+")
                {//其他,不是以字母开头的
                    Regex regChar  = new Regex("^[a-z]");
                    Regex regDChar = new Regex("^[A-Z]");
                    proBrandList = ProductBrandBLL.ReadList().Where(k => !regChar.IsMatch(k.Spelling)).Where(k => !regDChar.IsMatch(k.Spelling)).OrderBy(k => k.Spelling).ToList();
                }
                else
                {//以字母开头的
                    proBrandList = ProductBrandBLL.ReadList().Where(k => k.Spelling.ToLower().StartsWith(firstLetter.ToLower())).OrderBy(k => k.Spelling).ToList();
                }
                foreach (ProductBrandInfo proBrand in proBrandList)
                {
                    if (!string.IsNullOrEmpty(pageAttr.BrandIds))
                    {
                        string brands = ";" + pageAttr.BrandIds + ";";

                        if (brands.IndexOf(";" + proBrand.Id.ToString() + ";") >= 0)
                        {
                            _html += "<label class=\"ig-checkbox checked\"><input type=\"checkbox\" checked=\"checked\" name=\"proBrand\" value=\"" + proBrand.Id + "\" onclick=\"chooseBrand(this,'" + proBrand.Name + "')\"/>" + proBrand.Name + "</label>";
                        }
                        else
                        {
                            _html += " <label class=\"ig-checkbox\" ><input type=\"checkbox\" name=\"proBrand\" value=\"" + proBrand.Id + "\" onclick=\"chooseBrand(this,'" + proBrand.Name + "')\"/>" + proBrand.Name + "</label>";
                        }
                    }
                    else
                    {
                        _html += "<label class=\"ig-checkbox\"><input type=\"checkbox\" name=\"proBrand\" value=\"" + proBrand.Id + "\" onclick=\"chooseBrand(this,'" + proBrand.Name + "')\"/>" + proBrand.Name + "</label>";
                    }
                }
                Response.Clear();
                ResponseHelper.Write(JsonConvert.SerializeObject(new { flag = true, content = _html }));
            }
            else
            {
                Response.Clear();
                ResponseHelper.Write(JsonConvert.SerializeObject(new { flag = false, content = _html }));
            }
            Response.End();
        }
예제 #4
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadProduct", PowerCheckType.Single);
                RegionID.DataSource = RegionBLL.ReadRegionUnlimitClass();
                RegionID.ClassID    = "|1|27|607|";
                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "ID";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ClassID.Text      = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text      = RequestHelper.GetQueryString <string>("BrandID");
                Key.Text          = RequestHelper.GetQueryString <string>("Key");
                StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");
                IsSpecial.Text    = RequestHelper.GetQueryString <string>("IsSpecial");
                IsNew.Text        = RequestHelper.GetQueryString <string>("IsNew");
                IsHot.Text        = RequestHelper.GetQueryString <string>("IsHot");
                IsTop.Text        = RequestHelper.GetQueryString <string>("IsTop");

                List <ProductInfo> productList   = new List <ProductInfo>();
                ProductSearchInfo  productSearch = new ProductSearchInfo();
                productSearch.Key          = RequestHelper.GetQueryString <string>("Key");
                productSearch.ClassId      = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId      = RequestHelper.GetQueryString <int>("BrandID");
                productSearch.IsSpecial    = RequestHelper.GetQueryString <int>("IsSpecial");
                productSearch.IsNew        = RequestHelper.GetQueryString <int>("IsNew");
                productSearch.IsHot        = RequestHelper.GetQueryString <int>("IsHot");
                productSearch.IsSale       = (int)BoolType.True;
                productSearch.IsTop        = RequestHelper.GetQueryString <int>("IsTop");
                productSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                productSearch.EndAddDate   = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate"));
                productSearch.IsDelete     = 0;//没有逻辑删除的商品
                PageSize           = Session["AdminPageSize"] == null ? 20 : Convert.ToInt32(Session["AdminPageSize"]);
                AdminPageSize.Text = Session["AdminPageSize"] == null ? "20" : Session["AdminPageSize"].ToString();
                productList        = ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count);

                BindControl(productList, RecordList, MyPager);
            }
        }
예제 #5
0
        protected override void PageLoad()
        {
            base.PageLoad();

            topNav = 1;

            IPHostEntry ipHost = System.Net.Dns.GetHostEntry(Dns.GetHostName());// Dns.Resolve(Dns.GetHostName()); ;

            foreach (IPAddress ipa in ipHost.AddressList)
            {
                if (ipa.AddressFamily.ToString() == "InterNetwork")
                {
                    localIP = ipa.ToString();
                }
            }
            //IPAddress ipaddress = ipHost.AddressList[0];
            //localIP = ipaddress.ToString();
            //imageList = AdImageBLL.ReadList();
            //ProductBrandBLL.ReadList(
            proBranInfo = ProductBrandBLL.ReadList();
            List <AdImageInfo> flashList = AdImageBLL.ReadList(6);
            int count = 0;

            //likeProductList = ProductBLL.SearchList(1, 5, new ProductSearchInfo { ProductOrderType = "LikeNum", IsSale = (int)BoolType.True }, ref count);
            artListInfo = ArticleBLL.SearchList(1, 4, new ArticleSearchInfo {
                ClassId = "|58|"
            }, ref count);
            topnewsList = ArticleBLL.SearchList(1, 5, new ArticleSearchInfo {
                ClassId = "|38|", IsTop = (int)BoolType.True
            }, ref count);
            topylzcList = ArticleBLL.SearchList(1, 6, new ArticleSearchInfo {
                ClassId = "|47|", IsTop = (int)BoolType.True
            }, ref count);
            //newProductList = ProductBLL.SearchList(1, 5, new ProductSearchInfo { IsNew = (int)BoolType.True, IsTop = (int)BoolType.True, IsSale = (int)BoolType.True }, ref count);

            //hotProductList = ProductBLL.SearchList(1, 10, new ProductSearchInfo { IsHot = (int)BoolType.True, IsTop = (int)BoolType.True, IsSale = (int)BoolType.True }, ref count);

            //specialProductList = ProductBLL.SearchList(1, 10, new ProductSearchInfo { IsSpecial = (int)BoolType.True, IsTop = (int)BoolType.True, IsSale = (int)BoolType.True }, ref count);

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

            //pictureLinkList = LinkBLL.ReadLinkCacheListByClass((int)LinkType.Picture);
            //在线咨询
            if (RequestHelper.GetQueryString <string>("Action") == "AskOnline")
            {
                AskOnline();
            }
        }
예제 #6
0
        /// <summary>
        /// 根据首字符筛选品牌数量
        /// </summary>
        /// <param name="firstLetter"></param>
        /// <returns></returns>
        protected int GetBrandCountByFirstLetter(string firstLetter)
        {
            List <ProductBrandInfo> proBrandList = new List <ProductBrandInfo>();

            if (firstLetter == "+")
            {    //其他,不是以字母开头的
                Regex regChar  = new Regex("^[a-z]");
                Regex regDChar = new Regex("^[A-Z]");
                proBrandList = ProductBrandBLL.ReadList().Where(k => !regChar.IsMatch(k.Spelling)).Where(k => !regDChar.IsMatch(k.Spelling)).OrderBy(k => k.Spelling).ToList();
            }
            else
            {    //以字母开头的
                proBrandList = ProductBrandBLL.ReadList().Where(k => k.Spelling.ToLower().StartsWith(firstLetter.ToLower())).OrderBy(k => k.Spelling).ToList();
            }
            return(proBrandList.Count);
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    RelationClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                RelationClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                List <ProductBrandInfo> productBrandList = ProductBrandBLL.ReadList();
                RelationBrandID.DataSource     = productBrandList;
                RelationBrandID.DataTextField  = "Name";
                RelationBrandID.DataValueField = "ID";
                RelationBrandID.DataBind();
                RelationBrandID.Items.Insert(0, new ListItem("选择品牌", string.Empty));
            }
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ClearCache();
            int attributeClassID = RequestHelper.GetQueryString <int>("AttributeClassID");

            int proTypeID = ProductClassBLL.GetProductClassType(attributeClassID);

            ProductTypeInfo aci = ProductTypeBLL.Read(proTypeID);


            if (aci.Id > 0)
            {
                string[] strArr = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                int[]    intArr = Array.ConvertAll <string, int>(strArr, s => int.Parse(s));

                productBrandList = ProductBrandBLL.ReadList(intArr);
            }
        }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("StatisticsSale", PowerCheckType.Single);

                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "Id";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ClassID.Text      = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text      = RequestHelper.GetQueryString <string>("BrandID");
                Name.Text         = RequestHelper.GetQueryString <string>("Name");
                StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");
                UserName.Text     = RequestHelper.GetQueryString <string>("UserName");
                OrderNumber.Text  = RequestHelper.GetQueryString <string>("OrderNumber");

                ProductSearchInfo productSearch = new ProductSearchInfo();
                OrderSearchInfo   orderSearch   = new OrderSearchInfo();
                productSearch.IsSale      = (int)BoolType.True;
                productSearch.Name        = RequestHelper.GetQueryString <string>("Name");
                productSearch.ClassId     = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId     = RequestHelper.GetQueryString <int>("BrandID");
                productSearch.InProductId = RequestHelper.GetQueryString <string>("ProductID");
                orderSearch.StartAddDate  = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                orderSearch.EndAddDate    = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate"));
                orderSearch.UserName      = RequestHelper.GetQueryString <string>("UserName");
                orderSearch.OrderNumber   = RequestHelper.GetQueryString <string>("OrderNumber");
                BindControl(OrderDetailBLL.StatisticsSaleDetail(CurrentPage, PageSize, orderSearch, productSearch, ref Count), RecordList, MyPager);
            }
        }
예제 #10
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadProduct", PowerCheckType.Single);

                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "ID";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ClassID.Text      = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text      = RequestHelper.GetQueryString <string>("BrandID");
                Key.Text          = RequestHelper.GetQueryString <string>("Key");
                StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");


                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.Key          = RequestHelper.GetQueryString <string>("Key");
                productSearch.ClassId      = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId      = RequestHelper.GetQueryString <int>("BrandID");
                productSearch.IsSale       = 2;//草稿
                productSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                productSearch.EndAddDate   = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate"));
                productSearch.IsDelete     = 0;//没有逻辑删除的商品
                PageSize = 10;
                List <ProductInfo> productList = ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count);
                BindControl(productList, RecordList, MyPager);
            }
        }
예제 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("StatisticsProduct", PowerCheckType.Single);

                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "ID";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.IsSale  = (int)BoolType.True;
                productSearch.Name    = RequestHelper.GetQueryString <string>("Name");
                productSearch.ClassId = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId = RequestHelper.GetQueryString <int>("BrandID");
                string productOrderType = RequestHelper.GetQueryString <string>("ProductOrderType");
                productOrderType = (productOrderType == string.Empty) ? "SellCount" : productOrderType;
                productSearch.ProductOrderType = productOrderType;
                ClassID.Text          = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text          = RequestHelper.GetQueryString <string>("BrandID");
                Name.Text             = RequestHelper.GetQueryString <string>("Name");
                StartDate.Text        = RequestHelper.GetQueryString <string>("StartDate");
                EndDate.Text          = RequestHelper.GetQueryString <string>("EndDate");
                ProductOrderType.Text = productOrderType;
                DateTime startDate = RequestHelper.GetQueryString <DateTime>("StartDate");
                DateTime endDate   = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndDate"));
                BindControl(ProductBLL.StatisticsProductSale(CurrentPage, PageSize, productSearch, ref Count, startDate, endDate), RecordList, MyPager);
            }
        }
예제 #12
0
        /// <summary>
        /// 根据选择分类获取对应的品牌列表
        /// </summary>
        protected void GetBrandList()
        {
            int                     classId          = RequestHelper.GetQueryString <int>("classId");
            string                  brandname        = RequestHelper.GetQueryString <string>("brandname");
            int                     proTypeID        = ProductClassBLL.GetProductClassType(classId);
            ProductTypeInfo         aci              = ProductTypeBLL.Read(proTypeID);
            List <ProductBrandInfo> productBrandList = new List <ProductBrandInfo>();

            if (aci.Id > 0)
            {
                string[] strArray = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                int[]    intArray;

                intArray         = Array.ConvertAll <string, int>(strArray, s => int.Parse(s));
                productBrandList = ProductBrandBLL.ReadList(intArray);
                if (!string.IsNullOrEmpty(brandname))
                {
                    productBrandList = productBrandList.Where(k => k.Name.ToLower().Contains(brandname.ToLower())).ToList();
                }
            }
            Response.Clear();
            ResponseHelper.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { count = productBrandList.Count, dataList = productBrandList }));
            Response.End();
        }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadProduct", PowerCheckType.Single);

                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "ID";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ClassID.Text      = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text      = RequestHelper.GetQueryString <string>("BrandID");
                Key.Text          = RequestHelper.GetQueryString <string>("Key");
                StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");


                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.Key          = RequestHelper.GetQueryString <string>("Key");
                productSearch.ClassId      = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId      = RequestHelper.GetQueryString <int>("BrandID");
                productSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                productSearch.EndAddDate   = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate"));
                productSearch.IsDelete     = 1;//逻辑删除的商品
                //PageSize = 10;
                PageSize           = Session["AdminPageSize"] == null ? 20 : Convert.ToInt32(Session["AdminPageSize"]);
                AdminPageSize.Text = Session["AdminPageSize"] == null ? "20" : Session["AdminPageSize"].ToString();
                List <ProductInfo> productList = ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count);
                BindControl(productList, RecordList, MyPager);

                var pid = RequestHelper.GetQueryString <int>("ID");

                switch (RequestHelper.GetQueryString <string>("Action"))
                {
                case "Recover":
                    if (pid > 0)
                    {
                        ProductBLL.Recover(pid);
                        AdminLogBLL.Add(ShopLanguage.ReadLanguage("RecoverRecord"), ShopLanguage.ReadLanguage("Product"), pid);
                        ScriptHelper.Alert(ShopLanguage.ReadLanguage("RecoverOK"), Request.UrlReferrer.ToString());
                    }
                    break;

                case "Delete":
                    if (pid > 0)
                    {
                        ProductBLL.Delete(pid);
                        AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecordCompletely"), ShopLanguage.ReadLanguage("Product"), pid);
                        ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteCompletelyOK"), Request.UrlReferrer.ToString());
                    }
                    break;

                default:
                    break;
                }
            }
        }
예제 #14
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;
        }
예제 #15
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ProductBatchEdit", PowerCheckType.Single);

                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "ID";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                string action = RequestHelper.GetQueryString <string>("Action");
                switch (action)
                {
                case "UnionEdit":
                    UnionEdit();
                    break;

                case "search":
                    ProductSearchInfo productSearch = new ProductSearchInfo();
                    productSearch.Name         = RequestHelper.GetQueryString <string>("Name");
                    productSearch.ClassId      = RequestHelper.GetQueryString <string>("ClassID");
                    productSearch.BrandId      = RequestHelper.GetQueryString <int>("BrandID");
                    productSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                    productSearch.EndAddDate   = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate"));
                    productSearch.IsSale       = (int)BoolType.True;
                    ClassID.Text      = RequestHelper.GetQueryString <string>("ClassID");
                    BrandID.Text      = RequestHelper.GetQueryString <string>("BrandID");
                    Name.Text         = RequestHelper.GetQueryString <string>("Name");
                    StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                    EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");
                    BindControl(ProductBLL.SearchList(productSearch), RecordList);
                    break;

                default:
                    break;
                }

                userGradeList = UserGradeBLL.ReadList();
                foreach (UserGradeInfo userGrade in userGradeList)
                {
                    if (userGradeIDList == string.Empty)
                    {
                        userGradeIDList   = userGrade.Id.ToString();
                        userGradeNameList = userGrade.Name;
                    }
                    else
                    {
                        userGradeIDList   += "," + userGrade.Id.ToString();
                        userGradeNameList += "," + userGrade.Name;
                    }
                }
            }
        }
예제 #16
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ProductBatchEdit", PowerCheckType.Single);

                string action = RequestHelper.GetQueryString <string>("Action");
                if (action == "SingleEdit")
                {
                    SingleEdit();
                }

                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "ID";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.Name         = RequestHelper.GetQueryString <string>("Name");
                productSearch.ClassId      = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId      = RequestHelper.GetQueryString <int>("BrandID");;
                productSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                productSearch.EndAddDate   = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate"));
                productSearch.IsSale       = (int)BoolType.True;
                ClassID.Text      = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text      = RequestHelper.GetQueryString <string>("BrandID");
                Name.Text         = RequestHelper.GetQueryString <string>("Name");
                StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");
                productList       = ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count);
                BindControl(MyPager);

                string strProductID = string.Empty;
                foreach (ProductInfo product in productList)
                {
                    if (strProductID == string.Empty)
                    {
                        strProductID = product.Id.ToString();
                    }
                    else
                    {
                        strProductID += "," + product.Id.ToString();
                    }
                }
                userGradeList = UserGradeBLL.ReadList();
                foreach (UserGradeInfo userGrade in userGradeList)
                {
                    if (userGradeIDList == string.Empty)
                    {
                        userGradeIDList   = userGrade.Id.ToString();
                        userGradeNameList = userGrade.Name;
                    }
                    else
                    {
                        userGradeIDList   += "," + userGrade.Id.ToString();
                        userGradeNameList += "," + userGrade.Name;
                    }
                }
            }
        }
예제 #17
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindClassBrandAttributeClassStandardType();
                BrandID.Items.Insert(0, new ListItem("请选择", "0"));
                RelationBrandID.Items.Insert(0, new ListItem("请选择", "0"));
                AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0"));

                string classId = RequestHelper.GetQueryString <string>("classId");
                productID = RequestHelper.GetQueryString <int>("ID");
                _brandId  = RequestHelper.GetQueryString <int>("BrandId");
                //ProductClass.DataSource = ProductClassBLL.ReadUnlimitClassList();
                if (productID <= 0)             //添加商品
                {
                    DraftButton.Visible = true; //添加商品可保存草稿
                    if (string.IsNullOrEmpty(classId))
                    {
                        Response.Redirect("/admin/productaddinit.aspx");
                    }
                    else
                    {
                        LastClassID = ProductClassBLL.GetLastClassID(classId);
                        proTypeID   = ProductClassBLL.GetProductClassType(LastClassID);
                        ProductTypeInfo aci = ProductTypeBLL.Read(proTypeID);
                        if (aci.Id > 0)
                        {
                            string[] strArray = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                            int[]    intArray;

                            intArray         = Array.ConvertAll <string, int>(strArray, s => int.Parse(s));
                            productBrandList = ProductBrandBLL.ReadList(intArray);
                        }

                        if (productBrandList.Count > 0)
                        {
                            BrandID.DataSource     = productBrandList;
                            BrandID.DataTextField  = "Name";
                            BrandID.DataValueField = "ID";
                            BrandID.DataBind();
                            BrandID.Items.Insert(0, new ListItem("请选择", "0"));
                            if (_brandId > 0)
                            {
                                BrandID.Text = _brandId.ToString();
                            }

                            RelationBrandID.DataSource     = productBrandList;
                            RelationBrandID.DataTextField  = "Name";
                            RelationBrandID.DataValueField = "ID";
                            RelationBrandID.DataBind();
                            RelationBrandID.Items.Insert(0, new ListItem("请选择", "0"));

                            AccessoryBrandID.DataSource     = productBrandList;
                            AccessoryBrandID.DataTextField  = "Name";
                            AccessoryBrandID.DataValueField = "ID";
                            AccessoryBrandID.DataBind();
                            AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0"));
                        }
                        //商品分类对应的属性列表
                        attributeList = ProductTypeAttributeBLL.ReadList(proTypeID);
                        //商品类型对应的规格列表
                        standardList = ProductTypeStandardBLL.ReadList(proTypeID);
                        //添加商品时自动查找所属分类的售后服务
                        Remark.Value = GetProductClassRemark(classId);
                    }
                }
                else//修改商品
                {
                    CheckAdminPower("ReadProduct", PowerCheckType.Single);
                    DraftButton.Visible = false;//修改商品不可保存草稿
                    ProductInfo product = ProductBLL.Read(productID);
                    pageProduct = product;
                    //如果修改了分类则标识isupdate
                    if (!string.IsNullOrEmpty(classId) && product.ClassId != classId)
                    {
                        isUpdate = 1;
                    }

                    YejiRatio.Text = product.YejiRatio;

                    Name.Text      = product.Name;
                    SellPoint.Text = product.SellPoint;
                    Name.Attributes.Add("style", "color:" + product.Color);
                    color              = product.Color;
                    FontStyle.Text     = product.FontStyle;
                    ProductNumber.Text = product.ProductNumber;
                    //ProductClass.ClassID = product.ClassId;
                    Keywords.Text          = product.Keywords;
                    MarketPrice.Text       = product.MarketPrice.ToString();
                    SendPoint.Text         = product.SendPoint.ToString();
                    Photo.Text             = product.Photo;
                    Summary.Text           = product.Summary;
                    Introduction.Value     = product.Introduction1;
                    Weight.Text            = product.Weight.ToString();
                    GroupPrice.Text        = product.GroupPrice.ToString();
                    GroupQuantity.Text     = product.GroupQuantity.ToString();
                    GroupPhoto.Text        = product.GroupPhoto;
                    VirtualOrderCount.Text = product.VirtualOrderCount.ToString();

                    if (Convert.ToBoolean(product.IsSpecial))
                    {
                        IsSpecial.Checked = true;
                    }
                    if (Convert.ToBoolean(product.IsNew))
                    {
                        IsNew.Checked = true;
                    }
                    if (Convert.ToBoolean(product.IsHot))
                    {
                        IsHot.Checked = true;
                    }
                    if (Convert.ToBoolean(product.IsSale))
                    {
                        IsSale.Checked = true;
                    }
                    else
                    {
                        IsSale.Checked = false;
                    }
                    if (Convert.ToBoolean(product.IsTop))
                    {
                        IsTop.Checked = true;
                    }
                    if (Convert.ToBoolean(product.AllowComment))
                    {
                        AllowComment.Checked = true;
                    }
                    else
                    {
                        AllowComment.Checked = false;
                    }
                    TotalStorageCount.Text = product.TotalStorageCount.ToString();

                    LastClassID    = ProductClassBLL.GetLastClassID(product.ClassId);
                    this.proTypeID = ProductClassBLL.GetProductClassType(LastClassID);
                    //商品分类对应的属性列表
                    //attributeList = ProductTypeAttributeBLL.JoinAttribute(ProductClassBLL.Read(ProductClassBLL.GetLastClassID(product.ClassId)).ProductTypeId, productID);
                    attributeList        = ProductTypeAttributeBLL.JoinAttribute(this.proTypeID, productID);
                    Repeater1.DataSource = attributeList;
                    Repeater1.DataBind();
                    //商品类型对应的规格列表
                    standardList       = ProductTypeStandardBLL.ReadList(this.proTypeID);
                    standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType);
                    if (product.StandardType == 1)
                    {
                        if (standardRecordList.Count > 0)
                        {
                            TotalStorageCount.ReadOnly = true;
                        }
                    }
                    if (string.IsNullOrEmpty(classId))
                    {
                        LastClassID = ProductClassBLL.GetLastClassID(product.ClassId);
                    }
                    else
                    {
                        LastClassID = ProductClassBLL.GetLastClassID(classId);
                    }
                    int             proTypeID = ProductClassBLL.GetProductClassType(LastClassID);
                    ProductTypeInfo aci       = ProductTypeBLL.Read(proTypeID);
                    if (aci.Id > 0)
                    {
                        string[] strArray = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                        int[]    intArray;

                        intArray         = Array.ConvertAll <string, int>(strArray, s => int.Parse(s));
                        productBrandList = ProductBrandBLL.ReadList(intArray);
                    }

                    if (productBrandList.Count > 0)
                    {
                        BrandID.DataSource     = productBrandList;
                        BrandID.DataTextField  = "Name";
                        BrandID.DataValueField = "ID";
                        BrandID.DataBind();
                        BrandID.Items.Insert(0, new ListItem("请选择", "0"));

                        RelationBrandID.DataSource     = productBrandList;
                        RelationBrandID.DataTextField  = "Name";
                        RelationBrandID.DataValueField = "ID";
                        RelationBrandID.DataBind();
                        RelationBrandID.Items.Insert(0, new ListItem("请选择", "0"));

                        AccessoryBrandID.DataSource     = productBrandList;
                        AccessoryBrandID.DataTextField  = "Name";
                        AccessoryBrandID.DataValueField = "ID";
                        AccessoryBrandID.DataBind();
                        AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0"));
                    }
                    if (_brandId > 0)
                    {
                        BrandID.Text = _brandId.ToString();
                    }
                    else
                    {
                        BrandID.Text = product.BrandId.ToString();
                    }

                    sendCount    = product.SendCount;
                    OrderID.Text = product.OrderId.ToString();

                    SalePrice.Text            = product.SalePrice.ToString();
                    Units.Text                = product.Unit;
                    Introduction_Mobile.Value = product.Introduction1_Mobile;
                    Sub_Title.Text            = product.SubTitle;
                    LowerCount.Text           = product.LowerCount.ToString();

                    Remark.Value = product.Remark;

                    BindRelation(product);
                    productPhotoList = ProductPhotoBLL.ReadList(productID, 0);
                }
                //userGradeList = UserGradeBLL.JoinUserGrade(productID);
            }
        }
예제 #18
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;
        }
예제 #19
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadProduct", PowerCheckType.Single);

                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "ID";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ClassID.Text       = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text       = RequestHelper.GetQueryString <string>("BrandID");
                Key.Text           = RequestHelper.GetQueryString <string>("Key");
                StartAddDate.Text  = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text    = RequestHelper.GetQueryString <string>("EndAddDate");
                IsSpecial.Text     = RequestHelper.GetQueryString <string>("IsSpecial");
                IsNew.Text         = RequestHelper.GetQueryString <string>("IsNew");
                IsHot.Text         = RequestHelper.GetQueryString <string>("IsHot");
                IsTop.Text         = RequestHelper.GetQueryString <string>("IsTop");
                ProductNumber.Text = RequestHelper.GetQueryString <string>("ProductNumber");

                #region 销量 价格
                decimal _LowerSalePrice  = RequestHelper.GetQueryString <decimal>("LowerSalePrice");
                decimal _UpperSalePrice  = RequestHelper.GetQueryString <decimal>("UpperSalePrice");
                int     _LowerOrderCount = RequestHelper.GetQueryString <int>("LowerOrderCount");
                int     _UpperOrderCount = RequestHelper.GetQueryString <int>("UpperOrderCount");
                if (_LowerSalePrice >= 0 && _UpperSalePrice >= 0)
                {
                    this.LowerSalePrice.Text = _LowerSalePrice < _UpperSalePrice?_LowerSalePrice.ToString() : _UpperSalePrice.ToString();

                    this.UpperSalePrice.Text = _LowerSalePrice < _UpperSalePrice?_UpperSalePrice.ToString() : _LowerSalePrice.ToString();
                }
                if (_LowerOrderCount >= 0 && _UpperOrderCount >= 0)
                {
                    this.LowerOrderCount.Text = _LowerOrderCount < _UpperOrderCount?_LowerOrderCount.ToString() : _UpperOrderCount.ToString();

                    this.UpperOrderCount.Text = _LowerOrderCount < _UpperOrderCount?_UpperOrderCount.ToString() : _LowerOrderCount.ToString();
                }
                #endregion

                List <ProductInfo> productList   = new List <ProductInfo>();
                ProductSearchInfo  productSearch = new ProductSearchInfo();
                //productSearch.Key = RequestHelper.GetQueryString<string>("Key");
                productSearch.Name          = RequestHelper.GetQueryString <string>("Key");
                productSearch.ProductNumber = RequestHelper.GetQueryString <string>("ProductNumber");
                productSearch.ClassId       = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId       = RequestHelper.GetQueryString <int>("BrandID");
                productSearch.IsSpecial     = RequestHelper.GetQueryString <int>("IsSpecial");
                productSearch.IsNew         = RequestHelper.GetQueryString <int>("IsNew");
                productSearch.IsHot         = RequestHelper.GetQueryString <int>("IsHot");
                productSearch.IsSale        = (int)BoolType.True;
                productSearch.IsTop         = RequestHelper.GetQueryString <int>("IsTop");
                productSearch.StartAddDate  = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                productSearch.EndAddDate    = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate"));
                productSearch.IsDelete      = 0;//没有逻辑删除的商品
                if (_LowerSalePrice >= 0 && _UpperSalePrice >= 0)
                {
                    productSearch.LowerSalePrice = _LowerSalePrice < _UpperSalePrice ? _LowerSalePrice : _UpperSalePrice;
                    productSearch.UpperSalePrice = _LowerSalePrice < _UpperSalePrice ? _UpperSalePrice : _LowerSalePrice;
                }
                if (_LowerOrderCount >= 0 && _UpperOrderCount >= 0)
                {
                    productSearch.LowerOrderCount = _LowerOrderCount < _UpperOrderCount ? _LowerOrderCount : _UpperOrderCount;
                    productSearch.UpperOrderCount = _LowerOrderCount < _UpperOrderCount ? _UpperOrderCount : _LowerOrderCount;
                }
                string productOrderType = RequestHelper.GetQueryString <string>("ProductOrderType");
                if (!string.IsNullOrEmpty(productOrderType))
                {
                    productSearch.ProductOrderType = productOrderType;
                }
                string orderType = RequestHelper.GetQueryString <string>("OrderType");
                productSearch.OrderType = orderType == "Asc"? OrderType.Asc:OrderType.Desc;
                PageSize           = Session["AdminPageSize"] == null ? 20 : Convert.ToInt32(Session["AdminPageSize"]);
                AdminPageSize.Text = Session["AdminPageSize"] == null ? "20" : Session["AdminPageSize"].ToString();
                productList        = ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count);

                BindControl(productList, RecordList, MyPager);


                switch (RequestHelper.GetQueryString <string>("ActionProduct"))
                {
                case "OffSaleProduct":
                    int Id = RequestHelper.GetQueryString <int>("ID");
                    if (Id > 0)
                    {
                        CheckAdminPower("OffSaleProduct", PowerCheckType.Single);
                        var product = ProductBLL.Read(Id);
                        if (product.IsSale == (int)BoolType.True)
                        {
                            product.IsSale = (int)BoolType.False;
                            ProductBLL.Update(product);
                            AdminLogBLL.Add(ShopLanguage.ReadLanguage("OffSaleRecord"), ShopLanguage.ReadLanguage("Product"), Id.ToString());
                            ScriptHelper.Alert(ShopLanguage.ReadLanguage("OffSaleOK"), Request.UrlReferrer.ToString());
                        }
                    }
                    break;

                case "DeleteProduct":
                    Id = RequestHelper.GetQueryString <int>("ID");
                    if (Id > 0)
                    {
                        CheckAdminPower("DeleteProduct", PowerCheckType.Single);

                        ProductBLL.DeleteLogically(Id);
                        AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Product"), Id.ToString());
                        ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), Request.UrlReferrer.ToString());
                    }
                    break;

                case "ModifyPrice":
                    ModifyPrice();
                    break;

                case "ModifyStorage":
                    ModifyStorage();
                    break;

                default:
                    break;
                }
            }
        }