/// <summary> /// Récupére les instances des intervenants sélectionnés dans les filtres /// </summary> /// <returns>La liste d'instances d'intervenant</returns> private List <Intervenant> GetIntervenantsFiltre() { List <Intervenant> intervenantsFiltre = new List <Intervenant>(); for (int i = 0; i < listeEleves.CheckedItems.Count; i++) { string strEtudiant = listeEleves.CheckedItems[i].ToString(); string nomEtPrenom = strEtudiant.Split('_')[0]; string promotion = strEtudiant.Split('_')[1]; Etudiant etudiant = _repertoire.GetEtudiant(int.Parse(promotion.Split(' ')[2]), nomEtPrenom.Split(' ')[0], nomEtPrenom.Split(' ')[1]); if (etudiant != null) { intervenantsFiltre.Add(etudiant); } } for (int j = 0; j < listeProfs.CheckedItems.Count; j++) { string strProf = listeProfs.CheckedItems[j].ToString(); Professeur professeur = _repertoire.GetProfesseur(strProf.Split(' ')[0], strProf.Split(' ')[1]); if (professeur != null) { intervenantsFiltre.Add(professeur); } } for (int k = 0; k < listeIntervenants.CheckedItems.Count; k++) { string strExte = listeIntervenants.CheckedItems[k].ToString(); Exterieur exterieur = _repertoire.GetExterieur(strExte.Split(' ')[0], strExte.Split(' ')[1], strExte.Split(' ')[2]); if (exterieur != null) { intervenantsFiltre.Add(exterieur); } } return(intervenantsFiltre); }
private void RemplirParticipants() { foreach (Role role in _projet.ListeRoles) { Intervenant intervenant = role.Intervenant; Etudiant etudiant = _repertoire.GetEtudiant(_projet.AnneesPromos(), intervenant); Professeur professeur = _repertoire.GetProfesseur(intervenant); Exterieur exterieur = _repertoire.GetExterieur(intervenant); if (etudiant != null) { participantsTextBox.Text += etudiant.Nom + " " + etudiant.Prenom + " " + etudiant.Mail + " - Promotion " + etudiant.AnneePromotion + "\n"; } else if (professeur != null) { participantsTextBox.Text += "(Professeur) " + professeur.Nom + " " + professeur.Prenom + " " + professeur.Mail + " " + professeur.Titre + "\n"; } else if (exterieur != null) { participantsTextBox.Text += "(Intervenant Extérieur) " + exterieur.Nom + " " + exterieur.Prenom + " " + exterieur.Mail + " " + exterieur.Organisation + "\n"; } else { participantsTextBox.Text += intervenant.Nom + " " + intervenant.Prenom + " " + intervenant.Mail + "\n"; } } }
/// <summary> /// Vérifie que tous les champs sont remplis correctement avant de créer le professeur /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Valider_Click(object sender, EventArgs e) { if (nomProf.TextLength != 0 && prenomProf.TextLength != 0 && mailProf.TextLength != 0) { if (RegexUtilities.IsValidEmail(mailProf.Text)) { List <Matiere> matieresEnseignees = new List <Matiere>(); if (liste_matieres.CheckedItems.Count != 0) { for (int i = 0; i < liste_matieres.CheckedItems.Count; i++) { string strCode = liste_matieres.CheckedItems[i].ToString().Split('-')[0]; Matiere matiere = Repertoire.GetMatiere(strCode); if (matiere != null) { matieresEnseignees.Add(matiere); } } } ReturnMatieresEnseignees = matieresEnseignees; ReturnProfesseur = new Professeur(nomProf.Text.Replace(' ', '-'), prenomProf.Text.Replace(' ', '-'), mailProf.Text, titreProf.Text); this.Visible = false; } else { MessageBox.Show("E-mail non valide", "L'e-mail entré est invalide.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Information manquante", "Tous les champs doivent être remplis pour continuer", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Ajoute un professeur à la liste des professeurs et au répertoire /// </summary> /// <param name="professeur">professeur à ajouter</param> /// <param name="matieresEnseignees">matières auxquelles le professeur est asssocié</param> private void AjouterProfesseur(Professeur professeur, List <Matiere> matieresEnseignees) { repertoire.AddProfesseur(professeur, matieresEnseignees); listeProfesseurs.BeginUpdate(); listeProfesseurs.Items.Add(professeur.Nom + " " + professeur.Prenom); listeProfesseurs.EndUpdate(); }
public void AddProfesseur(Professeur professeur, List <Matiere> matieresEnseignees) { professeurs.Add(professeur); foreach (Matiere matiere in matieresEnseignees) { int index = matieres.FindIndex(m => m.Code.Equals(matiere.Code)); matieres[index].AjouterProfesseur(professeur); } }
/// <summary> /// Récupére les professeurs ajoutés au projet /// </summary> /// <returns>la liste des professeurs ajoutés au projet</returns> private List <Professeur> ProfesseursProjet() { List <Professeur> professeurs = new List <Professeur>(); for (int i = 0; i < affichageProfesseurs.Items.Count; i++) { string strProf = affichageProfesseurs.Items[i].ToString(); Professeur professeur = repertoire.GetProfesseur(strProf.Split(' ')[0], strProf.Split(' ')[1]); if (professeur != null) { professeurs.Add(professeur); } } return(professeurs); }
/// <summary> /// Vérifie que tous les champs sont remplis correctement avant de créer la matière /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Valider_Click(object sender, EventArgs e) { if (code.TextLength == 8) { if (nomMatiere.TextLength != 0) { if (liste_modules.SelectedItem != null) { if (anneeEnseignement.SelectedItem != null) { List <Professeur> enseignants = new List <Professeur>(); for (int i = 0; i < listeProf.CheckedItems.Count; i++) { string nom = listeProf.CheckedItems[i].ToString().Split(' ')[0]; string prenom = listeProf.CheckedItems[i].ToString().Split(' ')[1]; Professeur professeur = Repertoire.GetProfesseur(nom, prenom); if (professeur != null) { enseignants.Add(professeur); } } ReturnModule = Repertoire.GetModule(liste_modules.SelectedItem.ToString().Split('-')[0]); ReturnMatiere = new Matiere(code.Text, nomMatiere.Text, anneeEnseignement.SelectedItem.ToString()); ReturnMatiere.AjouterProfesseur(enseignants.ToArray()); ReturnModule.AjouterMatiere(ReturnMatiere); this.Visible = false; } else { MessageBox.Show("Année d'enseignement manquante", "Veuillez sélectionner une année d'enseignement.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Module manquant", "Veuillez sélectionner le module de la matière.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Nom de la matière manquant", "Veuilez renseigner le nom de la matière.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Code invalide", "Le code saisi pour la matière est invalide.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }