static Business() { Prestataires = new ObservableCollection <Prestataire>(); Devis = new ObservableCollection <Devis>(); AllDevis = new ObservableCollection <Devis>(); DevisWork = new ObservableCollection <Devis>(); DevisFinish = new ObservableCollection <Devis>(); DevisPrestataire = new ObservableCollection <DevisPrestataire>(); p = new Prestataire(); d = new Devis(); }
public static bool InsertPrestataire(Prestataire p) { string sql = "INSERT INTO Prestataire(Id, Nom, Url, Categorie, Contact, Adresse, Description, Activation, Prix) " + "VALUE (@id, @nom, @url, @categorie, @contact, @adresse, @description, @activation, @prix)"; using (MySqlCommand cmd = new MySqlCommand(sql, connection)) { cmd.Connection.Open(); cmd.Parameters.AddWithValue("@id", null); cmd.Parameters.AddWithValue("@nom", p.Nom); cmd.Parameters.AddWithValue("@url", p.Url); cmd.Parameters.AddWithValue("@categorie", p.Categorie); cmd.Parameters.AddWithValue("@contact", p.Contact); cmd.Parameters.AddWithValue("@adresse", p.Adresse); cmd.Parameters.AddWithValue("@description", p.Description); cmd.Parameters.AddWithValue("@activation", p.Activation); cmd.Parameters.AddWithValue("@prix", p.Prix); bool result = cmd.ExecuteNonQuery() == 1; cmd.Connection.Close(); return(result); } }
public static bool UpdatePrestataire(Prestataire p) { string sql = "UPDATE Prestataire SET Nom=@nom, Url=@url, Categorie=@categorie, Contact=@contact, Adresse=@adresse, Description=@description, Activation=@activation, Prix=@prix " + " Where id=@id "; using (MySqlCommand cmd = new MySqlCommand(sql, connection)) { cmd.Connection.Open(); cmd.Parameters.AddWithValue("@id", p.Id); cmd.Parameters.AddWithValue("@nom", p.Nom); cmd.Parameters.AddWithValue("@url", p.Url); cmd.Parameters.AddWithValue("@categorie", p.Categorie); cmd.Parameters.AddWithValue("@contact", p.Contact); cmd.Parameters.AddWithValue("@adresse", p.Adresse); cmd.Parameters.AddWithValue("@description", p.Description); cmd.Parameters.AddWithValue("@activation", p.Activation); cmd.Parameters.AddWithValue("@prix", p.Prix); bool result = cmd.ExecuteNonQuery() == 1; cmd.Connection.Close(); return(result); } }