Example #1
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            ProductClassInfo productClass = new ProductClassInfo();

            productClass.ID          = RequestHelper.GetQueryString <int>("ID");
            productClass.FatherID    = Convert.ToInt32(this.FatherID.Text);
            productClass.OrderID     = Convert.ToInt32(this.OrderID.Text);
            productClass.ClassName   = this.ClassName.Text;
            productClass.Keywords    = this.Keywords.Text;
            productClass.Description = this.Description.Text;
            productClass.IsDownload  = Convert.ToInt32(this.IsDownload.Text);
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (productClass.ID == -2147483648)
            {
                base.CheckAdminPower("AddProductClass", PowerCheckType.Single);
                int id = ProductClassBLL.AddProductClass(productClass);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("ProductClass"), id);
            }
            else
            {
                base.CheckAdminPower("UpdateProductClass", PowerCheckType.Single);
                ProductClassBLL.UpdateProductClass(productClass);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("ProductClass"), productClass.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl);
        }
Example #2
0
        private string ReadSystemClassID(string taobaoClassIDList)
        {
            string str = string.Empty;

            if (taobaoClassIDList != string.Empty)
            {
                foreach (string str2 in taobaoClassIDList.Split(new char[] { ',' }))
                {
                    if (str2 != string.Empty)
                    {
                        ProductClassInfo info = ProductClassBLL.ReadProductClassCacheByTaobaoID(Convert.ToInt64(str2));
                        if (info.FatherID == 0)
                        {
                            str = str + "|" + info.ID.ToString() + "|";
                        }
                        else
                        {
                            string str4 = str;
                            str = str4 + "|" + info.FatherID.ToString() + "|" + info.ID.ToString() + "|";
                        }
                    }
                }
            }
            return(str);
        }
Example #3
0
        /// <summary>
        /// 修改分类排序
        /// </summary>
        /// <param name="id">要移动的id</param>
        public void ChangeProductClassOrder(int pid, int oid)
        {
            ProductClassInfo tempProClass = Read(pid);

            tempProClass.OrderId = oid;

            Update(tempProClass);
        }
Example #4
0
        public void Update(ProductClassInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"update ProductClass set ParentId = @ParentId, ProductTypeId = @ProductTypeId, Name = @Name, Number = @Number, ProductCount = @ProductCount, Keywords = @Keywords, Remark = @Remark, OrderId = @OrderId, Tm = @Tm,Photo=@Photo,EnClassName=@EnClassName,PageTitle=@PageTitle,PageKeyWord=@PageKeyWord,PageSummary=@PageSummary,IsSystem=@IsSystem
                            where Id=@Id";

                conn.Execute(sql, entity);
            }
        }
Example #5
0
        public int Add(ProductClassInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"insert into ProductClass(ParentId,ProductTypeId,Name,Number,ProductCount,Keywords,Remark,OrderId,Tm,Photo,EnClassName,PageTitle,PageKeyWord,PageSummary,IsSystem)
                            values(@ParentId,@ProductTypeId,@Name,@Number,@ProductCount,@Keywords,@Remark,@OrderId,@Tm,@Photo,@EnClassName,@PageTitle,@PageKeyWord,@PageSummary,@IsSystem);
                            select SCOPE_IDENTITY()";

                return(conn.Query <int>(sql, entity).Single());
            }
        }
Example #6
0
        /// <summary>
        /// 通过IDataReader创建ProductClassInfo
        /// </summary>
        public static ProductClassInfo BuildFromReader(IDataReader reader)
        {
            ProductClassInfo model = new ProductClassInfo();

            model.ProductClassID       = TypeHelper.ObjectToInt(reader["ProductClassID"]);
            model.ProductClassName     = reader["ProductClassName"].ToString();
            model.ParentProductClassID = TypeHelper.ObjectToInt(reader["ParentProductClassID"]);
            model.DisplayOrder         = TypeHelper.ObjectToInt(reader["DisplayOrder"]);

            return(model);
        }
