Exemple #1
0
        /// <summary>
        /// Get Rated player from tournamentmatches
        /// GetTournamentWinners
        /// </summary>
        /// <param name="tournamentID"></param>
        /// <param name="round"></param>
        /// <returns></returns>
        static TournamentUsers GetTournamentWinners(Cxt cxt, int tournamentID, int round)
        {
            DataTable       dtWinners = TournamentRounds.GetTournamentWinnersByRound(tournamentID, round - 1);
            TournamentUsers tuWinners = new TournamentUsers(cxt, dtWinners);

            return(tuWinners);
        }
Exemple #2
0
        static int GetRoundInProgress(Cxt cxt, Tournament tournament)
        {
            DataTable dt = TournamentMatches.GetTournamentsMatchByTournamentID(tournament.TournamentID);
            DataTable dtTournamentUsers = TournamentUsers.GetTournamentUsersByTournamentID(StatusE.Active, tournament.TournamentID);

            foreach (DataRow item in dt.Rows)
            {
                TournamentMatch tm = new TournamentMatch(cxt, item);
                if (tm.TournamentMatchStatusE == TournamentMatchStatusE.InProgress || tm.TournamentMatchStatusE == TournamentMatchStatusE.Scheduled)
                {
                    return((int)MsgE.ErrorTournamentNextRoundStarted);
                }
            }

            object    objId    = dt.Compute("max(Round)", "");
            int       round    = Convert.ToInt32(objId);
            DataTable dtRounds = TournamentRounds.GetTournamentWinnersByRound(tournament.TournamentID, round);

            if (round == 0 && TournamentMatch.IsPreliminaryRound(round, dtTournamentUsers)) // if it is prelimiry round
            {
                if (dtRounds.Rows.Count == TournamentMatch.CountPreliminaryRoundUsers(dtTournamentUsers))
                {
                    return(0);
                }
                else
                {
                    return((int)MsgE.ErrorTournamentNextRoundStarted);
                }
            }

            DataTable dtUsers = TournamentUsers.GetTournamentUsersByRound(tournament.TournamentID, round);

            if (dtRounds.Rows.Count != dtUsers.Rows.Count / 2)
            {
                return((int)MsgE.ErrorTournamentNextRoundStarted);
            }

            return(0);
        }