public static bool AddCategory(CategoryInfo category) { if (category == null) { return(false); } CategoryDao categoryDao = new CategoryDao(); category.CategoryId = categoryDao.GetMaxDisplaySequence <CategoryInfo>(); int categoryId; if (category.ParentCategoryId > 0) { CategoryInfo category2 = CatalogHelper.GetCategory(category.ParentCategoryId); string path = category2.Path; categoryId = category.CategoryId; category.Path = path + "|" + categoryId.ToString(); category.Depth = category2.Depth + 1; } else { categoryId = category.CategoryId; category.Path = categoryId.ToString(); category.Depth = 1; } Globals.EntityCoding(category, true); bool flag = categoryDao.Add(category, null) > 0; if (flag) { EventLogs.WriteOperationLog(Privilege.AddProductCategory, string.Format(CultureInfo.InvariantCulture, "创建了一个新的店铺分类:”{0}”", new object[1] { category.Name }), false); HiCache.Remove("DataCache-Categories"); } return(flag); }