/// <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();
            }
        }
Exemple #2
0
        /// <summary>
        /// Modification d'une affectation
        /// </summary>
        private void modifierAffectation(object sender, EventArgs e)
        {
            Cours     cours = getCurrentAffectation();
            Personnel p     = getCurrentPersonnel();

            if (cours != null && p != null)
            {
                var formPopup = new InputModifCoursParPersonnelForm("Modifier Affectation", cours, p);
                formPopup.ShowDialog(this);
                personnelDetailsGridViewLoad();
                personnelViewModel.update(p);
                personnelGridViewLoad();
            }
            else
            {
                string            message = "Aucun personnel ou aucun cours sélectionné \n";
                string            caption = "Erreur";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;

                // Displays the MessageBox.
                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Exclamation);
                DiplomeView.afficherPopup(message);
            }
        }
        /// <summary>
        /// Evenement valider / modifier
        /// </summary>
        private void valider(object sender, EventArgs e)
        {
            Periode p = (Periode)periodeComboBox.SelectedItem;

            Boolean nomVide          = string.IsNullOrWhiteSpace(nomBox.Text);
            Boolean periodeIncorrect = p == null;

            if (nomVide || periodeIncorrect)
            {
                // Initializes the variables to pass to the MessageBox.Show method.
                string message = "Erreur lors de la saisie des données \n";
                message += nomVide ? " le nom est vide" : "";
                message += periodeIncorrect ? " la période est incorrecte" : "";
                DiplomeView.afficherPopup(message);
            }
            else
            {
                UniteEnseignement ue = new UniteEnseignement(nomBox.Text, p);
                if (input)
                {
                    UniteEnseignementDAO.create(ue);
                }
                else
                {
                    ue.id = ueModifie.id;
                    UniteEnseignementDAO.update(ue);
                }
                this.Close();
            }
        }
        /// <summary>
        /// Evenement annuler
        /// </summary>
        private void valider(object sender, EventArgs e)
        {
            CategoriePersonnel categASupprimer   = (CategoriePersonnel)this.categorieASupprimerCB.SelectedItem;
            CategoriePersonnel categRemplacement = (CategoriePersonnel)this.categoriesCB.SelectedItem;

            if (categASupprimer != null && categRemplacement != null)
            {
                List <Personnel> listePersonnel = PersonnelDAO.findAll();
                foreach (Personnel p in listePersonnel)
                {
                    if (p.categoriePersonnel.id == categASupprimer.id)
                    {
                        p.categoriePersonnel = categRemplacement;
                        PersonnelDAO.update(p);
                    }
                }
                CategoriePersonnelDAO.delete(categASupprimer);

                this.Close();
            }
            else
            {
                // Initializes the variables to pass to the MessageBox.Show method.
                string message = "Erreur lors de la saisie des données, il faut choisir une catégorie de personnel \n";
                DiplomeView.afficherPopup(message);
            }
        }
        /// <summary>
        /// Supression d'un Diplome
        /// </summary>
        private void supprimerDiplome(object sender, EventArgs e)
        {
            Diplome d = getCurrentDiplome();

            if (d != null)
            {
                DiplomeDAO.delete(d);
                diplomeGridViewLoad();
            }
            else
            {
                DiplomeView.afficherPopup("Aucun diplome selectionnée");
            }
        }
        /// <summary>
        /// Supression d'une annee
        /// </summary>
        private void supprimerAnnee(object sender, EventArgs e)
        {
            Annee a = getCurrentAnnee();

            if (a != null)
            {
                AnneeDAO.delete(a);
                anneeGridViewLoad();
            }
            else
            {
                DiplomeView.afficherPopup("Aucune année selectionnée");
            }
        }
        /// <summary>
        /// Supression d'un periode
        /// </summary>
        private void supprimerperiode(object sender, EventArgs e)
        {
            Periode p = getCurrentPeriode();

            if (p != null)
            {
                PeriodeDAO.delete(p);
                periodeGridViewLoad();
            }
            else
            {
                DiplomeView.afficherPopup("Aucune période selectionnée");
            }
        }
        /// <summary>
        /// ajouter d'un periode
        /// </summary>
        private void ajouterPeriode(object sender, EventArgs e)
        {
            Annee a = getCurrentAnnee();

            if (a != null)
            {
                var formPopup = new InputModifPeriodeForm("Ajouter Periode", a);
                formPopup.ShowDialog(this);
                periodeGridViewLoad();
            }
            else
            {
                DiplomeView.afficherPopup("Aucune année selectionnée");
            }
        }
        /// <summary>
        /// ajouter d'un annee
        /// </summary>
        private void ajouterAnnee(object sender, EventArgs e)
        {
            Diplome d = getCurrentDiplome();

            if (d != null)
            {
                var formPopup = new InputModifAnneeForm("Ajouter Annee", d);
                formPopup.ShowDialog(this);
                anneeGridViewLoad();
            }
            else
            {
                DiplomeView.afficherPopup("Aucun diplome selectionnée");
            }
        }
        /// <summary>
        /// Modifier d'un periode
        /// </summary>
        private void modifierPeriode(object sender, EventArgs e)
        {
            Periode p = getCurrentPeriode();
            Annee   a = getCurrentAnnee();

            if (p != null && a != null)
            {
                var formPopup = new InputModifPeriodeForm("Modifier Periode", a, p);
                formPopup.ShowDialog(this);
                periodeGridViewLoad();
            }
            else
            {
                DiplomeView.afficherPopup("Aucune période selectionnée");
            }
        }
        /// <summary>
        /// Modifier d'un annee
        /// </summary>
        private void modifierAnnee(object sender, EventArgs e)
        {
            Annee   a = getCurrentAnnee();
            Diplome d = getCurrentDiplome();

            if (a != null && d != null)
            {
                var formPopup = new InputModifAnneeForm("Modifier Annee", d, a);
                formPopup.ShowDialog(this);
                anneeGridViewLoad();
            }
            else
            {
                DiplomeView.afficherPopup("Aucune année selectionnée");
            }
        }
