| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 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
- {
- public class EntrepotInvestissementDCE : EntrepotBase, IEntrepotInvestissementDCE
- {
- public IList<InvestissementDCE> GetByCodeRNEAndAnnee(string codeRNE, int annee)
- {
- IList<InvestissementDCE> resultat = new List<InvestissementDCE>();
- using (SqlConnection connexion = new SqlConnection(this.ChaineDeConnexion))
- {
- try
- {
- connexion.Open();
- using (SqlCommand command = connexion.CreateCommand())
- {
- command.CommandText = "Select Annee, Libelle, Montant from Investissement INNER JOIN TypeDotation ON Investissement.IdDotation = TypeDotation.id WHERE CodeRNE = @RNE AND Annee = @Annee ORDER BY Libelle ASC";
- command.Parameters.AddWithValue("@RNE", codeRNE);
- command.Parameters.AddWithValue("@Annee", annee);
- using (SqlDataReader dr = command.ExecuteReader())
- {
- while (dr.Read())
- {
- resultat.Add(new InvestissementDCE(Convert.ToInt16(dr["Annee"].ToString()), dr["Libelle"].ToString(),Convert.ToDouble(dr["Montant"].ToString())));
- }
- }
- }
- }
- catch
- {
- throw;
- }
- finally
- {
- if (connexion.State == ConnectionState.Open)
- connexion.Close();
- }
- }
- return resultat;
- }
- }
- }
|