public static PlageViewModel getPlage(int id) { DAOPlage daoplage = DAOPlage.getPlage(id); PlageViewModel plage = new PlageViewModel(daoplage.idPlageDAO, daoplage.NomDAO, daoplage.CommuneDAO, daoplage.DépartementDAO, daoplage.SuperficieDAO); return(plage); }
public static void updatePlage(DAOPlage plage) { string query = "UPDATE personne SET Nom=" + plage.NomDAO + ", Commune=" + plage.CommuneDAO + ", Département=" + plage.DépartementDAO + ", Superficie=" + plage.SuperficieDAO + ";"; MySqlCommand command = new MySqlCommand(query, DALConnection.Connection()); MySqlDataAdapter dataAdapter = new MySqlDataAdapter(command); command.ExecuteNonQuery(); }
public static void addPlage(DAOPlage plage) { string query = "INSERT INTO plage VALUES (\"" + plage.idPlageDAO + "\",\"" + plage.NomDAO + "\",\"" + plage.CommuneDAO + "\",\"" + plage.DépartementDAO + "\",\"" + plage.SuperficieDAO + "\");"; MySqlCommand command = new MySqlCommand(query, DALConnection.Connection()); MySqlDataAdapter dataAdapter = new MySqlDataAdapter(command); command.ExecuteNonQuery(); }
public static ObservableCollection <PlageViewModel> listePlages() { ObservableCollection <DAOPlage> listeDAO = DAOPlage.listePlages(); ObservableCollection <PlageViewModel> listePlages = new ObservableCollection <PlageViewModel>(); foreach (DAOPlage item in listeDAO) { PlageViewModel plage = new PlageViewModel(item.idPlageDAO, item.NomDAO, item.CommuneDAO, item.DépartementDAO, item.SuperficieDAO); listePlages.Add(plage); } return(listePlages); }
public static DAOPlage getPlage(int id) { string query = "SELECT * FROM plage WHERE idPlage = " + id + ";"; MySqlCommand command = new MySqlCommand(query, DALConnection.Connection()); command.ExecuteNonQuery(); MySqlDataReader reader = command.ExecuteReader(); reader.Read(); DAOPlage plage = new DAOPlage(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetInt32(4)); reader.Close(); return(plage); }
public static ObservableCollection <DAOPlage> selectPlages() { ObservableCollection <DAOPlage> ListesPlages = new ObservableCollection <DAOPlage>(); string query = "SELECT * FROM plage;"; MySqlCommand command = new MySqlCommand(query, DALConnection.Connection()); try { command.ExecuteNonQuery(); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { DAOPlage plage = new DAOPlage(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetInt32(4)); ListesPlages.Add(plage); } reader.Close(); } catch (Exception e) { MessageBox.Show("Une erreur est survenue impossible de continuer..."); } return(ListesPlages); }
public static void addPlage(PlageViewModel plage) { DAOPlage.addPlage(new DAOPlage(plage.idPlageProperty, plage.nomPlageProperty, plage.communeProperty, plage.départementProperty, plage.superficieProperty)); }