public void Create(RendezVous rendezVous) { if (OpenConnection()) { EchantillonDonneDAO echantillonDonneDAO = new EchantillonDonneDAO(); command = manager.CreateCommand(); command.CommandText = "INSERT INTO rendez_vous " + "(id_commercial, id_praticien, date_rdv, motif_rdv, indice_confiance, date_bilan) " + "VALUES (@id_commercial, @id_praticien, @date_rdv, @motif_rdv, @indice_confiance,@date_bilan)"; command.Parameters.AddWithValue("@id_commercial", rendezVous.Employe.Id); command.Parameters.AddWithValue("@id_praticien", rendezVous.Praticien.Id); command.Parameters.AddWithValue("@date_rdv", rendezVous.Date_rdv); command.Parameters.AddWithValue("@motif_rdv", rendezVous.Motif_rdv.ToString()); command.Parameters.AddWithValue("@indice_confiance", rendezVous.Indice_confiance); command.Parameters.AddWithValue("@date_bilan", rendezVous.Date_bilan); if (rendezVous.Liste_echantillons_donnes != null) { foreach (EchantillonDonne echantillonDonne in rendezVous.Liste_echantillons_donnes) { echantillonDonneDAO.Create(echantillonDonne); } } command.ExecuteNonQuery(); CloseConnection(); } }