/// <summary>
        /// Evenement valider / modifier
        /// </summary>
        private void valider(object sender, EventArgs e)
        {
            CategoriePersonnel categorie = (CategoriePersonnel)categorieComboBox.SelectedItem;

            Boolean nomIncorrect        = string.IsNullOrWhiteSpace(nomBox.Text);
            Boolean prenomIncorrect     = string.IsNullOrWhiteSpace(prenomBox.Text);
            Boolean categorieIncorrecte = categorie == null;

            if (nomIncorrect || prenomIncorrect || categorieIncorrecte)
            {
                // Initializes the variables to pass to the MessageBox.Show method.
                string message = "Erreur lors de la saisie des données \n";
                message += nomIncorrect ? " le nom est vide" : "";
                message += prenomIncorrect ? " le prenom est vide" : "";
                message += categorieIncorrecte ? " la categorie est incorrecte" : "";

                DiplomeView.afficherPopup(message);
            }
            else
            {
                Personnel p = new Personnel(this.nomBox.Text, this.prenomBox.Text, categorie);

                if (input)
                {
                    PersonnelDAO.create(p);
                }
                else
                {
                    p.id = modifId;
                    PersonnelDAO.update(p);
                }
                this.Close();
            }
        }
Exemplo n.º 2
0
        /**
         * Methodes pour aider aux tests
         * **/
        public static Personnel creerPersonnel(String nom, String prenom)
        {
            Personnel obj = new Personnel();

            obj.nom                = nom;
            obj.prenom             = prenom;
            obj.categoriePersonnel = CategoriePersonnelTest.creerCategoriePersonnel("TEST_PERSONNEL");
            Personnel resultat = PersonnelDAO.create(obj);

            return(resultat);
        }