private void btnSave_Click(object sender, EventArgs e) { try { checkForm(); Etudiants newProduct = new Etudiants ( txtNom.Text, txtPrenom.Text, txtContact.Text, txtSexe.Text, txtEmail.Text, txtLieuxNaissance.Text, txtDatedeNaissance.Text, txtIdentifiant.Text ); EtudiantBLO productBLO = new EtudiantBLO(ConfigurationManager.AppSettings["DbFolder"]); if (this.oldEtudiant == null) { productBLO.CreateEtudiant(newProduct); } else { productBLO.EditEtudiants(oldEtudiant, newProduct); } MessageBox.Show ( "Save done !", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information ); if (callBack != null) { callBack(); } if (oldEtudiant != null) { Close(); } txtNom.Clear(); txtPrenom.Clear(); txtEmail.Clear(); txtDatedeNaissance.Clear(); txtNom.Focus(); txtLieuxNaissance.Clear(); txtIdentifiant.Clear(); txtSexe.Clear(); } catch (TypingException ex) { MessageBox.Show ( ex.Message, "Typing error", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } catch (DuplicateNameException ex) { MessageBox.Show ( ex.Message, "Duplicate error", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } catch (KeyNotFoundException ex) { MessageBox.Show ( ex.Message, "Not found error", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } /* catch (Exception ex) * { * ex.WriteToFile(); * MessageBox.Show * ( * "An error occurred! Please try again later.", * "Erreur", * MessageBoxButtons.OK, * MessageBoxIcon.Error * ); * }*/ }