Exemplo n.º 1
0
		private TreeNode CreateHierarchyFromList(List<IncomeItemEntity> items)
		{
			TreeNode root = new TreeNode();
			root.Symbol = string.Empty;

			PopulateChildren(root, null, items);

			return root;
		}
Exemplo n.º 2
0
		private void PopulateChildren(TreeNode node, IncomeItemEntity info, List<IncomeItemEntity> items)
		{
			node.Children = items.Where(c => c.Parent == info).OrderBy(c => c.Id).Select(c =>
			{
				var tmp = new TreeNode();
				tmp.Symbol = c.Symbol;
				PopulateChildren(tmp, c, items);
				return tmp;
			}).ToList();
		}