예제 #1
0
        /// <summary>
        /// Tournament to complete.
        /// </summary>
        /// <param name="model">Tournament to complete.</param>
        public void CompleteTournament(TournamentModel model)
        {
            List <TournamentModel> tournament = GlobalConfig.TournamentFile.FullFilePath().LoadFile().ConvertToTournamentModel();

            tournament.Remove(model);

            tournament.SaveToTournamentFile();

            TournamentLogic.UpdateTournamentResults(model);
        }
예제 #2
0
        /// <summary>
        /// Creates a tournament.
        /// </summary>
        /// <param name="model">Model of the tournament.</param>
        public void CreateTournament(TournamentModel model)
        {
            List <TournamentModel> tournament = GlobalConfig.TournamentFile.FullFilePath().LoadFile().ConvertToTournamentModel();

            int currentId = 1;

            if (tournament.Count > 0)
            {
                currentId = currentId = tournament.OrderByDescending(x => x.Id).First().Id + 1;
            }

            model.Id = currentId;

            model.SaveRoundsToFile();

            tournament.Add(model);

            tournament.SaveToTournamentFile();

            TournamentLogic.UpdateTournamentResults(model);
        }
예제 #3
0
        /// <summary>
        /// Creates a new tournament.
        /// </summary>
        /// <param name="model">Model of the tournament.</param>
        public void CreateTournament(TournamentModel model)
        {
            // Connect to the database.
            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(Db)))
            {
                // Save the tournament data.
                this.SaveTournament(connection, model);

                // Save the prize data for this tournament.
                this.SaveTournamentPrizes(connection, model);

                // Save the entries data for this tournament.
                this.SaveTournamentEntries(connection, model);

                // Save the rounds data for this tournament.
                this.SaveTournamentRounds(connection, model);

                // Used to update the tournament (mainly for bye weeks).
                TournamentLogic.UpdateTournamentResults(model);
            }
        }