static void walkThroughStore (HumanRightsViolation record, HumanRightsViolationNode parent) { foreach(HumanRightsViolation childRecord in record.Children) { if (childRecord.Children.Count == 0) parent.AddChild(new HumanRightsViolationNode(childRecord)); else { HumanRightsViolationNode subparent = new HumanRightsViolationNode(childRecord); walkThroughStore(childRecord, subparent); parent.AddChild(subparent); } } }
public void FilterByCategoryId(int category_id) { HumanRightsViolation[] parents = HumanRightsViolation.FindAllByCategoryId (category_id); store.Clear(); foreach (HumanRightsViolation record in parents ) { if (record.Children.Count > 0) { HumanRightsViolationNode parent = new HumanRightsViolationNode(record); store.AddNode (parent); walkThroughStore (record, parent); } else store.AddNode (new HumanRightsViolationNode(record)); } }