private void typeCours_SelectedIndexChanged(object sender, EventArgs e)
        {
            typeCours = (TypeCours)typeCoursComboBox.SelectedItem;
            List <Ratio> listeRatio = RatioDAO.findAll();

            ratioModif             = listeRatio.Find(x => x.categoriePersonnel.id == categorie.id && x.typeCours.id == typeCours.id);
            this.ratioTextBox.Text = ratioModif.ratio.ToString();
        }
        public double getSommeHorraire()
        {
            List <Ratio> ratio = RatioDAO.findAll();
            List <Cours> cours = CoursDAO.findByPersonnel(this.id);

            double somme = 0;

            foreach (Cours c in cours)
            {
                Ratio r = ratio.Find(x => x.typeCours.id == c.typeCours.id && x.categoriePersonnel.id == this.categoriePersonnel.id);
                somme += r.ratio * c.volumeHoraire;
            }
            return(Math.Round(somme, 2));
        }
        /// <summary>
        /// Evenement valider / modifier
        /// </summary>
        private void validerAction(object sender, EventArgs e)
        {
            categorie = (CategoriePersonnel)categorieCB.SelectedItem;

            if (categorie != null)
            {
                categorie.volumeHoraire = Int32.Parse(volumeTextBox.Text);
                CategoriePersonnelDAO.update(categorie);
            }
            if (ratioModif != null)
            {
                ratioModif.ratio = Convert.ToDouble(ratioTextBox.Text);
                RatioDAO.update(ratioModif);
            }
            this.Close();
        }
        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);
                }
            }
        }
 //Ajout
 private void button1_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(textBox1.Text))
     {
         DiplomeView.afficherPopup("Le nom est vide");
     }
     else
     {
         TypeCours type = new TypeCours(textBox1.Text);
         TypeCoursDAO.create(type);
         upadateList();
         List <CategoriePersonnel> catList = CategoriePersonnelDAO.findAll();
         foreach (CategoriePersonnel cat in catList)
         {
             Ratio r = new Ratio(type, cat);
             r.ratio = 1;
             RatioDAO.create(r);
         }
     }
 }
예제 #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();
                }
            }
        }