private void buttonStarter_Click(object sender, EventArgs e) { FormSelectDish form = new FormSelectDish(); DialogResult result; try { form.PopulateList(CurrentReception.ReceptionId, DishTypeStarter, CurrentClient); result = form.ShowDialog(); if ((result == DialogResult.OK) && (form.SelectedDishId != null)) { using (ProjetSGBDEntities context = new ProjetSGBDEntities()) { _starter = context.Dish.Where(dish => dish.DishId == form.SelectedDishId).First(); textBoxStarter.Text = _starter.Name; } } } catch (Exception ex) { ModelError modelError = new ModelError(ex); MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonStarter_Click(object sender, EventArgs e) { FormSelectDish form = new FormSelectDish(); DialogResult result; try { form.PopulateList(CurrentReception.ReceptionId, DishTypeStarter, CurrentClient); result = form.ShowDialog(); if((result == DialogResult.OK) && (form.SelectedDishId != null)) { using(ProjetSGBDEntities context = new ProjetSGBDEntities()) { _starter = context.Dish.Where(dish => dish.DishId == form.SelectedDishId).First(); textBoxStarter.Text = _starter.Name; } } } catch(Exception ex) { ModelError modelError = new ModelError(ex); MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }