Celine.meneu 16 years ago
parent
commit
f896e25b91

+ 1 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Domaine/CG67.FicheCollege.Domaine.csproj

@@ -41,6 +41,7 @@
     <Compile Include="ATC.cs" />
     <Compile Include="Bilinguisme.cs" />
     <Compile Include="ChiffresSignificatifs.cs" />
+    <Compile Include="ClasseDecouverte.cs" />
     <Compile Include="Commentaires.cs" />
     <Compile Include="Effectif.cs" />
     <Compile Include="Equipement.cs" />

+ 50 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Domaine/ClasseDecouverte.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CG67.FicheCollege.Domaine
+{
+    [Serializable]
+   public class ClasseDecouverte
+    {
+    private string mAnnee;
+    private string mLibelle;
+    private string mNbEleves;
+    private double mSubvention;
+
+
+        public string Annee
+        {
+            get { return mAnnee; }
+            set { mAnnee = value; }
+        }
+        
+        public string Libelle
+        {
+            get { return mLibelle; }
+            set { mLibelle = value; }
+        }
+        
+        public string NbEleves
+           {
+               get { return mNbEleves; }
+               set { mNbEleves = value; }
+        }
+
+        public double Subvention
+        {
+            get { return mSubvention; }
+            set { mSubvention= value; }
+        }
+  
+     public ClasseDecouverte(string annee, string libelle, string nbEleves, double Subvention)      
+{
+            this.mAnnee = annee;
+            this.mLibelle = libelle;
+            this.mNbEleves = nbEleves;
+            this.mSubvention = Subvention;
+        }
+
+        public ClasseDecouverte() { }
+}
+}

+ 1 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Entrepot/CG67.FicheCollege.Entrepot.csproj

@@ -44,6 +44,7 @@
     <Compile Include="EntrepotBase.cs" />
     <Compile Include="EntrepotBilinguisme.cs" />
     <Compile Include="EntrepotChiffresSignificatifs.cs" />
+    <Compile Include="EntrepotClasseDecouverte.cs" />
     <Compile Include="EntrepotCommentaires.cs" />
     <Compile Include="EntrepotContact.cs" />
     <Compile Include="EntrepotDotation.cs" />

+ 8 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Entrepot/EntrepotBase.cs

@@ -13,6 +13,7 @@ namespace CG67.FicheCollege.Entrepot
     {
         protected string ChaineDeConnexion;
         protected string ChaineDeConnexionCollege;
+        protected string ChaineDeConnexionSubvention;
       //  protected string ChaineDeConnexionAccess;
         public EntrepotBase()
         {
@@ -28,6 +29,13 @@ namespace CG67.FicheCollege.Entrepot
                 throw new Exception("Chaine de connexion Oracle non renseignée");
             }
 
+            this.ChaineDeConnexionSubvention = ConfigurationManager.AppSettings["ConnexionStringOracleSubvention"];
+            if (string.IsNullOrEmpty(this.ChaineDeConnexionSubvention))
+            {
+                throw new Exception("Chaine de connexion Oracle non renseignée");
+            }
+
+
             //this.ChaineDeConnexionAccess = ConfigurationManager.AppSettings["ConnexionStringAccess"];
             //if (string.IsNullOrEmpty(this.ChaineDeConnexionAccess))
             //{

+ 92 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Entrepot/EntrepotClasseDecouverte.cs

@@ -0,0 +1,92 @@
+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 EntrepotClasseDecouverte : EntrepotBase, IEntrepotClasseDecouverte
+    {
+
+        public ClasseDecouverte GetByCodeRNEAndAnnee(string codeRNE, int annee)
+        {
+            ClasseDecouverte resultat = new ClasseDecouverte();
+            string codeAstre = "";
+            using (SqlConnection connexion1 = new SqlConnection(this.ChaineDeConnexion))
+            {
+
+                try
+                {
+                    connexion1.Open();
+                    using (SqlCommand command = connexion1.CreateCommand())
+                    {
+                        command.CommandText = "Select NumeroTiersAstreGF from Etablissement WHERE CodeRNE = @RNE";
+                        command.Parameters.AddWithValue("@RNE", codeRNE);
+                        using (SqlDataReader dr = command.ExecuteReader())
+                        {
+                            if (dr.Read())
+                                codeAstre = dr["NumeroTiersAstreGF"].ToString();
+                        }
+                    }
+                }
+                catch
+                {
+                    throw;
+                }
+                finally
+                {
+                    if (connexion1.State == ConnectionState.Open)
+                        connexion1.Close();
+                }
+
+                using (SqlConnection connexion = new SqlConnection(this.ChaineDeConnexionSubvention))
+                {
+                    try
+                    {
+                        connexion.Open();
+                        using (SqlCommand command = connexion.CreateCommand())
+                        {
+                            command.CommandText = "Select * from ASTRE_W67_SIC_FICHE_ELU WHERE CodeRNE = @RNE";
+                            command.Parameters.AddWithValue("@RNE", codeAstre);
+                            using (SqlDataReader dr = command.ExecuteReader())
+                            {
+
+                                while (dr.Read())
+                                {
+                                    resultat= new ClasseDecouverte(dr["annee"].ToString(), dr["ZONE"].ToString(), dr["NB_ELEVE"].ToString(), Convert.ToDouble(dr["MT_VOTE"].ToString()));
+                                }
+                            }
+                        }
+                    }
+                    catch
+                    {
+                        throw;
+                    }
+                    finally
+                    {
+                        if (connexion.State == ConnectionState.Open)
+                            connexion.Close();
+                    }
+                }
+
+                return resultat;
+            }
+        }
+
+        #region IEntrepotClasseDecouverte Membres
+
+        ClasseDecouverte IEntrepotClasseDecouverte.GetByCodeRNEAndAnnee(string codeRNE, int annee)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        #endregion
+
+    }
+}
+       
+                    
+    

+ 1 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Interface/CG67.FicheCollege.Interface.csproj

@@ -41,6 +41,7 @@
     <Compile Include="IEntrepotATC.cs" />
     <Compile Include="IEntrepotBilinguisme.cs" />
     <Compile Include="IEntrepotChiffresSignificatifs.cs" />
+    <Compile Include="IEntrepotClasseDecouverte.cs" />
     <Compile Include="IEntrepotCommentaires.cs" />
     <Compile Include="IEntrepotContact.cs" />
     <Compile Include="IEntrepotDotation.cs" />

+ 12 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Interface/IEntrepotClasseDecouverte.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using CG67.FicheCollege.Domaine;
+
+namespace CG67.FicheCollege.Interface
+{
+    public interface IEntrepotClasseDecouverte
+    {
+        ClasseDecouverte GetByCodeRNEAndAnnee(string codeRNE, int annee);
+    }
+}

+ 1 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Web/CG67.FicheCollege.Web/Web.config

@@ -6,6 +6,7 @@
       <add key="ConnexionStringSic" value="Data Source=ESNA\sqlstd2k5_1;Initial Catalog=TSic;User Id=UserTSicRW;password=UserTS!cRW!"/>
       <add key="ConnexionStringOracleCollege" value="Data Source=PCOL;User Id=college;Password=college;"/>
       <add key="ConnexionStringAccess" value="Provider=microsoft.jet.oledb.4.0;Data Source=\\Moder\App_production\College\data\Base\BD Collège_prod.mdb;Persist Security Info=False;"/>
+      <add key="ConnexionStringOracleSubvention" value="Data Source=SGFP;User Id=ASTRE;Password=ASTRE;"/>
   </appSettings>
   <connectionStrings/>
   <!-- -->