/// <summary> /// Metod koj go polni i vraka mnozestvoto NBOTreeHierarchicalEnumerable /// so elementi - deca na konkreten korisnik (userID) /// </summary> /// <returns>IHierarchicalEnumerable</returns> public IHierarchicalEnumerable GetChildren() { NBOTreeHierarchicalEnumerable children = new NBOTreeHierarchicalEnumerable(); foreach (INBOTreeNode item in treeItem.GetChildren(userId)) { children.Add(item); } return(children); }
/// <summary> /// Metod koj vrsi override na Select od klasata IHierarchicalEnumerable so cel /// koj vo zavisnost od vrednosta na atributot _viewPath go polni /// numeriranoto mnozestvo IHierarchicalEnumerable so zaglavija (ako _viewPath e prazno) /// ili so decata od hierarhijata na konkretniot korisnik (ako _viewPath ima vrednost) /// </summary> /// <returns>NBOTreeHierarchicalEnumerable</returns> public override IHierarchicalEnumerable Select() { NBOTreeHierarchicalEnumerable result = new NBOTreeHierarchicalEnumerable(); List <INBOTreeNode> roots = new List <INBOTreeNode>(); if (_viewPath == "") { if (_typeName == "WebPage") { roots.AddRange(new WebPage().GetRoots(_userId)); } if (_typeName == "User") { roots.AddRange(new Broker.DataAccess.User().GetRoots(_userId)); } if (_typeName == "OrdinaryUser") { roots.AddRange(new OrdinaryUser().GetRoots(_userId)); } if (_typeName == "SEUser") { roots.AddRange(new SEUser().GetRoots(_userId)); } } else { if (_typeName == "WebPage") { INBOTreeNode node = new WebPage().GetById(Convert.ToInt32(_viewPath)); roots.AddRange(node.GetChildren(_userId)); } if (_typeName == "User") { INBOTreeNode node = new Broker.DataAccess.User().GetById(Convert.ToInt32(_viewPath)); roots.AddRange(node.GetChildren(_userId)); } if (_typeName == "OrdinaryUser") { INBOTreeNode node = new OrdinaryUser().GetById(Convert.ToInt32(_viewPath)); roots.AddRange(node.GetChildren(_userId)); } if (_typeName == "SEUser") { INBOTreeNode node = new SEUser().GetById(Convert.ToInt32(_viewPath)); roots.AddRange(node.GetChildren(_userId)); } } if (first) { foreach (INBOTreeNode node in roots) { result.Add(new NBOTreeHierarchyData(node, _userId, _typeName)); } } first = false; return(result); }
/// <summary> /// Metod koj vraka nova instanca od objektot NBOTreeHierarchyData /// napolneta so roditeli /// </summary> /// <returns>IHierarchyData</returns> public IHierarchyData GetParent() { NBOTreeHierarchicalEnumerable parentContainer = new NBOTreeHierarchicalEnumerable(); return(new NBOTreeHierarchyData(treeItem.GetParent())); }