Пример #1
0
        public Team CreateTeam()
        {
            var teamName = this.GetTeamName();

            var team = new Team(teamName);

            return team;
        }
Пример #2
0
 /// <summary>
 ///     Adds the team to tournament.
 /// </summary>
 /// <param name="team">The team.</param>
 public void AddTeamToCompetition(Team team)
 {
     foreach (var originalTeam in this.Teams)
     {
         if (originalTeam.Name.Equals(team.Name))
         {
             throw new ArgumentException("You cannot have two teams with the same name.");
         }
     }
     this.Teams.Add(team);
 }
        public TransferPlayerForm(Season season, Team originalTeam, Player player)
        {
            InitializeComponent();
            this.Season = season;
            this.OriginalTeam = originalTeam;
            this.Player = player;

            var teamSource = new Dictionary<int, string>();
            foreach (var team in this.Season.Teams)
            {
                teamSource.Add(this.Season.Teams.IndexOf(team), team.Name);
            }

            this.cmbBoxOriginalTeam.DataSource = new BindingSource(teamSource, null);
            this.cmbBoxNewTeam.DataSource = new BindingSource(teamSource, null);

            this.cmbBoxOriginalTeam.DisplayMember = "Value";
            this.cmbBoxNewTeam.DisplayMember = "Value";
            this.cmbBoxPlayer.DisplayMember = "Value";
        }
Пример #4
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Match" /> class.
        /// </summary>
        /// <param name="homeTeam">The home team.</param>
        /// <param name="awayTeam">The away team.</param>
        /// <param name="number">The number.</param>
        /// <exception cref="System.ArgumentException">Input teams cannot be null.</exception>
        public Match(Team homeTeam, Team awayTeam, int number)
        {
            if (homeTeam == null || awayTeam == null)
            {
                throw new ArgumentException("Input teams cannot be null.");
            }
            if (homeTeam == awayTeam)
            {
                throw new ArgumentException("A team cannot play itself.");
            }

            this.MatchNumber = number;
            this.HomeTeam = homeTeam;
            this.HomeTeamScore = 0;
            this.AwayTeam = awayTeam;
            this.AwayTeamScore = 0;
            this.DateTime = DateTime.MinValue;
            this.IsFinished = false;
            this.homeGoalScorers = new Dictionary<Player, int>();
            this.awayGoalScorers = new Dictionary<Player, int>();
        }
Пример #5
0
 public void TransferPlayer(Player player, Team originalTeam, Team newTeam)
 {
     originalTeam.RemovePlayer(player);
     newTeam.AddPlayer(player);
     this.players[player] = newTeam;
 }
Пример #6
0
 public void CreatePlayer(String name, int number, Team team)
 {
     var player = new Player(name, number);
     team.AddPlayer(player);
     this.players.Add(player, team);
 }
Пример #7
0
 /// <summary>
 ///     Creates the match.
 /// </summary>
 /// <param name="homeTeam">The home team.</param>
 /// <param name="awayTeam">The away team.</param>
 public void CreateMatch(Team homeTeam, Team awayTeam)
 {
     var matchNumber = this.Matches.Count + 1;
     this.Matches.Add(new Match(homeTeam, awayTeam, matchNumber));
 }