public static ObservableCollection <DepartementDAO> selectDepartements() { ObservableCollection <DepartementDAO> l = new ObservableCollection <DepartementDAO>(); string query = "SELECT * FROM Departement;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); try { cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DepartementDAO p = new DepartementDAO(reader.GetInt32(0), reader.GetString(1)); l.Add(p); } reader.Close(); } catch (Exception e) { MessageBox.Show("La base de données n'est pas connectée"); } return(l); }
public static void insertDepartement(DepartementDAO p) { DepartementDAO.insertDepartement(p); }
public static void supprimerDepartement(int id) { DepartementDAO.supprimerDepartement(id); }
public static void updateDepartement(DepartementDAO p) { DepartementDAO.updateDepartement(p); }
public static DepartementDAO getDepartement(int idDepartement) { DepartementDAO p = DepartementDAL.getDepartement(idDepartement); return(p); }