private void chargerÉlèveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.pnlElève.Hide();
     FichRechercher f = new FichRechercher();
     if (f.ShowDialog() == DialogResult.OK)
     {
         this.eleveCourant = f.EleveCourant;
         this.sectionCourante = f.SectionCourante;
         this.RafraîchirAffichages();
     }
 }
Beispiel #2
0
 /// <summary>
 /// Charge la liste des élèves d'une section donnée.
 /// </summary>
 /// <param name="nom">contient le nom ou le debut de nom d'une élève</param>
 /// <param name="section">Section à laquelle appartient l'élève</param>
 /// <returns></returns>        
 public static List<BO.Eleve> ChargerListeDeEleve(string nom, BO.Section section)
 {
     List<BO.Eleve> retVal = new List<BO.Eleve>();
     SqlConnection connection = Utilitaire.ObtenirConnexion();
     string requête =
         @"SELECT ele.ID, ele.NOM, ele.PRENOM, ele.DTE_NAISSANCE
             from Etudiant ele
             inner join Inscrire i
                 on 	ele.ID = i.FK_ETUDIANT
             inner join Section s
                 on s.ID = i.FK_SECTION
             where s.ID = @SectionId and ele.NOM like @Name + '%'";
     SqlCommand commande = new SqlCommand(requête, connection);
     commande.Parameters.AddWithValue("@Name", nom);
     commande.Parameters.AddWithValue("@SectionId", section.Id);
     try
     {
         connection.Open();
         SqlDataReader lecteur = commande.ExecuteReader();
         while (lecteur.Read())
         {
             int eleveId = int.Parse(lecteur["ID"].ToString());
             BO.Eleve eleve = new BO.Eleve(eleveId);
             eleve.Nom = lecteur["NOM"].ToString();
             eleve.Prenom = lecteur["PRENOM"].ToString();
             eleve.DteNaissance = lecteur["DTE_NAISSANCE"].ToString();
             retVal.Add(eleve);
         }
         lecteur.Close();
     }
     catch (SqlException ex)
     {
         throw ex;
     }
     finally
     {
         connection.Close();
     }
     return retVal;
 }
 public FichePrincipale()
 {
     InitializeComponent();
     this.eleveCourant = null;
     this.sectionCourante = null;
 }