private void buttonSave_Click(object sender, EventArgs e)
        {
            ReceptionSelection selectedRec = (ReceptionSelection)comboBoxReception.SelectedItem;
            GetMenu_Result     selectedMenu;

            if (selectedRec != null)
            {
                try {
                    using (ProjetSGBDEntities context = new ProjetSGBDEntities()) {
                        context.NewReservation(selectedRec.Id, CurrentClient.Id, CurrentClient.Acronym);
                        if (dataGridViewDessert.SelectedRows.Count == 1)
                        {
                            selectedMenu = (GetMenu_Result)dataGridViewDessert.SelectedRows[0].DataBoundItem;
                            context.NewReservedDish(CurrentClient.Id, selectedMenu.DishId, selectedRec.Id, CurrentClient.Acronym);
                        }
                        if (dataGridViewMainCourse.SelectedRows.Count == 1)
                        {
                            selectedMenu = (GetMenu_Result)dataGridViewMainCourse.SelectedRows[0].DataBoundItem;
                            context.NewReservedDish(CurrentClient.Id, selectedMenu.DishId, selectedRec.Id, CurrentClient.Acronym);
                        }
                        if (dataGridViewStarter.SelectedRows.Count == 1)
                        {
                            selectedMenu = (GetMenu_Result)dataGridViewStarter.SelectedRows[0].DataBoundItem;
                            context.NewReservedDish(CurrentClient.Id, selectedMenu.DishId, selectedRec.Id, CurrentClient.Acronym);
                        }
                    }
                    Close();
                } catch (Exception ex) {
                    ModelError modelError = new ModelError(ex);
                    MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    DialogResult = DialogResult.None;
                }
            }
        }
 private void UpdateDish(GetReservedDish_Result oldDish, Dish newDish)
 {
     using (ProjetSGBDEntities context = new ProjetSGBDEntities()) {
         if (oldDish != null)
         {
             if ((newDish != null) && (oldDish.DishId != newDish.DishId))
             {
                 context.DeleteReservedDish(oldDish.ClientId, oldDish.DishId, CurrentReception.ReceptionId, oldDish.ModifiedAt);
                 context.NewReservedDish(CurrentClient.Id, newDish.DishId, CurrentReception.ReceptionId, CurrentClient.Acronym);
             }
         }
         else
         {
             if (newDish != null)
             {
                 context.NewReservedDish(CurrentClient.Id, newDish.DishId, CurrentReception.ReceptionId, CurrentClient.Acronym);
             }
         }
     }
 }