Exemplo n.º 1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            FeelingType feelingtype = (FeelingType)comboBoxFeeling.SelectedItem;

            if (ClientTo != null && feelingtype != null)
            {
                try {
                    using (ProjetSGBDEntities context = new ProjetSGBDEntities()) {
                        context.UpdateFeeling(CurrentClient.Id, ClientTo.ClientId, feelingtype.Id, ClientTo.ModifiedAt, CurrentClient.Acronym);
                    }
                } 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);
                        LoadFeeling(ClientTo.ClientId);
                        DialogResult = DialogResult.None;
                    }
                    else
                    {
                        MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }