Exemplo n.º 1
0
        private void CategoryTreeviewRefresh()
        {
            treeViewHierarchy.Nodes.Clear();

            var productCategoryService = new CategorySearchService();
            List <CategoryTreeContract> productCategoryContracts = productCategoryService.CategoryTree();

            foreach (CategoryTreeContract productCategoryContract in productCategoryContracts)
            {
                // first level is it's own parent
                if (productCategoryContract.ProductCategoryId != productCategoryContract.ProductCategoryParentId)
                {
                    continue;
                }

                TreeNode node = treeViewHierarchy.Nodes.Add(productCategoryContract.ProductCategoryId.ToString(),
                                                            productCategoryContract.ProductCategoryName);

                AddCategory(productCategoryContracts,
                            node,
                            productCategoryContract.ProductCategoryId
                            );
            }
        }