private void buttonAjouter_Click(object sender, EventArgs e) { if (textBoxPrenom.Text != "") { var selectedEntree = (CarteByRestaurantAndTypeModel)comboBoxEntree.SelectedItem; var selectedPlat = (CarteByRestaurantAndTypeModel)comboBoxPlat.SelectedItem; var selectedDessert = (CarteByRestaurantAndTypeModel)comboBoxDessert.SelectedItem; try { string nomTemp = helper.prenomParticipant; helper.prenomParticipant = textBoxPrenom.Text; helper.idEntree = selectedEntree.idCarteRestaurant; helper.idPlat = selectedPlat.idCarteRestaurant; helper.idDessert = selectedDessert.idCarteRestaurant; helper.prixParPersonnes = Int32.Parse(labelPrixTotal.Text); if (!Manage.GetDetailReservation().Exists(x => x.idDetailReservation == helper.idDetail)) { Manage.AjouteDetailReservation( Manage.GetListReservation() .FirstOrDefault(x => x.numeroReservation == helper.numeroReservation).idReservation, helper.prenomParticipant, helper.idEntree, helper.idPlat, helper.idDessert, helper.prixParPersonnes); } else { int idRes = GetIdReservation(); Manage.ModifierDetailReservation(helper.idDetail , textBoxPrenom.Text, helper.idEntree, helper.idPlat, helper.idDessert, helper.prixParPersonnes); } this.Hide(); NouvelleReservationCommande oNouvelleReservationCommande = new NouvelleReservationCommande(); oNouvelleReservationCommande.Closed += (s, args) => this.Close(); oNouvelleReservationCommande.MdiParent = this.MdiParent; oNouvelleReservationCommande.Show(); } catch (Exception exception) { MessageBox.Show(exception.Message); } } else { MessageBox.Show("Veuillez introduire un prenom !"); } }