public static CommuneViewModel getCommune(int idVille) { CommuneDAO pDAO = CommuneDAO.getCommune(idVille); //int idMetier = pDAO.idMetierCommuneDAO; CommuneViewModel p = new CommuneViewModel(pDAO.idVilleDAO, pDAO.nomVilleDAO, pDAO.nomSpecialisteDAO); return(p); }
public static void updateCommune(CommuneDAO p) { string query = "UPDATE Ville set nom=\"" + p.nomVilleDAO + "\", prenomCommune=\"" + p.nomSpecialisteDAO + "\", where idCommune=" + p.idVilleDAO + ";"; MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void insertCommune(CommuneDAO p) { int id = getMaxIdCommune() + 1; string query = "INSERT INTO Ville VALUES (\"" + id + "\",\"" + p.nomVilleDAO + "\",\"" + p.nomSpecialisteDAO + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, DALConnection.connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static CommuneDAO getCommune(int idVille) { string query = "SELECT * FROM ville WHERE idVille=" + idVille + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); CommuneDAO pers = new CommuneDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2)); reader.Close(); return(pers); }
public static ObservableCollection <CommuneViewModel> listeCommunes() { ObservableCollection <CommuneDAO> lDAO = CommuneDAO.listeCommunes(); ObservableCollection <CommuneViewModel> l = new ObservableCollection <CommuneViewModel>(); foreach (CommuneDAO element in lDAO) { //int idMetier = element.idMetierCommuneDAO; CommuneViewModel p = new CommuneViewModel(element.idVilleDAO, element.nomVilleDAO, element.nomSpecialisteDAO); l.Add(p); } return(l); }
public static ObservableCollection <CommuneDAO> selectCommunes() { ObservableCollection <CommuneDAO> l = new ObservableCollection <CommuneDAO>(); string query = "SELECT * FROM Ville;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); try { cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { CommuneDAO p = new CommuneDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2)); 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 insertCommune(CommuneDAO p) { CommuneDAO.insertCommune(p); }
public static void supprimerCommune(int id) { CommuneDAO.supprimerCommune(id); }
public static void updateCommune(CommuneDAO p) { CommuneDAO.updateCommune(p); }
public static CommuneDAO getCommune(int idCommune) { CommuneDAO p = CommuneDAL.getCommune(idCommune); return(p); }
public static void insertCommune(CommuneViewModel p) { CommuneDAO.insertCommune(new CommuneDAO(p.idVilleProperty, p.nomVilleProperty, p.nomSpecialisteProperty)); }