private void buttonDeleteFeeling_Click(object sender, EventArgs e) { if (dataGridViewFeeling.SelectedRows.Count == 1) { GetFeeling_Result selected = (GetFeeling_Result)dataGridViewFeeling.SelectedRows[0].DataBoundItem; DialogResult result = MessageBox.Show("Êtes-vous sûr de vouloir supprimer la ressenti pour le client '" + selected.DisplayName() + "'?", "Confirmation de suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { try { using (ProjetSGBDEntities context = new ProjetSGBDEntities()) { context.DeleteFeeling(CurrentClient.Id, selected.ClientId, selected.ModifiedAt); } PopulateFeelings(); } catch (Exception ex) { ModelError modelError = new ModelError(ex); if (modelError.Number == ModelError.DATA_NOT_UP_TO_DATE) { MessageBox.Show(modelError.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); PopulateFeelings(); } else { MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }