예제 #1
0
 public void AddMatchTest()
 {
     JediTournamentManager jtm = new JediTournamentManager();
     Jedi jedi1 = jtm.GetJedis().Last() ;
     Jedi jedi2 = jtm.GetJedis().First();
     Stade stade = jtm.GetStades().First();
     Match newMatch = new Match(12,jedi1,jedi1,jedi2,EPhaseTournoi.DemiFinale, stade);
     jtm.AddMatch(newMatch);
     var matchs = jtm.GetMatchs();
     Assert.IsTrue(matchs.Last().Equals(newMatch));
 }
예제 #2
0
        public static Match MatchContractToMatch(MatchContract m)
        {
            Match match = new Match();
            match.ID = m.ID;
            match.Jedi1 = JediAdapter.JediContractToJedi(m.Jedi1);
            match.Jedi2 = JediAdapter.JediContractToJedi(m.Jedi2);
            match.Vainqueur = JediAdapter.JediContractToJedi(m.Vainqueur);
            match.PhaseTournoi = (EPhaseTournoi)m.PhaseTournoi;
            match.Stade = StadeAdapter.StadeContractToStade(m.Stade);

            return match;
        }
 public void AddMatch(Match match)
 {
     using (SqlConnection sqlConnection = new SqlConnection(_connectionString))
     {
         string query = "INSERT INTO Match (Jedi1, Jedi2, PhaseTournoi, Stade, Vainqueur) VALUES (@jedi1, @jedi2, @phaseTournoi, @stade, @vainqueur); SELECT SCOPE_IDENTITY()";
         SqlCommand sqlCommand = new SqlCommand(query, sqlConnection);
         sqlCommand.Parameters.AddWithValue("@jedi1", match.Jedi1.ID);
         sqlCommand.Parameters.AddWithValue("@jedi2", match.Jedi2.ID);
         sqlCommand.Parameters.AddWithValue("@phaseTournoi", (int)match.PhaseTournoi);
         sqlCommand.Parameters.AddWithValue("@stade", match.Stade.ID);
         sqlCommand.Parameters.AddWithValue("@vainqueur", match.Vainqueur.ID);
         sqlConnection.Open();
         match.ID= System.Convert.ToInt32(sqlCommand.ExecuteScalar());
         sqlConnection.Close();
     }
 }
예제 #4
0
 public void UpdateMatch(Match match)
 {
     _DataAccess.UpdateMatch(match);
 }
예제 #5
0
 public void AddMatch(Match match)
 {
     _DataAccess.AddMatch(match);
 }
예제 #6
0
 public void DeleteMatch(Match match)
 {
     _DataAccess.DeleteMatch(match);
 }
 public void DeleteMatch(Match match)
 {
     using (SqlConnection sqlConnection = new SqlConnection(_connectionString))
     {
         string query = "DELETE FROM Match WHERE Id=@id";
         SqlCommand sqlCommand = new SqlCommand(query, sqlConnection);
         sqlCommand.Parameters.AddWithValue("@id", match.ID);
         sqlConnection.Open();
         sqlCommand.ExecuteNonQuery();
         sqlConnection.Close();
     }
 }
 public void UpdateMatch(Match match)
 {
     using (SqlConnection sqlConnection = new SqlConnection(_connectionString))
     {
         string query = "UPDATE Match SET Jedi1=@jedi1, Jedi2=@jedi2, PhaseTournoi=@phaseTournoi, Stade=@stade, Vainqueur=@vainqueur WHERE Id=@id";
         SqlCommand sqlCommand = new SqlCommand(query, sqlConnection);
         sqlCommand.Parameters.AddWithValue("@jedi1", match.Jedi1.ID);
         sqlCommand.Parameters.AddWithValue("@jedi2", match.Jedi2.ID);
         sqlCommand.Parameters.AddWithValue("@phaseTournoi", (int)match.PhaseTournoi);
         sqlCommand.Parameters.AddWithValue("@stade", match.Stade.ID);
         sqlCommand.Parameters.AddWithValue("@vainqueur", match.Vainqueur.ID);
         sqlConnection.Open();
         sqlCommand.ExecuteNonQuery();
         sqlConnection.Close();
     }
 }
 public void DelMatch(Match match)
 {
     DalManager.Instance.DeleteMatch(match);
 }
 public void AddMatch(Match match)
 {
     DalManager.Instance.AddMatch(match);
 }
 public void UpdateMatch(Match match)
 {
     DalManager.Instance.UpdateMatch(match);
 }