OrgChartEntries.cs 534 B

12345678910111213141516171819
  1. using System.Collections.ObjectModel;
  2. using System.Linq;
  3. namespace PRSDesktop
  4. {
  5. public class OrgChartEntries : ObservableCollection<OrgChartEntry>
  6. {
  7. public bool IsChildOf(OrgChartEntry child, OrgChartEntry parent)
  8. {
  9. if (child == null)
  10. return false;
  11. if (parent == null)
  12. return false;
  13. if (parent == child)
  14. return true;
  15. return IsChildOf(this.FirstOrDefault(x => x.ID == child.ParentID), parent);
  16. }
  17. }
  18. }