Example #7
0
 public void UpdateProductClass(ProductClassInfo productClass)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@fatherID", SqlDbType.Int), new SqlParameter("@orderID", SqlDbType.Int), new SqlParameter("@className", SqlDbType.NVarChar), new SqlParameter("@keywords", SqlDbType.NVarChar), new SqlParameter("@description", SqlDbType.NText), new SqlParameter("@isDownload", SqlDbType.Int) };
     pt[0].Value = productClass.ID;
     pt[1].Value = productClass.FatherID;
     pt[2].Value = productClass.OrderID;
     pt[3].Value = productClass.ClassName;
     pt[4].Value = productClass.Keywords;
     pt[5].Value = productClass.Description;
     pt[6].Value = productClass.IsDownload;
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateProductClass", pt);
 }
Example #8
0
 /// <summary>
 /// 对List<ProductClassInfo>进行排序时作为参数使用(升序)
 /// </summary>
 /// <param name="c1"></param>
 /// <param name="c2"></param>
 /// <returns></returns>
 private static int SortCompare(ProductClassInfo c1, ProductClassInfo c2)
 {
     if (c1.OrderID < c2.OrderID)
     {
         return(-1);
     }
     else if (c1.OrderID > c2.OrderID)
     {
         return(1);
     }
     return(0);
 }
Example #9
0
 public int AddProductClass(ProductClassInfo productClass)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@fatherID", SqlDbType.Int), new SqlParameter("@orderID", SqlDbType.Int), new SqlParameter("@className", SqlDbType.NVarChar), new SqlParameter("@keywords", SqlDbType.NVarChar), new SqlParameter("@description", SqlDbType.NText), new SqlParameter("@taobaoID", SqlDbType.BigInt), new SqlParameter("@isDownload", SqlDbType.Int) };
     pt[0].Value = productClass.FatherID;
     pt[1].Value = productClass.OrderID;
     pt[2].Value = productClass.ClassName;
     pt[3].Value = productClass.Keywords;
     pt[4].Value = productClass.Description;
     pt[5].Value = productClass.TaobaoID;
     pt[6].Value = productClass.IsDownload;
     return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddProductClass", pt)));
 }
Example #10
0
        /// <summary>
        /// 获取导航列表
        /// </summary>
        /// <returns></returns>
        public static List <ProductClassInfo> GetProductClassList()
        {
            List <ProductClassInfo> list   = new List <ProductClassInfo>();
            IDataReader             reader = BonSite.Core.BSData.RDBS.GetProductClassList();

            while (reader.Read())
            {
                ProductClassInfo model = BuildFromReader(reader);
                list.Add(model);
            }
            reader.Close();
            return(list);
        }
Example #11
0
        /// <summary>
        /// 从缓存列表中读取产品分类
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static ProductClassInfo ReadProductClassCache(int id)
        {
            ProductClassInfo        info = new ProductClassInfo();
            List <ProductClassInfo> list = ReadProductClassCacheList();

            foreach (ProductClassInfo info2 in list)
            {
                if (info2.ID == id)
                {
                    return(info2);
                }
            }
            return(info);
        }
Example #12
0
        public static ProductClassInfo ReadProductClassCacheByTaobaoID(long taobaoID)
        {
            ProductClassInfo        info = new ProductClassInfo();
            List <ProductClassInfo> list = ReadProductClassCacheList();

            foreach (ProductClassInfo info2 in list)
            {
                if (info2.TaobaoID == taobaoID)
                {
                    return(info2);
                }
            }
            return(info);
        }
Example #13
0
        /// <summary>
        /// 递归创建分类路径Path
        /// </summary>
        protected static void CreateProductClassPath(int productClassID, List <ProductClassInfo> resultList)
        {
            ProductClassInfo model = GetModelById(productClassID);

            if (model != null)
            {
                resultList.Insert(0, model);

                if (model.ParentProductClassID != 0)
                {
                    CreateProductClassPath(model.ParentProductClassID, resultList);
                }
            }
        }
