예제 #1
0
        static void Main(string[] args)
        {
            ITeamsRepository  teamsRepo        = new TeamsRepository();
            IBracketGenerator bracketGenerator = new BracketGenerator();
            IMatchupService   matchupService   = new MatchupService();
            IWinnersService   winnersService   = new WinnersService();

            var roundOf64Teams = teamsRepo.GetTeams();

            var roundOf64Matchups = matchupService.GetMatchups(roundOf64Teams);

            ValidateMatchupCount(32, roundOf64Matchups.Count);
            var roundOf64Winners = winnersService.PredictWinners(roundOf64Matchups);

            var roundOf32Matchups = matchupService.GetMatchups(roundOf64Winners);

            ValidateMatchupCount(16, roundOf32Matchups.Count);
            var roundOf32Winners = winnersService.PredictWinners(roundOf32Matchups);

            var sweetSixteenMatchups = matchupService.GetMatchups(roundOf32Winners);

            ValidateMatchupCount(8, sweetSixteenMatchups.Count);
            var sweetSixteenWinners = winnersService.PredictWinners(sweetSixteenMatchups);

            var eliteEightMatchups = matchupService.GetMatchups(sweetSixteenWinners);

            ValidateMatchupCount(4, eliteEightMatchups.Count);
            var eliteEightWinners = winnersService.PredictWinners(eliteEightMatchups);

            var finalFourMatchups = matchupService.GetMatchups(eliteEightWinners);

            ValidateMatchupCount(2, finalFourMatchups.Count);
            var finalFourWinners = winnersService.PredictWinners(finalFourMatchups);

            var championshipMatchup = matchupService.GetMatchups(finalFourWinners);

            ValidateMatchupCount(1, championshipMatchup.Count);
            var championshipWinner = winnersService.PredictWinners(championshipMatchup);

            var allMatchups = roundOf64Matchups.Concat(roundOf32Matchups).Concat(sweetSixteenMatchups)
                              .Concat(eliteEightMatchups).Concat(finalFourMatchups).Concat(championshipMatchup).ToList();

            var allWinners = roundOf64Winners.Concat(roundOf32Winners).Concat(sweetSixteenWinners)
                             .Concat(eliteEightWinners).Concat(finalFourWinners).Concat(championshipWinner).ToList();

            bracketGenerator.GenerateBracket(allMatchups, allWinners);

            Console.WriteLine("Your bracket has been generated. Press [enter] to exit.");
            Console.ReadLine();
        }
예제 #2
0
        private void InitializeCommands()
        {
            AddStadiumCommand    = new RelayCommand(AddStadium);
            RemoveStadiumCommand = new RelayCommand(RemoveStadium);
            EditStadiumCommand   = new RelayCommand(EditStadium);

            AddClubCommand    = new RelayCommand(AddClub);
            RemoveClubCommand = new RelayCommand(RemoveClub);
            EditClubCommand   = new RelayCommand(EditClub);

            AddTicketCommand    = new RelayCommand(AddTicket);
            RemoveTicketCommand = new RelayCommand(RemoveTicket);
            EditTicketCommand   = new RelayCommand(EditTicket);

            AddMatchCommand    = new RelayCommand(AddMatch);
            RemoveMatchCommand = new RelayCommand(RemoveMatch);
            EditMatchCommand   = new RelayCommand(EditMatch);

            AddReffereCommand    = new RelayCommand(AddReffere);
            RemoveReffereCommand = new RelayCommand(RemoveReffere);
            EditReffereCommand   = new RelayCommand(EditReferee);

            AddPlayerCommand    = new RelayCommand(AddPlayer);
            RemovePlayerCommand = new RelayCommand(RemovePlayer);
            EditPlayerCommand   = new RelayCommand(EditPlayer);

            AddRecordCommand    = new RelayCommand(AddRecord);
            RemoveRecordCommand = new RelayCommand(RemoveRecord);
            EditRecordCommand   = new RelayCommand(EditRecord);

            AddTimetableCommand    = new RelayCommand(AddTimetable);
            RemoveTimetableCommand = new RelayCommand(RemoveTimetable);
            EditTimetableCommand   = new RelayCommand(EditTimetable);

            AddStaffCommand    = new RelayCommand(AddStaff);
            RemoveStaffCommand = new RelayCommand(RemoveStaff);
            EditStaffCommand   = new RelayCommand(EditStaff);

            AddWinnersCommand    = new RelayCommand(AddWinners);
            RemoveWinnersCommand = new RelayCommand(RemoveWinners);
            EditWinnersCommand   = new RelayCommand(EditWinners);

            stadium       = new ObservableCollection <StadiumViewModel>();
            club          = new ObservableCollection <ClubViewModel>();
            match         = new ObservableCollection <MatchViewModel>();
            ticket        = new ObservableCollection <TicketViewModel>();
            reffere       = new ObservableCollection <ReffereViewModel>();
            player        = new ObservableCollection <PlayerViewModel>();
            record        = new ObservableCollection <RecordViewModel>();
            timetable     = new ObservableCollection <TimetableViewModel>();
            trainingStaff = new ObservableCollection <TrainingStaffViewModel>();
            winners       = new ObservableCollection <WinnersViewModel>();

            stadiumService       = new StadiumService();
            clubService          = new ClubService();
            ticketService        = new TicketService();
            matchService         = new MatchService();
            reffereService       = new ReffereService();
            playerService        = new PlayerService();
            recordService        = new RecordService();
            timetableService     = new TimetableService();
            trainingStaffService = new TrainingStaffService();
            winnersService       = new WinnersService();
        }