Esempio n. 1
0
        // constructor
        public Tournament(string name, int year, string fromDate, string toDate, List <TennisPlayer> playersInTournament, List <Referee> refereesInTournament)
        {
            Name     = name;
            Year     = year;
            FromDate = DateTime.ParseExact(fromDate, "yyyy-MM-dd", null);
            ToDate   = DateTime.ParseExact(toDate, "yyyy-MM-dd", null);

            if (FromDate > ToDate)
            {
                throw new TournamentDatesException("Dates are incorrect");
            }

            NumOfPlayers         = playersInTournament.Count;
            NumOfMatches         = InitialMatches(NumOfPlayers);
            PlayersInTournament  = playersInTournament;
            RefereesInTournament = refereesInTournament;
            Gamemaster           = SetGamemaster();
        }
Esempio n. 2
0
        private Gamemaster SetGamemaster()
        {
            // pick a random referee and set to game master
            Referee referee = RefereesInTournament[rnd.Next(1, RefereesInTournament.Count)];

            // Map the properties
            string firstName      = referee.FirstName;
            string middleName     = referee.MiddleName;
            string lastName       = referee.LastName;
            string dateOfBirth    = referee.DateOfBirth.ToString("yyyy-MM-dd");
            sex    gender         = referee.Gender;
            string nationality    = referee.Nationality;
            string licenseAquired = referee.LicenseAquired.ToString("yyyy-MM-dd");
            string licenseRenewed = referee.LicenseRenewed.ToString("yyyy-MM-dd");

            // return game master
            Gamemaster gamemaster = new Gamemaster(firstName, middleName, lastName, dateOfBirth, gender, nationality, licenseAquired, licenseRenewed);

            return(gamemaster);
        }