Hi guys,
I have
Name Company Nr Mother Company Nr
Company A 100
Company B 101 100
Company C 102 100
Company D 103 102
Company E 104 100
in a BusinessObject that I extracted from an XML document
I need to show this in a Hierarchy Mode, and looking through MSDN I found the IHierarchicalEnumerable Interface, but I can't figure it out how to work with it.
my Hierarchy object is
// A collection of FileSystemHierarchyData objects
public class FileSystemHierarchicalEnumerable : ArrayList, IHierarchicalEnumerable
{
public FileSystemHierarchicalEnumerable()
: base()
{
}
public IHierarchyData GetHierarchyData(object enumeratedItem)
{
return enumeratedItem as IHierarchyData;
}
}
and I need to populate it, right?
I doing something like: void getHierarchy(System.Collections.Generic.List companies) { FileSystemHierarchicalEnumerable h = new FileSystemHierarchicalEnumerable();
foreach (CompanyHierarchy c in companies)
{
if (!h.Contains(c.CompanyNumber))
h.Add(c);
}
}
how do I ADD in the right Hierarchy ... where do I add what level it is, how do I get Company E to be added under Company A ?
I'm really strugling here, and even if I see that could be easy to get this, I can't figure it out :(
I really need help!