예제 #1
0
 public SeasonCompetitionConfigFinalRankingRule(SeasonCompetitionConfig config, string name, int?rank, string teamsComeFromGroupName, int?startingRank, int?endingRank, int?firstYear, int?lastYear)
     : base(config, name, rank, firstYear, lastYear)
 {
     TeamsComeFromGroup = teamsComeFromGroupName;
     StartingRank       = startingRank;
     EndingRank         = endingRank;
 }
예제 #2
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;
 }
예제 #3
0
        public bool ConfigIsActive(SeasonCompetitionConfig config, int year)
        {
            bool valid = true;

            if (!config.IsActive(year))
            {
                var type    = "SeasonCompetitionConfig";
                var message = "Competition Configuration is not active for year.";
                var data    = string.Format("Id:{0} Name:{1} Year:{2}", config.Id, config.Name, year);
                var result  = string.Format(messageFormat, type, message, data);
                Messages.Add(result);
            }

            return(valid);
        }
예제 #4
0
        public SeasonCompetitionConfigValidator(SeasonCompetitionConfig config)
        {
            //var divisionCounts = new Dictionary<string, SortedSet<string>>();
            //var teamCounts = new Dictionary<long, SortedSet<string>>();
            //Messages = new List<string>() { "Setting up validator" };

            //"TeamA:TeamB", 0
            //"TeamA:Home", 0
            //"TeamA:Away", 0
            //"TeamA:Home:DIVISION", 0
            //var gameCounts = new Dictionary<string, int>();

            //var teamNames = config.TeamRules.Select(tr => tr.Team.Name).ToList();
            //var divisionNames = config.DivisionRules.Select(dr => dr.DivisionName).ToList();
        }
예제 #5
0
        public bool Validate(SeasonCompetitionConfig config, int year)
        {
            Messages = new List <string>();

            var activeTeamRules     = config.TeamRules.Where(t => t.IsActive(year)).ToList();
            var activeDivisionRules = config.DivisionRules.Where(d => d.IsActive(year)).ToList();
            var activeScheduleRules = config.ScheduleRules.Where(s => s.IsActive(year)).ToList();

            bool valid = true;

            //are all teams active?

            valid = valid && ConfigIsActive(config, year);
            valid = valid && ValidateActiveTeams(activeTeamRules, year);
            valid = valid && ValidateDivisionRuleExistsForTeamRules(activeDivisionRules, activeTeamRules);
            valid = valid && ValidateScheduleRules(activeScheduleRules, activeTeamRules, activeDivisionRules, year);

            return(valid);
        }