Example #14
0
        /// <summary>
        /// 创建产品分类
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int CreateProductClass(ProductClassInfo model)
        {
            DbParameter[] parms =
            {
                GenerateInParam("@ProductClassName",     SqlDbType.NVarChar, 50, model.ProductClassName),
                GenerateInParam("@ParentProductClassID", SqlDbType.Int,       4, model.ParentProductClassID),
                GenerateInParam("@DisplayOrder",         SqlDbType.Int,       4, model.DisplayOrder)
            };

            string commandText = string.Format("INSERT INTO [{0}ProductClass](ProductClassName,ParentProductClassID,DisplayOrder) VALUES(@ProductClassName,@ParentProductClassID,@DisplayOrder);SELECT SCOPE_IDENTITY()",
                                               RDBSHelper.RDBSTablePre);

            //RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
            return(TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1));
        }
Example #15
0
 public void PrepareProductClassModel(SqlDataReader dr, List <ProductClassInfo> productClassList)
 {
     while (dr.Read())
     {
         ProductClassInfo item = new ProductClassInfo();
         item.ID          = dr.GetInt32(0);
         item.FatherID    = dr.GetInt32(1);
         item.OrderID     = dr.GetInt32(2);
         item.ClassName   = dr[3].ToString();
         item.Keywords    = dr[4].ToString();
         item.Description = dr[5].ToString();
         item.TaobaoID    = dr.GetInt64(6);
         item.IsDownload  = dr.GetInt32(7);
         productClassList.Add(item);
     }
 }
        /// <summary>
        /// 提交按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            ProductClassInfo productClass = new ProductClassInfo();

            productClass.Id = RequestHelper.GetQueryString <int>("ID");
            if (FatherID.Text.Trim() == RequestHelper.GetQueryString <string>("ID"))
            {
                ScriptHelper.Alert("不能将上级分类设置成自己", RequestHelper.RawUrl);
                Response.End();
            }
            if (string.IsNullOrEmpty(ProductType.Text))
            {
                ScriptHelper.Alert("必须选择产品类型", RequestHelper.RawUrl);
                Response.End();
            }
            productClass.ParentId      = Convert.ToInt32(FatherID.Text);
            productClass.OrderId       = Convert.ToInt32(OrderID.Text);
            productClass.Name          = ClassName.Text;
            productClass.Keywords      = Keywords.Text;
            productClass.Remark        = Description.Value;
            productClass.Photo         = Photo.Text;
            productClass.ProductTypeId = Convert.ToInt32(ProductType.Text);

            productClass.Tm = DateTime.Now;

            productClass.EnClassName = EnClassName.Text.Trim();
            productClass.PageTitle   = PageTitle.Text.Trim();
            productClass.PageKeyWord = PageKeyWord.Text.Trim();
            productClass.PageSummary = PageSummary.Text.Trim();

            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (productClass.Id == int.MinValue)
            {
                CheckAdminPower("AddProductClass", PowerCheckType.Single);
                int id = ProductClassBLL.Add(productClass);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("ProductClass"), id);
            }
            else
            {
                CheckAdminPower("UpdateProductClass", PowerCheckType.Single);
                ProductClassBLL.Update(productClass);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("ProductClass"), productClass.Id);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
        }
        /// <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();
                }
            }
        }
        /// <summary>
        /// 同步远程产品信息
        /// </summary>
        public static int SynErpProduct()
        {
            int          reNo = 0;
            ProductsInfo pi   = new ProductsInfo();

            try
            {
                DataTable dt = Bdu9ErpDataEngineService.getProductList("");
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["P_NAME"].ToString().Trim() != "")
                    {
                        if (tbProductsInfo.ExistsProductsInfo(dr["P_NAME"].ToString().Trim()) == false)
                        {
                            pi.pStandard = "";
                            pi.pUnits    = dr["p_rule_min"].ToString().Trim();
                            pi.pMaxUnits = dr["p_rule_max"].ToString().Trim();
                            pi.pToBoxNo  = Utils.StrToInt(dr["p_rules"].ToString().Trim(), 0);
                            pi.pState    = 0;

                            ProductClassInfo pci = DataClass.GetProductClassInfoModel(dr["typename"].ToString().Trim());
                            if (pci != null)
                            {
                                pi.ProductClassID = pci.ProductClassID;
                            }
                            pi.pBrand = dr["typename"].ToString().Trim();
                            pi.pPrice = decimal.Parse(Utils.StrToFloat(dr["a_price"].ToString().Trim(), 0).ToString());

                            pi.pCode       = Utils.GetRanDomCode();
                            pi.pBarcode    = dr["p_code"].ToString().Trim();
                            pi.pName       = dr["p_name"].ToString().Trim();
                            pi.pAppendTime = DateTime.Now;
                            tbProductsInfo.AddProductsInfo(pi);
                            reNo++;
                        }
                    }
                }
            }
            finally
            {
                pi = null;
            }
            return(reNo);
        }
