コード例 #1
0
        public void Init()
        {
            Console.WriteLine("Initialiserer \"BADCODE\"...");
            TeamRepo   teamRepository   = new TeamRepo();
            PlayerRepo playerRepository = new PlayerRepo();
            string     tournamentName   = "X";
            Tournament tournament       = new Tournament(tournamentName);

            Console.WriteLine("Registrerer spillere...");
            playerRepository.RegisterPlayer("Laust Ulriksen");
            playerRepository.RegisterPlayer("Matthias Therkelsen", null, "*****@*****.**", "+45 47002155");
            playerRepository.RegisterPlayer("Martin Bertelsen", "Nyborgvej 10, Odense", null, "+45 22521112");
            playerRepository.RegisterPlayer("Line Madsen", "Kochsgade 21, Odense", "*****@*****.**", "+45 00142563");
            playerRepository.RegisterPlayer(new Player("Jette Detlevsen"));

            Console.WriteLine("Registrerer teams...");
            // initialize with a default set of teams
            teamRepository.RegisterTeam("A");
            teamRepository.RegisterTeam("B");
            teamRepository.RegisterTeam("C");
            teamRepository.RegisterTeam("D");
            teamRepository.RegisterTeam("E");
            Console.WriteLine("Tilføjer spillere til teams...");
            // Add players to teams
            Team FCK = teamRepository.GetTeam("A");

            FCK.AddPlayer(playerRepository.GetPlayer("Laust Ulriksen"));
            Team OB = teamRepository.GetTeam("B");

            FCK.AddPlayer(playerRepository.GetPlayer("Matthias Therkelsen"));
            Team BiF = teamRepository.GetTeam("C");

            BiF.AddPlayer(playerRepository.GetPlayer("Martin Bertelsen"));
            Team Hobro = teamRepository.GetTeam("D");

            Hobro.AddPlayer(playerRepository.GetPlayer("Line Madsen"));
            Team AGF = teamRepository.GetTeam("E");

            AGF.AddPlayer(playerRepository.GetPlayer("Jette Detlevsen"));

            Console.WriteLine("Registrerer Liga...");
            // initialize with a default tournament
            tournamentRepository.RegisterTournament(tournament);

            Console.WriteLine("Tilføjer teams til Liga...");
            // Add teams to tournament
            tournament = tournamentRepository.GetT(tournamentName);
            tournament.AddTeam(FCK);
            tournament.AddTeam(OB);
            tournament.AddTeam(BiF);
            tournament.AddTeam(Hobro);
            tournament.AddTeam(AGF);

            Console.WriteLine("Planlægger 1. runde...");
            // Initialize first round (this also initializes matches)
            ScheduleNewRound(tournamentName);
        }
コード例 #2
0
 public void AddTeam(Team t)
 {
     teams.RegisterTeam(t);
 }