Exemple #12
0
 /// <summary>
 /// Evenement valider / modifier
 /// </summary>
 private void valider(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.nomBox.Text))
     {
         DiplomeView.afficherPopup("L'année est vide");
     }
     else
     {
         Annee a = new Annee(this.nomBox.Text, d);
         if (input)
         {
             AnneeDAO.create(a);
         }
         else
         {
             a.id = modifId;
             AnneeDAO.update(a);
         }
         this.Close();
     }
 }
 /// <summary>
 /// Evenement valider / modifier
 /// </summary>
 private void valider(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.nomBox.Text))
     {
         DiplomeView.afficherPopup("Le nom du diplome est vide");
     }
     else
     {
         Diplome d = new Diplome(this.nomBox.Text);
         if (input)
         {
             DiplomeDAO.create(d);
         }
         else
         {
             d.id = modifId;
             DiplomeDAO.update(d);
         }
         this.Close();
     }
 }
Exemple #14
0
 /// <summary>
 /// Evenement valider / modifier
 /// </summary>
 private void valider(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.nomBox.Text))
     {
         DiplomeView.afficherPopup("Le nom de la période est vide");
     }
     else
     {
         Periode p = new Periode(this.nomBox.Text, a);
         if (input)
         {
             PeriodeDAO.create(p);
         }
         else
         {
             p.id = modifId;
             PeriodeDAO.update(p);
         }
         this.Close();
     }
 }
Exemple #15
0
        /// <summary>
        /// Supression d'un personnel
        /// </summary>
        private void supprimerPersonnel(object sender, EventArgs e)
        {
            Personnel p = getCurrentPersonnel();

            if (p != null)
            {
                PersonnelDAO.delete(p);
                personnelGridViewLoad();
            }
            else
            {
                string            message = "Aucun personnel sélectionné \n";
                string            caption = "Erreur";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;

                // Displays the MessageBox.
                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Exclamation);
                DiplomeView.afficherPopup(message);
            }
        }
Exemple #16
0
        /// <summary>
        /// Modification d'un personnel
        /// </summary>
        private void modifierPersonnel(object sender, EventArgs e)
        {
            Personnel p = getCurrentPersonnel();

            if (p != null)
            {
                var formPopup = new InputModifPersonnelForm("Modifier Personnel", p);
                formPopup.ShowDialog(this);
                personnelGridViewLoad();
            }
            else
            {
                string            message = "Aucun personnel sélectionné \n";
                string            caption = "Erreur";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;

                // Displays the MessageBox.
                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Exclamation);
                DiplomeView.afficherPopup(message);
            }
        }
