private void buttonEditDishWish_Click(object sender, EventArgs e)
 {
     if (dataGridViewDishWish.SelectedRows.Count == 1)
     {
         GetWishedDish_Result selected = (GetWishedDish_Result)dataGridViewDishWish.SelectedRows[0].DataBoundItem;
         FormEditDishWish     form     = new FormEditDishWish();
         form.CurrentClient = CurrentClient;
         try {
             form.LoadDishWish(selected.DishId);
             DialogResult result = form.ShowDialog();
             if (result == DialogResult.OK)
             {
                 PopulateDishWishes();
             }
         } catch (Exception ex) {
             ModelError modelError = new ModelError(ex);
             MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             if (modelError.Number == ModelError.INVALID_OPERATION)
             {
                 PopulateDishWishes();
             }
         }
     }
 }
示例#2
0
 private void buttonEditDishWish_Click(object sender, EventArgs e) {
   if(dataGridViewDishWish.SelectedRows.Count == 1) {
     GetWishedDish_Result selected = (GetWishedDish_Result)dataGridViewDishWish.SelectedRows[0].DataBoundItem;
     FormEditDishWish form = new FormEditDishWish();
     form.CurrentClient = CurrentClient;
     try {
       form.LoadDishWish(selected.DishId);
       DialogResult result = form.ShowDialog();
       if(result == DialogResult.OK) {
         PopulateDishWishes();
       }
     } catch(Exception ex) {
       ModelError modelError = new ModelError(ex);
       MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error);
       if(modelError.Number == ModelError.INVALID_OPERATION) {
         PopulateDishWishes();
       }
     }
   }
 }