public List<ProductCategory> GetAllProductCategory()
        {
            var categoryList = new List<ProductCategory>();
            var category = new ProductCategory();
            category.id = 1;
            category.name = "测试数据1";
            category.parent_id = 0;
            category.is_delete = "0";
            categoryList.Add(category);

            category = new ProductCategory();
            category.id = 2;
            category.name = "测试数据2";
            category.parent_id = 1;
            category.is_delete = "0";
            categoryList.Add(category);

            category = new ProductCategory();
            category.id = 3;
            category.name = "测试数据3";
            category.parent_id = 0;
            category.is_delete = "0";
            categoryList.Add(category);

            category = new ProductCategory();
            category.id = 4;
            category.name = "测试数据4";
            category.parent_id = 3;
            category.is_delete = "0";
            categoryList.Add(category);
            return categoryList;
        }
 private void ChooseCategoryClick(object sender, EventArgs e)
 {
     var id = treeList1.FocusedNode.GetValue(CategoryId);
     productCategory = categoryList.Find(c => c.id == Convert.ToInt32(id));
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Example #3
0
 public IList<ProductCategory> AddProduct()
 {
     IList<ProductCategory> AD = new BindingList<ProductCategory>();
     ProductCategory m = new ProductCategory ();
     m.name  = "测试";
     AD.Add(m);
     return AD;
 }
 private void AddProductCategory(int parentId)
 {
     var addCategory = new AddProductCategory();
     var category = new ProductCategory();
     category.parent_id = parentId;
     addCategory.productCategory = category;
     addCategory.ShowDialog();
     if (addCategory.DialogResult == DialogResult.OK)
     {
         categoryList.Add(addCategory.productCategory);
         TreeDataBind(categoryList);
     }
 }
 private bool AddCategory(ProductCategory category)
 {
     return false;
 }
 public bool AddORUpdateCategory(ProductCategory category)
 {
     return category.id == 0 ? AddCategory(category) : UpdateCategory(category);
 }
 private bool UpdateCategory(ProductCategory category)
 {
     return false;
 }