public static ObservableCollection <VenteDAO> selectVentes() { ObservableCollection <VenteDAO> l = new ObservableCollection <VenteDAO>(); string query = "SELECT * FROM Vente;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataReader reader = null; try { cmd.ExecuteNonQuery(); reader = cmd.ExecuteReader(); while (reader.Read()) { VenteDAO p = new VenteDAO(reader.GetInt32(0), reader.GetString(1), reader.GetDateTime(2), reader.GetDateTime(3)); l.Add(p); } } catch (Exception e) { MessageBox.Show("Il y a un problème dans la table Vente : {0}", e.StackTrace); } reader.Close(); return(l); }
public static VenteViewModel getVente(int idVente) { VenteDAO pDAO = VenteDAO.getVente(idVente); VenteViewModel p = new VenteViewModel(pDAO.idVenteDAO, pDAO.attributeDAO, pDAO.date_debutDAO, pDAO.date_finDAO); return(p); }
public static void updateVente(VenteDAO p) { string query = "UPDATE Vente set attribute=\"" + p.attributeDAO + "\", date_debut=\"" + p.date_debutDAO + "\", date_fin=\"" + p.date_finDAO + "\"WHERE id = \"" + p.idVenteDAO + "\";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void insertVente(VenteDAO p) { int id = getMaxIdVente() + 1; string query = "INSERT INTO Vente (id, attribute, date_debut, date_fin) VALUES (\"" + id + "\",\"" + p.attributeDAO + "\",\"" + p.date_debutDAO + "\",\"" + p.date_finDAO + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static ObservableCollection <VenteViewModel> listeVentes() { ObservableCollection <VenteDAO> lDAO = VenteDAO.listeVentes(); ObservableCollection <VenteViewModel> l = new ObservableCollection <VenteViewModel>(); foreach (VenteDAO element in lDAO) { VenteViewModel p = new VenteViewModel(element.idVenteDAO, element.attributeDAO, element.date_debutDAO, element.date_finDAO); l.Add(p); } return(l); }
public static VenteDAO getVente(int idVente) { string query = "SELECT * FROM Vente WHERE id=" + idVente + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); VenteDAO pers = new VenteDAO(reader.GetInt32(0), reader.GetString(1), reader.GetDateTime(2), reader.GetDateTime(3)); reader.Close(); return(pers); }
public static void insertVente(VenteDAO p) { VenteDAL.insertVente(p); }
public static void updateVente(VenteDAO p) { VenteDAL.updateVente(p); }
public static VenteDAO getVente(int idVente) { VenteDAO p = VenteDAL.getVente(idVente); return(p); }
public static void insertVente(VenteViewModel p) { VenteDAO.insertVente(new VenteDAO(p.idVenteProperty, p.attributeProperty, p.date_debutProperty, p.date_finProperty)); }
public static void supprimerVente(int id) { VenteDAO.supprimerVente(id); }