Example #1
0
 public int GetNestedChildrenDepth(RosterManagerViewModelComponent parent, int depth = 0)
 {
     if (parent.Children.Any())
     {
         foreach (RosterManagerViewModelComponent c in parent.Children)
         {
             GetNestedChildrenDepth(c, depth++);
         }
     }
     return(depth);
 }
Example #2
0
 private List <BundledGenderRankDemoCollectionObject> RecurseForChildComponentDemoTotals(RosterManagerViewModelComponent c, List <BundledGenderRankDemoCollectionObject> demos)
 {
     if (c.Children.Count() > 0)
     {
         foreach (RosterManagerViewModelComponent chld in c.Children)
         {
             RecurseForChildComponentDemoTotals(chld, demos);
         }
     }
     foreach (Position p in c.Positions)
     {
         foreach (Member m in p.Members)
         {
             try
             {
                 demos.Single(x => x.RaceAbbreviation == m.Race.Abbreviation.ToString()).RankList.Single(x => x.RankName == m.Rank.RankShort).addToGenderCount(m.Gender.GenderFullName);
             }
             catch (Exception e)
             {
                 Console.Write(e.InnerException);
             }
         }
     }
     return(demos);
 }