public int BuildTreeNode(BusinessBase businessObject, int parentId, bool initiallyExpanded) { int id = GetUid(); if (BusinessObjectTree != null) { var brokenRulesCollector = new BrokenRulesCollector(businessObject); brokenRulesCollector.Collect(); BusinessObjectTree.Add(new TreeNode(id, parentId, ((IDisplayTexts) businessObject).ToDisplayText(), businessObject, brokenRulesCollector.BrokenRules, initiallyExpanded)); } return id; }
public int BuildTreeNodesFromListAndChilds(IList list, int parentId, bool initiallyExpanded) { int id = GetUid(); if (BusinessObjectTree != null) { BusinessObjectTree.Add(new TreeNode(id, parentId, ((IDisplayTexts) list).ToDisplayText(), list, null, initiallyExpanded)); parentId = id; foreach (BusinessBase businessObject in list) { id = GetUid(); var brokenRulesCollector = new BrokenRulesCollector(businessObject); brokenRulesCollector.Collect(); BusinessObjectTree.Add(new TreeNode(id, parentId, ((IDisplayTexts) businessObject).ToDisplayText(), businessObject, brokenRulesCollector.BrokenRules, initiallyExpanded)); } } return id; }