public static IEnumerable <MonitoredSystem> GetMonitoredSystems(this TileableElement element) { var result = new List <MonitoredSystem>(); if (element is MonitoredSystem) { result.Add(element as MonitoredSystem); } else { var value = element as OrganizationalUnit; // Add own monitoredsystems result.AddRange(from p in value.Elements where (p as MonitoredSystem) != null select p as MonitoredSystem); // Add monitoredsystems of child OUs (from p in value.Elements where (p as OrganizationalUnit) != null select p as OrganizationalUnit).ToList().ForEach(p => result.AddRange(p.GetMonitoredSystems())); } return(result); }
public int CompareTo(TileableElement obj) { if (obj == null) { return(1); } return(this.SortingProperty.CompareTo(obj.SortingProperty)); }
public static IEnumerable <OrganizationalUnit> GetOrganizationalUnits(this TileableElement element) { var result = new List <OrganizationalUnit>(); if (element is OrganizationalUnit) { var value = element as OrganizationalUnit; // Add the element itself result.Add(value); // Add monitoredsystems of child OUs (from p in value.Elements where (p as OrganizationalUnit) != null select p as OrganizationalUnit).ToList().ForEach(p => result.AddRange(p.GetOrganizationalUnits())); } return(result); }