| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Data;
- using System.Data.SqlClient;
- using CG67.FicheCollege.Domaine;
- using CG67.FicheCollege.Interface;
- namespace CG67.FicheCollege.Entrepot
- {
- class EntrepotEffectifDetail: EntrepotBase, IEntrepotEffectifDetail
- {
- public IList<EffectifDetail> GetByCodeRNEAndAnnee(string codeRNE, int annee)
- {
- IList<EffectifDetail> resultat = new List<EffectifDetail>();
- using (SqlConnection connexion = new SqlConnection(this.ChaineDeConnexion))
- {
- try
- {
- connexion.Open();
- using (SqlCommand command = connexion.CreateCommand())
- {
- //On récupère les effectifs détaillés pour les classes de SEGPA, CLA, UPI
- command.CommandText = "Select annee, filiere, Sum(TotalEleves) As SomEleves from Effectif GROUP BY CodeRNE, Annee, Filiere HAVING CodeRNE = @RNE AND Annee = @Annee ORDER BY Filiere";
- command.Parameters.AddWithValue("@RNE", codeRNE);
- command.Parameters.AddWithValue("@Annee", annee);
- using (SqlDataReader dr = command.ExecuteReader())
- {
- while (dr.Read())
- {
- resultat.Add(new EffectifDetail(Convert.ToInt16(dr["Annee"].ToString()), dr["Filiere"].ToString(), Convert.ToInt16(dr["SomEleves"].ToString())));
- }
- }
- }
- }
- catch (Exception erreurInterne)
- {
- throw new Exception(" " + erreurInterne);
- }
- finally
- {
- if (connexion.State == ConnectionState.Open)
- connexion.Close();
- }
- }
- return resultat;
- }
- }
- }
-
-
|