예제 #1
0
        private void load()
        {
            this.typeCoursBox.Items.Clear();
            // selecteur liste type cours
            List <TypeCours> typeCours = TypeCoursDAO.findAll();

            foreach (TypeCours t in typeCours) // filtre
            {
                this.typeCoursBox.Items.Add(t);
            }
            // si modif on remet le bon type cours
            if (coursModifie != null && coursModifie.typeCours != null)
            {
                this.typeCoursBox.SelectedIndex = typeCoursBox.FindStringExact(coursModifie.typeCours.libelle);
            }

            this.intervenantBox.Items.Clear();
            // selecteur liste personnel
            List <Personnel> personnels = PersonnelDAO.findAll();

            foreach (Personnel p in personnels)
            {
                this.intervenantBox.Items.Add(p);
            }
            if (coursModifie != null && coursModifie.intervenant != null)
            {
                this.intervenantBox.SelectedIndex = intervenantBox.FindStringExact(coursModifie.intervenant.ToString());
            }
        }
 private void upadateList()
 {
     this.listBox1.Items.Clear();
     typesListe = TypeCoursDAO.findAll();
     foreach (TypeCours type in typesListe)
     {
         this.listBox1.Items.Add(type);
     }
 }
예제 #3
0
        public void TestFindAll()
        {
            // test du fin by libelle
            List <TypeCours> resultatFind = TypeCoursDAO.findAll();

            foreach (TypeCours res in resultatFind)
            {
                Assert.IsNotNull(res.id);
                Assert.IsNotNull(res.libelle);
            }
        }
        private void loadType()
        {
            List <TypeCours> typeCours = TypeCoursDAO.findAll();

            foreach (TypeCours tc in typeCours)
            {
                this.typeBox.Items.Add(tc);
                if (tc.id == modifCours.typeCours.id)
                {
                    this.typeBox.SelectedItem = tc;
                }
            }
        }
        private void categorieCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.groupBox1.Enabled = true;
            categorie = (CategoriePersonnel)categorieCB.SelectedItem;
            List <TypeCours> tcs = TypeCoursDAO.findAll();

            List <Ratio> listeRatio = RatioDAO.findAll();

            this.typeCoursComboBox.Items.Clear();
            this.volumeTextBox.Text = categorie.volumeHoraire.ToString();
            foreach (Ratio ratio in listeRatio)
            {
                if (ratio.categoriePersonnel.id == categorie.id)
                {
                    this.typeCoursComboBox.Items.Add(ratio.typeCours);
                }
            }
        }
예제 #6
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();
                }
            }
        }