예제 #1
0
        public void Init()
        {
            Console.WriteLine("Initialiserer \"BADCODE\"...");
            TeamRepo   teamRepository   = new TeamRepo();
            PlayerRepo playerRepository = new PlayerRepo();
            string     tournamentName   = "X";

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

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

            FCK.AddPlayer(playerRepository.GetByName("Laust Ulriksen"));
            FCK.AddPlayer(playerRepository.GetByName("Matthias Therkelsen"));
            Team OB  = teamRepository.GetByName("B");
            Team BiF = teamRepository.GetByName("C");

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

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

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

            Console.WriteLine("Registrerer Liga...");
            // initialize with a default tournament
            tournamentRepository.Insert(new Tournament(tournamentName));
            Tournament tournament = tournamentRepository.GetByName(tournamentName);

            Console.WriteLine("Tilføjer teams til Liga...");
            // Add teams to tournament
            tournament = tournamentRepository.GetByName(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 Team GetTeam(string name)
 {
     return(teamRepo.GetByName(name));
 }