Esempio n. 1
0
        static TournamentUsers GetTournamentLosers(Cxt cxt, int tournamentID, int round)
        {
            DataTable       dtLosers = TournamentRounds.GetTournamentLosersByRound(tournamentID, round - 1);
            TournamentUsers tuLosers = new TournamentUsers(cxt, dtLosers);

            return(tuLosers);
        }
Esempio n. 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);
        }