Exemple #17
0
        /// <summary>
        /// Evenement valider / modifier
        /// </summary>
        private void validerAction(object sender, EventArgs e)
        {
            CategoriePersonnel categorie = new CategoriePersonnel();
            int volumeHoraire            = 0;

            Boolean categorieIncorrect     = String.IsNullOrWhiteSpace(categorietextBox.Text);
            Boolean volumeHoraireIncorrect = !Int32.TryParse(volumeTextBox.Text, out volumeHoraire);

            if (categorieIncorrect || volumeHoraireIncorrect)
            {
                // Initializes the variables to pass to the MessageBox.Show method.
                string message = "Erreur lors de la saisie des données \n";
                message += volumeHoraireIncorrect ? " le volume horaire est incorrect" : "";
                message += categorieIncorrect ? " le nom de la categorie est incorrect" : "";

                DiplomeView.afficherPopup(message);
            }
            else
            {
                categorie.libelle       = categorietextBox.Text;
                categorie.volumeHoraire = volumeHoraire;
                categorie = CategoriePersonnelDAO.create(categorie);

                if (categorie != null)
                {
                    foreach (TypeCours typeCours in TypeCoursDAO.findAll())
                    {
                        Ratio temp = new Ratio();
                        temp.ratio              = 1;
                        temp.typeCours          = typeCours;
                        temp.categoriePersonnel = categorie;
                        RatioDAO.create(temp);
                    }

                    this.Close();
                }
            }
        }
Exemple #18
0
        /// <summary>
        /// Suppression d'une affectation
        /// </summary>
        private void supprimerAffectation(object sender, EventArgs e)
        {
            Cours     cppvm = getCurrentAffectation();
            Personnel p     = getCurrentPersonnel();

            if (cppvm != null && p != null)
            {
                CoursDAO.updateIntervenant(null, cppvm.id);
                personnelDetailsGridViewLoad();
                personnelViewModel.update(p);
                personnelGridViewLoad();
            }
            else
            {
                string            message = "Aucun personnel sélectionné \n";
                string            caption = "Erreur";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;

                // Displays the MessageBox.
                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Exclamation);
                DiplomeView.afficherPopup(message);
            }
        }
Exemple #19
0
        /// <summary>
        /// Evenement valider / modifier
        /// </summary>
        private void valider(object sender, EventArgs e)
        {
            Personnel intervenant = (Personnel)intervenantBox.SelectedItem;
            TypeCours typeCours   = (TypeCours)typeCoursBox.SelectedItem;

            int volumeHoraire;

            Boolean typeCoursIncorrect     = typeCours == null;
            Boolean volumeHoraireIncorrect = !Int32.TryParse(volumeBox.Text, out volumeHoraire);

            if (typeCoursIncorrect || volumeHoraireIncorrect)
            {
                // Initializes the variables to pass to the MessageBox.Show method.
                string message = "Erreur lors de la saisie des données \n";
                message += volumeHoraireIncorrect ? " le volume horaire est incorrect" : "";
                message += typeCoursIncorrect ? " le type de cours est incorrect" : "";

                DiplomeView.afficherPopup(message);
            }
            else
            {
                if (input)
                {
                    int nbGroupe = 0;
                    if (Int32.TryParse(groupeBox.Text, out nbGroupe))
                    {
                        List <Cours> cours = new List <Cours>();
                        for (int i = 0; i < nbGroupe; i++)
                        {
                            cours.Add(new Cours(elementConstitutif, intervenant, typeCours, typeCours.ToString() + (i + 1).ToString(), System.Convert.ToInt32(volumeBox.Text)));
                        }
                        foreach (Cours c in cours)
                        {
                            CoursDAO.create(c);
                        }
                    }
                    else
                    {
                        DiplomeView.afficherPopup("Nombre de groupe incorrect, un int est attendu");
                    }
                }
                else
                {
                    if (String.IsNullOrWhiteSpace(groupeBox.Text))
                    {
                        DiplomeView.afficherPopup("Nom du groupe incorrect");
                    }
                    else
                    {
                        Cours cours = new Cours(elementConstitutif, intervenant, typeCours, groupeBox.Text, System.Convert.ToInt32(volumeBox.Text));
                        cours.id = coursModifie.id;
                        if (cours.intervenant != null)
                        {
                            CoursDAO.updateIntervenant(cours.intervenant.id, cours.id);
                        }
                        CoursDAO.update(cours);
                        this.Close();
                    }
                }
                this.Close();
            }
        }