public object DeleteProductCategoryById(int id)
        {
            IProductCategoryService productCategoryService=new ProductCategoryService();

            var productCategory = productCategoryService.GetProductCategoryById(id);
            if(productCategory!=null)
            {
                //WHERE Lft BETWEEN @MyLeft AND @MyRight;
                var all =
                    productCategoryService.GetProductCategory().Where(
                        s => s.Lft >= productCategory.Lft && s.Rgt <= productCategory.Rgt);
                IProductService productService=new ProductService();
                foreach (ProductCategoryInfo productCategoryInfo in all)
                {
                    productService.DeleteProductByCategoryId(productCategory.Id);
                }
            }

            return productCategoryService.DeleteById(id);
        }
        public List<ComboTree> GetComboTreeCategory(int id)
        {
            IProductCategoryService productCategoryService = new ProductCategoryService();
            var data = productCategoryService.GetProductCategory();
            List<ComboTree> result=new List<ComboTree>();

            var root = data.Where(s => s.Depth == id);
            foreach (var categoryInfo in root)
            {
                var comboTree = new ComboTree();
                comboTree.Id = categoryInfo.Id;
                comboTree.Text = categoryInfo.Name;
                comboTree.Children = GetComboTreeChildren(comboTree, categoryInfo, data);
                result.Add(comboTree);
            }
            return result;
        }
        public object GetProductCategory()
        {
            IProductCategoryService productCategoryService=new ProductCategoryService();

            var data = productCategoryService.GetProductCategory();

            // 每页显示记录数
            int pageSize = 10;
            // 记录总数
            int rowCount = data.Count;
            // 总页数
            int pageCount = rowCount % pageSize == 0 ? rowCount / pageSize : rowCount / pageSize + 1;

            var resultObj = new JQGridDataResult
            {
                // 总页数
                PageCount = pageCount,
                // 当前页
                PageIndex = 1,
                // 总记录数
                Total = rowCount,
                // 数据
                Data =from item in data
                      select new
                          {
                              cell=new string[]
                                  {
                                     item.Id.ToString(),
                                     item.Name,
                                     item.Desc,
                                     item.CategoryId.ToString(),
                                     item.MediumPicture,

                                     item.Depth.ToString(),
                                     item.Parent,
                                     (item.Rgt==item.Lft+1).ToString(),
                                     "true",
                                     "true"
                                  }
                          }
            };
            return resultObj;
        }
        public object GetAllProductCategory()
        {
            IProductCategoryService productCategoryService = new ProductCategoryService();

            return productCategoryService.GetProductCategory().Where(s=>s.Depth!=0).ToList();
        }