public void InsertCategoryBTS(string categotyName) { bool isAdded = false; for (int i = 0; i < Categories.Count; i++) { if (Categories[i].CategoryName.Equals(categotyName)) { isAdded = true; } } if (!isAdded) { CategoryBST category = new CategoryBST(); category.CategoryName = categotyName; Categories.Add(category); } }
public void InsertProduct(Product product, string productType, string CategoryName) { bool isAdded = false; for (int i = 0; i < Categories.Count; i++) { if (Categories[i].CategoryName.Equals(CategoryName)) { isAdded = true; Categories[i].Insert(product, productType); ProductsList.Add(product); } } if (!isAdded) { CategoryBST category = new CategoryBST(); category.CategoryName = CategoryName; category.Insert(product, productType); Categories.Add(category); ProductsList.Add(product); } }