/// <summary> /// Evenement valider / modifier /// </summary> private void valider(object sender, EventArgs e) { ElementConstitutif ec = new ElementConstitutif(this.nomBox.Text, ue); Boolean elementConstitutifIncorrect = string.IsNullOrWhiteSpace(nomBox.Text); if (elementConstitutifIncorrect) { // Initializes the variables to pass to the MessageBox.Show method. string message = "Erreur lors de la saisie des données \n"; message += " le nom de l'élément constitutif est vide !"; DiplomeView.afficherPopup(message); } else { if (input) { ElementConstitutifDAO.create(ec); } else { ec.id = elementModifie.id; ElementConstitutifDAO.update(ec); } this.Close(); } }
/** * Methodes pour aider aux tests * **/ public static ElementConstitutif creerElementConstitutif(String libelle) { ElementConstitutif elementConstitutif = new ElementConstitutif(); elementConstitutif.libelle = libelle; elementConstitutif.uniteEnseignement = UniteEnseignementTest.creerUniteEnseignement(libelle); ElementConstitutif resultat = ElementConstitutifDAO.create(elementConstitutif); return(resultat); }