Example #19
0
        /// <summary>
        /// 读取编排好的产品分类---后台展示
        /// </summary>
        /// <param name="idList"></param>
        public static string ProductClassNameListAdmin(string idList)
        {
            string content = string.Empty;

            if (!string.IsNullOrEmpty(idList))
            {
                idList = idList.Substring(1, idList.Length - 2);
            }
            idList = idList.Replace("||", "#");
            if (idList.Length > 0)
            {
                foreach (string temp in idList.Split('#'))
                {
                    string tempProductClassName = string.Empty;
                    foreach (string id in temp.Split('|'))
                    {
                        ProductClassInfo proClass = ProductClassBLL.Read(Convert.ToInt32(id));
                        if (string.IsNullOrEmpty(tempProductClassName))
                        {
                            //tempProductClassName = "<a href=\"/List.html?cat=" + ReadFullParentId(proClass.Id) + "\" target=\"_blank\" title=\"" + proClass.Name + "\">" + StringHelper.Substring(proClass.Name, 10) + "</a>";
                            tempProductClassName = StringHelper.Substring(proClass.Name, 10);
                        }
                        else
                        {
                            //tempProductClassName += " > <a href=\"/List.html?cat=" + ReadFullParentId(proClass.Id) + "\"  target=\"_blank\" title=\"" + proClass.Name + "\">" + StringHelper.Substring(proClass.Name, 10) + "</a>";
                            tempProductClassName += " > " + StringHelper.Substring(proClass.Name, 10);
                        }
                    }
                    if (!string.IsNullOrEmpty(tempProductClassName))
                    {
                        if (string.IsNullOrEmpty(content))
                        {
                            content = tempProductClassName;
                        }
                        else
                        {
                            content += "," + tempProductClassName;
                        }
                    }
                }
            }
            return(content);
        }
Example #20
0
        /// <summary>
        /// 更新产品分类
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateProductClass(ProductClassInfo model)
        {
            DbParameter[] parms =
            {
                GenerateInParam("@ProductClassID",       SqlDbType.Int,        4, model.ProductClassID),
                GenerateInParam("@ProductClassName",     SqlDbType.NVarChar,  50, model.ProductClassName),
                GenerateInParam("@ParentProductClassID", SqlDbType.Int,        4, model.ParentProductClassID),
                GenerateInParam("@DisplayOrder",         SqlDbType.NVarChar, 250, model.DisplayOrder)
            };
            string commandText = string.Format("UPDATE [{0}ProductClass] SET ProductClassName=@ProductClassName, ParentProductClassID=@ParentProductClassID, DisplayOrder=@DisplayOrder WHERE [ProductClassID]=@ProductClassID",
                                               RDBSHelper.RDBSTablePre);

            if (RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #21
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);
        }
