| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Data;
- using System.Data.SqlClient;
- using System.Collections.Generic;
- using System.Text;
- using CG67.FicheCollege.Domaine;
- using CG67.FicheCollege.Interface;
- namespace CG67.FicheCollege.Entrepot
- {
- public class EntrepotContratAide : EntrepotBase, IEntrepotContratAide
- {
- public IList<ContratAide> GetByCodeRNE(string codeRNE)
- {
- IList<ContratAide> resultat = new List<ContratAide>();
- using (SqlConnection connexion = new SqlConnection(this.ChaineDeConnexion))
- {
- try
- {
- int nbJourFormation;
- double valeurETP;
- connexion.Open();
- using (SqlCommand command = connexion.CreateCommand())
- {
- //on récupère les ATC en contrat aidés.
- command.CommandText = "Select ValeurETP, TypeContact, Nom, Prenom, Fonction, Fonction, Catégorie, Grade, Sum(NbJours) as NbJoursFormation,contratAide from ATC INNER JOIN Contact ON (ATC.Id = Contact.Id) LEFT JOIN Formation_ATC ON (ATC.Id = Formation_ATC.IdATC) WHERE CodeRNE = @RNE GROUP BY ValeurETP, TypeContact, Nom, Prenom, Fonction, Fonction, Catégorie, Grade,ContratAide order by nom,prenom";
- command.Parameters.AddWithValue("@RNE", codeRNE);
- using (SqlDataReader dr = command.ExecuteReader())
- {
- while (dr.Read())
- {
- nbJourFormation = dr["NbJoursFormation"] == DBNull.Value ? 0 : Convert.ToInt32(dr["NbJoursFormation"].ToString());
- valeurETP = dr["ValeurETP"] == DBNull.Value ? 0 : Convert.ToDouble(dr["ValeurETP"].ToString());
- resultat.Add(new ContratAide(valeurETP, dr["Nom"].ToString(), dr["Prenom"].ToString(), dr["Fonction"].ToString(), dr["TypeContact"].ToString(), dr["Catégorie"].ToString(), dr["Grade"].ToString(), nbJourFormation, dr.GetBoolean(dr.GetOrdinal("contratAide"))));
- }
- }
- }
- }
- catch
- {
- throw;
- }
- finally
- {
- if (connexion.State == ConnectionState.Open)
- connexion.Close();
- }
- }
- return resultat;
- }
- }
- }
|