public static EspeceViewModel getEspece(int idEspece) { EspeceDAO dDAO = EspeceDAO.getEspeces(idEspece); EspeceViewModel e = new EspeceViewModel(dDAO.idEspeceDAO, dDAO.nomEspeceDAO); return(e); }
public static EspeceViewModel getEspece(int idEspece) { EspeceDAO pDAO = EspeceDAO.getEspece(idEspece); EspeceViewModel p = new EspeceViewModel(pDAO.idEspeceDAO, pDAO.nomEspeceDAO); return(p); }
public static void updateEspece(EspeceDAO e) { string query = "UPDATE Espece set nom=\"" + e.nomEspeceDAO + "\" where idEspece=" + e.idEspeceDAO + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void updateEspece(EspeceDAO p) { string query = "UPDATE espece set nomEspece=\"" + p.nomEspeceDAO; MySqlCommand cmd = new MySqlCommand(query, DALConnection.connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void insertEspece(EspeceDAO e) { int id = getMaxIdEspece() + 1; string query = "INSERT INTO Espece VALUES (\"" + id + "\",\"" + e.nomEspeceDAO + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, DALConnection.connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static void insertEspece(EspeceDAO p) { string query = "INSERT INTO espece (Nom) VALUES (@NomEspece);"; MySqlCommand cmd2 = new MySqlCommand(query, DALConnection.OpenConnection()); cmd2.Parameters.AddWithValue("@NomEspece", p.nomEspeceDAO); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static void updateEspece(EspeceDAO u) { if (u.idEspeceDAO != 1) { string query = "UPDATE espece set nom=\"" + u.nomEspeceDAO + "\" where idEspece=" + u.idEspeceDAO + ";"; MySqlCommand cmd = new MySqlCommand(query, ConnexionBaseDAL.connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); } }
public static void updateEspece(EspeceDAO p) { string query = "UPDATE espece set nomEspece=@NomEspece where idEspece=@IdEspece;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); cmd.Parameters.AddWithValue("@NomEspece", p.nomEspeceDAO); cmd.Parameters.AddWithValue("@IdEspece", p.idEspeceDAO); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static ObservableCollection <EspeceViewModel> listeEspeces() { ObservableCollection <EspeceDAO> lDAO = EspeceDAO.listeEspeces(); ObservableCollection <EspeceViewModel> l = new ObservableCollection <EspeceViewModel>(); foreach (EspeceDAO element in lDAO) { EspeceViewModel p = new EspeceViewModel(element.idEspeceDAO, element.nomEspeceDAO); l.Add(p); } return(l); }
public static EspeceDAO getEspece(int idEspece) { string query = "SELECT * FROM Espece WHERE idEspece=" + idEspece + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); EspeceDAO user = new EspeceDAO(reader.GetInt32(0), reader.GetString(1)); reader.Close(); return(user); }
public static EspeceDAO getEspece(int idEspece) { string query = "SELECT * FROM espece WHERE idEspece=@IdEspece;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); cmd.Parameters.AddWithValue("@IdEspece", idEspece); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); EspeceDAO pers = new EspeceDAO(reader.GetInt32(0), reader.GetString(1)); reader.Close(); return(pers); }
public static ObservableCollection <EspeceDAO> selectEspeces() { ObservableCollection <EspeceDAO> l = new ObservableCollection <EspeceDAO>(); string query = "SELECT * FROM Espece;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { EspeceDAO e = new EspeceDAO(reader.GetInt32(0), reader.GetString(1)); l.Add(e); } reader.Close(); return(l); }
public static EspeceDAO getEspece(int idEspece) { string query = "SELECT * FROM espece WHERE idEspece=" + idEspece + ";"; MySqlCommand cmd = new MySqlCommand(query, ConnexionBaseDAL.connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); EspeceDAO espece; if (reader.HasRows) { espece = new EspeceDAO(reader.GetInt32(0), reader.GetString(1)); } else { espece = new EspeceDAO(1, "MauvaisNumeroEspece"); } reader.Close(); return(espece); }
public static ObservableCollection <EspeceDAO> selectEspeces() { ObservableCollection <EspeceDAO> l = new ObservableCollection <EspeceDAO>(); string query = "SELECT * FROM espece;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); try { cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { EspeceDAO p = new EspeceDAO(reader.GetInt32(0), reader.GetString(1)); l.Add(p); } reader.Close(); } catch (Exception) { MessageBox.Show("La base de données n'est pas connectée"); } return(l); }
public static void insertEspece(EspeceViewModel p) { EspeceDAO.insertEspece(new EspeceDAO(p.idEspeceProperty, p.nomEspeceProperty)); }
public static void supprimerEspece(int id) { EspeceDAO.supprimerEspece(id); }
public static void updateEspece(EspeceViewModel p) { EspeceDAO.updateEspece(new EspeceDAO(p.idEspeceProperty, p.nomEspeceProperty)); }