Example #22
0
        private static List <ProductClassInfo> ReadProductClassChildList(int fatherID, int depth)
        {
            List <ProductClassInfo> list  = new List <ProductClassInfo>();
            List <ProductClassInfo> list2 = ReadProductClassCacheList();

            foreach (ProductClassInfo info in list2)
            {
                if (info.FatherID == fatherID)
                {
                    ProductClassInfo item = (ProductClassInfo)ServerHelper.CopyClass(info);
                    string           str  = string.Empty;
                    for (int i = 1; i < depth; i++)
                    {
                        str = str + HttpContext.Current.Server.HtmlDecode("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                    }
                    item.ClassName = str + item.ClassName;
                    list.Add(item);
                    list.AddRange(ReadProductClassChildList(item.ID, depth + 1));
                }
            }
            return(list);
        }
Example #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         this.FatherID.DataSource     = ProductClassBLL.ReadProductClassNamedList();
         this.FatherID.DataTextField  = "ClassName";
         this.FatherID.DataValueField = "ID";
         this.FatherID.DataBind();
         this.FatherID.Items.Insert(0, new ListItem("作为最大类", "0"));
         int queryString = RequestHelper.GetQueryString <int>("ID");
         if (queryString != -2147483648)
         {
             base.CheckAdminPower("ReadProductClass", PowerCheckType.Single);
             ProductClassInfo info = ProductClassBLL.ReadProductClassCache(queryString);
             this.FatherID.Text    = info.FatherID.ToString();
             this.OrderID.Text     = info.OrderID.ToString();
             this.ClassName.Text   = info.ClassName;
             this.Keywords.Text    = info.Keywords;
             this.Description.Text = info.Description;
             this.IsDownload.Text  = info.IsDownload.ToString();
         }
     }
 }
Example #24
0
 /// <summary>
 /// 创建产品类型
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static int Create(ProductClassInfo model)
 {
     return(BonSite.Core.BSData.RDBS.CreateProductClass(model));
 }
Example #25
0
 public static void UpdateProductClass(ProductClassInfo productClass)
 {
     dal.UpdateProductClass(productClass);
     CacheHelper.Remove(cacheKey);
 }
Example #26
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;
        }
Example #27
0
 public static int AddProductClass(ProductClassInfo productClass)
 {
     productClass.ID = dal.AddProductClass(productClass);
     CacheHelper.Remove(cacheKey);
     return(productClass.ID);
 }
Example #28
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;
        }
Example #29
0
        public string lastName      = "";//修改前的名称
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-1"))
                {
                    Act            = HTTPRequest.GetString("Act");
                    pClassName     = Utils.ChkSQL(HTTPRequest.GetString("tName").Trim());
                    productClassID = HTTPRequest.GetInt("classID", 0);
                    lastName       = HTTPRequest.GetString("lastName").Trim();

                    if (productClassID > 0)
                    {
                        pi = DataClass.GetProductClassInfoModel(productClassID);
                    }

                    if (ispost)
                    {
                        //添加
                        if (Act.IndexOf("add") > -1)
                        {
                            ProductClassInfo li = new ProductClassInfo();
                            if (pClassName != "")
                            {
                                li.pParentID   = productClassID;
                                li.pClassName  = pClassName;
                                li.pOrder      = HTTPRequest.GetInt("tOrder", 0);
                                li.pAppendTime = DateTime.Now;

                                bool hValue = DataClass.ExistsProductClassInfo(HTTPRequest.GetString("tName"), productClassID);
                                if (hValue)
                                {
                                    AddErrLine("操作失败,该条分类已经存在,请核对后重新添加!");
                                }
                                else
                                {
                                    int addCount = DataClass.AddProductClassInfo(li);
                                    if (addCount > 0)
                                    {
                                        //记录成功操作
                                        Logs.AddEventLog(this.userid, "添加" + pClassName + "商品分类");
                                        AddMsgLine("操作成功!");
                                        AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                    }
                                    else
                                    {
                                        AddErrLine("操作失败,请重新添加!");
                                    }
                                }
                            }
                            else
                            {
                                AddErrLine("操作失败,请重新添加!");
                            }
                        }
                        //修改
                        if (Act.IndexOf("update") > -1)
                        {
                            if (pClassName != "")
                            {
                                pi.ProductClassID = productClassID;
                                pi.pClassName     = pClassName;
                                pi.pAppendTime    = DateTime.Now;

                                int count = DataClass.UpdateProductClassInfo(pi);
                                if (count > 0)
                                {
                                    //记录修改操作
                                    Logs.AddEventLog(this.userid, "将" + lastName + "商品修改为" + pClassName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("修改失败!");
                                }
                            }
                            else
                            {
                                AddErrLine("修改失败!");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
Example #30
0
 /// <summary>
 /// 更新产品类型
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static bool Update(ProductClassInfo model)
 {
     return(BonSite.Core.BSData.RDBS.UpdateProductClass(model));
 }