// //IDGOAL MINUTES IDMATCH IDPLAYER public void addGoal(int idGoal, int minutes, Player player) { Goal newGoal = new Goal(idGoal, minutes, this, player); if (player.Team.Id == HomeTeam.Id) { GoalsHome.Add(newGoal); } else if (player.Team.Id == GuestTeam.Id) { GoalsGuest.Add(newGoal); } else { throw new Exception("IGRACHOT KOJ DAL GOL NA MATCH SO ID: " + this.Id + " NE IGRA NITU ZA EDEN OD TIMOVITE!"); } }
private void fillGoals() { using (OracleConnection connection = new OracleConnection(FormLogin.connString)) { connection.Open(); String query = "SELECT * FROM goal WHERE idMatch =" + Id + " ORDER BY minutes"; OracleCommand command = new OracleCommand(query, connection); OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { Goal goal = new Goal(reader.GetInt32(0), reader.GetInt32(1), this, reader.GetInt32(3)); if (goal.Player.Team.Id == HomeTeam.Id) { GoalsHome.Add(goal); } else { GoalsGuest.Add(goal); } } } }