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 GetByCodeRNE(string codeRNE) { IList resultat = new List(); 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 Nom, Prenom, TypeContrat, Quotite from ContratAide WHERE CodeRNE = @RNE "; 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(dr["Nom"].ToString(), dr["Prenom"].ToString(), dr["Quotite"].ToString(), dr["TypeContrat"].ToString())); } } } } catch { throw; } finally { if (connexion.State == ConnectionState.Open) connexion.Close(); } } return resultat; } } }