Example #1
0
        public static void GetDevisPrestataire(Devis d)
        {
            String sql = "SELECT devisid, prestataireid, dp.prix, nom FROM DevisPrestataire dp inner join Prestataire p on dp.prestataireid = p.id WHERE devisId=@devisId ";

            using (MySqlCommand command = new MySqlCommand(sql, connection))
            {
                command.Connection.Open();
                command.Parameters.AddWithValue("@devisid", d.Id);
                using (System.Data.Common.DbDataReader dbReader = command.ExecuteReader())

                {
                    while (dbReader.Read())
                    {
                        int              devisid       = dbReader.GetInt32(0);
                        int              prestataireid = dbReader.GetInt32(1);
                        int              prix          = dbReader.GetInt32(2);
                        string           nom           = dbReader.GetString(3);
                        DevisPrestataire dp            = new DevisPrestataire(devisid, prestataireid, prix)
                        {
                            Nom = nom
                        };



                        d.DevisPrestataires.Add(dp);
                    }
                }
                command.Connection.Close();
            }
        }
Example #2
0
 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();
 }