public string AddCategory(string categoryCode, string categoryName, string pid, int type, int status, List<string> attrlist, List<string> saleattr, string description, string operateid) { var dal = new ProductsDAL(); string guid = dal.AddCategory(categoryCode, categoryName, pid, type, status, string.Join(",", attrlist), string.Join(",", saleattr), description, operateid); if (!string.IsNullOrEmpty(guid)) { if (string.IsNullOrEmpty(pid)) { CacheCategory.Add(new Category() { CategoryID = guid.ToLower(), CategoryCode = categoryCode, CategoryName = categoryName, CategoryType = type, Layers = 1, PID = pid, Status = status, Description = description, ChildCategory = new List<Category>() }); } else { var PModel = GetCategoryByID(pid); var model = new Category() { CategoryID = guid.ToLower(), CategoryCode = categoryCode, CategoryName = categoryName, CategoryType = type, Layers = PModel.Layers + 1, PID = pid, Status = status, Description = description }; CacheCategory.Add(model); PModel.ChildCategory.Add(model); } } return guid; }