public static void updateEstimation(EstimationDAO p) { string query = "UPDATE estimation set id_comissaire_priseur=" + p.id_comissaire_priseur + ", id_vendeur=" + p.id_vendeur + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void insertEstimation(EstimationDAO p) { string query = "INSERT INTO estimation VALUES (\"" + p.id_comissaire_priseur + "\",\"" + p.id_vendeur + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static void insertEstimation(EstimationDAO p) { /*int id = getMaxIdEstimation() + 1;*/ string query = "INSERT INTO Estimation VALUES (\"" + p.estimationDAO + "\",\"" + p.dateEstimationDAO + "\",\"" + p.idProduitDAO + "\",\"" + p.idAdminDAO + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, DALConnection.OpenConnection()); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static ObservableCollection <EstimationViewModel> listeEstimations() { ObservableCollection <EstimationDAO> lDAO = EstimationDAO.listeEstimations(); ObservableCollection <EstimationViewModel> l = new ObservableCollection <EstimationViewModel>(); foreach (EstimationDAO element in lDAO) { EstimationViewModel p = new EstimationViewModel(element.id_comissaire_priseur, element.id_vendeur); l.Add(p); } return(l); }
public static ObservableCollection <EstimationViewModel> listeEstimation() { ObservableCollection <EstimationDAO> lDAO = EstimationDAO.listeEstimation(); ObservableCollection <EstimationViewModel> l = new ObservableCollection <EstimationViewModel>(); foreach (EstimationDAO element in lDAO) { EstimationViewModel p = new EstimationViewModel(element.estimationDAO, element.dateEstimationDAO, element.idProduitDAO, element.idAdminDAO); l.Add(p); } return(l); }
public static EstimationDAO getEstimation(int id_commissaire_priseur, int id_vendeur) { string query = "SELECT * FROM estimation WHERE id_comissaire_priseur = \"" + id_commissaire_priseur + "\" and id_produit=" + id_vendeur + "\";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); EstimationDAO pers = new EstimationDAO(reader.GetInt32(0), reader.GetInt32(1)); reader.Close(); return(pers); }
public static EstimationDAO getEstimation(int id) { string query = "SELECT * FROM estimation WHERE id=" + id + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); EstimationDAO cat = new EstimationDAO(reader.GetFloat(0), reader.GetString(1), reader.GetInt32(2), reader.GetInt32(3)); reader.Close(); return(cat); }
// INSERT & Update public static void InsertOrAddNewEstimation(EstimationDAO estimation) { // Inserer estimation dans la bdd var query = @"INSERT INTO public.estimation (""idEstimation"",""produitId"",""commissaireId"",""dateEstimation"",""prixEstimation"") values (:idEstimation,:produitId,:commissaireId,:dateEstimation,:prixEstimation) ON CONFLICT ON CONSTRAINT pk_estimation DO UPDATE SET ""idEstimation""=:idEstimation, ""produitId""=:produitId, ""commissaireId""=:commissaireId, ""dateEstimation""=:dateEstimation, ""prixEstimation""=:prixEstimation, where estimation.""idEstimation""=:idEstimation"; var cmd = new NpgsqlCommand(query, DALconnection.OpenConnection()); cmd.Parameters.AddWithValue("idEstimation", estimation.IdEstimation); cmd.Parameters.AddWithValue("produitId", estimation.ProduitId); cmd.Parameters.AddWithValue("commissaireId", estimation.CommissaireId); cmd.Parameters.AddWithValue("dateEstimation", estimation.DateEstimation); cmd.Parameters.AddWithValue("prixEstimation", estimation.PrixEstimation); cmd.ExecuteNonQuery(); }
public static void insertEstimation(EstimationViewModel p) { EstimationDAO.insertEstimation(new EstimationDAO(p.id_comissaire_priseur, p.id_vendeur)); }
public static void supprimerEstimation(int id_categorie, int id_produit) { EstimationDAO.supprimerEstimation(id_categorie, id_produit); }
public static void insertEstimation(EstimationViewModel p) { EstimationDAO.insertEstimation(new EstimationDAO(p.estimationProperty, p.dateEstimationProperty, p.idProduitProperty, p.idAdminProperty)); }
public static void supprimerEstimation(int id) { EstimationDAO.supprimerEstimation(id); }