Exemplo n.º 1
0
 public SeasonDivisionRule(SeasonCompetitionConfig competition, string divisionName, SeasonDivisionRule parent, int level, int order, IEnumerable <SeasonTeamRule> teams, int?firstYear, int?lastYear)
 {
     Competition  = competition;
     DivisionName = divisionName;
     Parent       = parent;
     Teams        = teams;
     FirstYear    = firstYear;
     LastYear     = lastYear;
     Ordering     = order;
     Level        = level;
 }
Exemplo n.º 2
0
        public virtual List <SeasonDivisionRule> GetChildDivisions(SeasonDivisionRule parentRule)
        {
            var result = new List <SeasonDivisionRule>();

            DivisionRules.Where(dr => dr.Parent != null && dr.Parent.DivisionName == parentRule.DivisionName).ToList().ForEach(division =>
            {
                result.Add(division);
                result.AddRange(GetChildDivisions(division));
            });

            return(result);
        }
Exemplo n.º 3
0
        public virtual List <CompetitionTeam> GetTeams(Season season, Team team, SeasonDivisionRule divisionRule)
        {
            var teams = new List <CompetitionTeam>();

            if (team != null)
            {
                teams.Add(season.Teams.Where(t => t.Parent.Id == team.Id).First());
            }
            else if (divisionRule != null)
            {
                teams.AddRange(season.GetAllTeamsInDivision(season.GetDivisionByName(divisionRule.DivisionName)));
            }
            else
            {
                return(null);
            }

            return(teams);
        }