public static void UpdateTournamentResults(Tournament model)
        {
            int            startingRound   = model.CheckCurrentRound();
            List <Matchup> matchupsToScore = new List <Matchup>();

            foreach (List <Matchup> round in model.Rounds)
            {
                foreach (Matchup match in round)
                {
                    if (match.Winner == null && (match.Entries.Any(x => x.Score != 0) || match.Entries.Count == 1))
                    {
                        matchupsToScore.Add(match);
                    }
                }
            }

            MarkWinnersInMatchups(matchupsToScore);

            AdvanceWinners(matchupsToScore, model);

            matchupsToScore.ForEach(m => GlobalConfig.Connection.UpdateMatchup(m));

            int endingRound = model.CheckCurrentRound();

            if (endingRound > startingRound)
            {
                model.AlertUsersToNewRound();
            }
        }
Exemple #2
0
        public static void UpdateTournamentResults(Tournament model)
        {
            int            startingRound = model.CheckCurrentRound();
            List <Matchup> toScore       = new List <Matchup>();

            foreach (List <Matchup> round in model.Rounds)
            {
                foreach (Matchup rm in round)
                {
                    if (rm.Winner == null && (rm.Entrys.Any(x => x.Score != 0) || rm.Entrys.Count == 1))
                    {
                        toScore.Add(rm);
                    }
                }
            }

            MarkWinnerInMatchup(toScore);
            AdvanceWinners(toScore, model);


            toScore.ForEach(x => GlobalConfig.Connection.UpdateMatchup(x));

            int endingRound = model.CheckCurrentRound();

            if (endingRound > startingRound)
            {
                model.AlertUsersToNewRound();
            }
        }
Exemple #3
0
        public static void AlertUsersToNewRound(this Tournament model)
        {
            int currentRoundNum = model.CheckCurrentRound();
            List <MatchupModel> currentRound = model.Rounds.Where(x => x.First().MatchupRound == currentRoundNum).First();

            foreach (MatchupModel matchup in currentRound)
            {
                foreach (MatchupEntryModel me in matchup.Entries)
                {
                    foreach (PersonModel person in me.TeamCompeting.TeamMembers)
                    {
                        AlertPersonToNewRound(person, me.TeamCompeting.TeamName, matchup.Entrys.Where(y => y.TeamCompeting != me.TeamCompeting).FirstOrDefault());
                    }
                }
            }
        }
        public static void AlertUsersToNewRound(this Tournament model)
        {
            int            currentRoundIndex = model.CheckCurrentRound();
            List <Matchup> currentRound      = model.Rounds.Where(r => r.First().MatchupRound == currentRoundIndex).First();

            foreach (Matchup match in currentRound)
            {
                foreach (MatchupEntry me in match.Entries)
                {
                    foreach (Person p in me.TeamCompeting.TeamMembers)
                    {
                        AlertPersonToNewRound(p, me.TeamCompeting.TeamName,
                                              match.Entries.Where(x => x.TeamCompeting != me.TeamCompeting).FirstOrDefault());
                    }
                }
            }
        }