public static void insertPlage(DAOPlage c) { string query = "INSERT INTO plage (`Nom`,`idCommune`,`superficie`) VALUES (\"" + c.nomDAOPlage + "\",\"" + c.idCommuneDAOPlage + "\",\"" + c.superficieDAOPlage + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static void updatePlage(DAOPlage c) { string query = "UPDATE plage set nom=\"" + c.nomDAOPlage + "\",idCommune=\"" + c.idCommuneDAOPlage + "\" where idPlage=" + c.idDAOPlage + ";"; MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static PlageViewModel getPlage(int id) { DAOPlage pDAO = DAOPlage.getPlage(id); int idCom = pDAO.idCommuneDAOPlage; CommuneViewModel c = CommuneORM.getCommune(idCom); PlageViewModel p = new PlageViewModel(pDAO.idDAOPlage, pDAO.nomDAOPlage, c, pDAO.superficieDAOPlage); return(p); }
private void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); DAOPlage.updatePlage(this); } }
public static DAOPlage getPlage(int idDAOPlage) { string query = "SELECT * FROM plage WHERE idPlage=" + idDAOPlage + ";"; MySqlCommand cmd = new MySqlCommand(query, connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); DAOPlage com = new DAOPlage(reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2), reader.GetInt32(3)); reader.Close(); return(com); }
public static ObservableCollection <PlageViewModel> listePlage() { ObservableCollection <DAOPlage> lDAO = DAOPlage.listePlages(); ObservableCollection <PlageViewModel> l = new ObservableCollection <PlageViewModel>(); foreach (DAOPlage element in lDAO) { int idCom = element.idCommuneDAOPlage; CommuneViewModel c = CommuneORM.getCommune(idCom); // Plus propre que d'aller chercher le métier dans la DAO. PlageViewModel p = new PlageViewModel(element.idDAOPlage, element.nomDAOPlage, c, element.superficieDAOPlage); l.Add(p); } return(l); }
public static ObservableCollection <DAOPlage> selectPlage() { ObservableCollection <DAOPlage> l = new ObservableCollection <DAOPlage>(); string query = "SELECT * FROM plage;"; MySqlCommand cmd = new MySqlCommand(query, connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DAOPlage c = new DAOPlage(reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2), reader.GetInt32(3)); l.Add(c); } reader.Close(); return(l); }
public static DAOPlage getPlage(int idPlage) { DAOPlage plage = DALPlage.getPlage(idPlage); return(plage); }
public static void supprimerPlage(PlageViewModel plage) { DAOPlage.supprimerPlage(plage.idPlageProperty); }
public static void ajouterPlage(PlageViewModel plage) { DAOPlage.insertPlage(plage); }