/// <summary> /// Builds the random batter. /// </summary> /// <param name="firstName">The first name.</param> /// <param name="lastName">The last name.</param> /// <param name="statStartingYear">The stat starting year.</param> /// <param name="statEndingYear">The stat ending year.</param> /// <returns>The batter.</returns> public static Batter BuildRandomBatter(string firstName, string lastName, int statStartingYear, int statEndingYear) { var batter = new Batter(); batter.FirstName = firstName; batter.LastName = lastName; batter.Number = random.Next(0, 60); batter.BuildRandomStats(statStartingYear, statEndingYear); batter.Position = GetRandomPosition(); return(batter); }
/// <summary> /// Builds the team one batters. /// </summary> private void BuildTeamOneBatters() { var teamOneTeams = BuildTeamOneTeams(); var unsortedBatters = new List <Batter>(); for (int i = 0; i < TeamOneBatterFirstNames.Count(); i++) { string firstName = TeamOneBatterFirstNames.ElementAt(i); string lastName = TeamOneBatterLastNames.ElementAt(i); var batter = Batter.BuildRandomBatter(firstName, lastName, StartingYear, EndingYear); int teamIndex = random.Next(0, teamOneTeams.Count()); batter.Team = teamOneTeams.ElementAt(teamIndex); unsortedBatters.Add(batter); } foreach (var batter in unsortedBatters.OrderBy(batter => batter.OrderedName)) { TeamOneBatters.Add(batter); } SelectedTeamOneBatter = teamOneBatters[0]; }