public void SortByLastName() { Console.WriteLine("Do you want to sort list of male or female players by their last names?"); Console.Write("Write 'Male' or 'Female'... "); var gender = Console.ReadLine(); if (gender.Equals("Male")) { ReadFile read = new ReadFile(); List <Player> males = read.GetPlayers(@"../../tennis_data\MalePlayer.txt", gender); List <Player> sortedMales = males.OrderBy(x => x.LastName).ToList(); foreach (var m in sortedMales) { Console.WriteLine(m); } } else if (gender.Equals("Female")) { ReadFile read = new ReadFile(); List <Player> females = read.GetPlayers(@"../../tennis_data\FemalePlayer.txt", gender); List <Player> sortedFemales = females.OrderBy(x => x.LastName).ToList(); foreach (var m in sortedFemales) { Console.WriteLine(m); } } else { Console.WriteLine("Write 'Male' or 'Female' "); SortByLastName(); } }
public void StartGame(string playersFilePath, string refereesFilePath, int numberOfPlayers, int numberOfReferees, string sex) { List <Player> players = new List <Player>(); List <Referee> referees = new List <Referee>(); Simulation runGame = new Simulation(); ReadFile read = new ReadFile(); players = read.GetPlayers(playersFilePath, sex); referees = read.GetReferee(refereesFilePath, sex); runGame.Games(GetLimitOfPlayers(players, numberOfPlayers), (GetLimitOfReferees(referees, numberOfReferees))); }
public void AddGameMaster() { var gm = Console.ReadLine(); ReadFile read = new ReadFile(); List <GameMaster> gameMasters = read.GetGameMaster(@"../../tennis_data\FemaleRefs.txt", "Female"); foreach (var g in gameMasters) { if (g.FirstName == gm) { Console.WriteLine(g); } } }