瀏覽代碼

Intégration des subventions

Celine.meneu 13 年之前
父節點
當前提交
a9b4a11058

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

@@ -16,6 +16,7 @@ namespace CG67.FicheCollege.Entrepot
         protected string ChaineDeConnexionCollege;
         protected string ChaineDeConnexionSubvention;
         protected string ChaineDeConnexionRH;
+        protected string ChaineDeConnexionAstreGF;
       //  protected string ChaineDeConnexionAccess;
         public EntrepotBase()
         {
@@ -36,6 +37,11 @@ namespace CG67.FicheCollege.Entrepot
             {
                 throw new Exception("Chaine de connexion Oracle non renseignée");
             }
+            this.ChaineDeConnexionAstreGF = ConfigurationManager.AppSettings["ConnexionStringOracleAstreGF"];
+            if (string.IsNullOrEmpty(this.ChaineDeConnexionAstreGF))
+            {
+                throw new Exception("Chaine de connexion Oracle non renseignée");
+            }
 
             this.ChaineDeConnexionRH = ConfigurationManager.AppSettings["ConnexionStringOracleRH"];
             if (string.IsNullOrEmpty(this.ChaineDeConnexionRH))

+ 57 - 8
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Entrepot/EntrepotInvestissementDCE.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Text;
 using System.Data;
 using System.Data.SqlClient;
+using System.Data.OracleClient;
 using CG67.FicheCollege.Domaine;
 using CG67.FicheCollege.Interface;
 
@@ -13,21 +14,69 @@ namespace CG67.FicheCollege.Entrepot
         public IList<InvestissementDCE> GetByCodeRNEAndAnnee(string codeRNE, int annee)
         {
             IList<InvestissementDCE> resultat = new List<InvestissementDCE>();
-            using (SqlConnection connexion = new SqlConnection(this.ChaineDeConnexion))
+
+
+             string codeAstre = "";
+            string An = annee.ToString();
+            using (SqlConnection connexion1 = new SqlConnection(this.ChaineDeConnexion))
+            {
+
+                try
+                {
+                    connexion1.Open();
+                    using (SqlCommand command1 = connexion1.CreateCommand())
+                    {
+                        command1.CommandText = "Select NumeroAnaAstreGF from Etablissement WHERE CodeRNE = @RNE";
+                        command1.Parameters.AddWithValue("@RNE", codeRNE);
+                        using (SqlDataReader dr = command1.ExecuteReader())
+                        {
+                            if (dr.Read())
+                                codeAstre = dr["NumeroAnaAstreGF"].ToString();
+                        }
+                    }
+                }
+                catch
+                {
+                    throw;
+                }
+                finally
+                {
+                    if (connexion1.State == ConnectionState.Open)
+                        connexion1.Close();
+                }
+
+            }
+//            using (SqlConnection connexion = new SqlConnection(this.ChaineDeConnexion))
+            using (OracleConnection connexion = new OracleConnection(this.ChaineDeConnexionAstreGF))
+
             {
+
                 try
                 {
                     connexion.Open();
-                    using (SqlCommand command = connexion.CreateCommand())
+                    // using (SqlCommand command = connexion.CreateCommand())
+                    using (OracleCommand 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())
+//                        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())
+
+                        // command.CommandText = "Select NCOD_EXEBUD, LIB_C_COUT, MNT_VENT from SO.W67_ANA_MDT_VUE8_COLLEGE3800 INNER JOIN Etablissement ON Etablissement.NumeroAnaAstreGF = SO_W67_ANA_MDT_VUE8_COLLEGE3800.LIB_SIGLE WHERE CodeRNE = :RNE AND NCOD_EXEBUD = :Annee ORDER BY LIB_C_COUT ASC";
+                        command.CommandText = "Select NCOD_EXEBUD, LIB_C_COUT, Sum(TO_NUMBER(Round(MNT_VENT))) As SUBVENTION from SO.W67_ANA_MDT_VUE8_COLLEGE3800 WHERE  SO.W67_ANA_MDT_VUE8_COLLEGE3800.LIB_SIGLE= :COD_ASTRE AND NCOD_EXEBUD= :ANNEE GROUP BY NCOD_EXEBUD, LIB_C_COUT ORDER BY LIB_C_COUT ASC";
+                         command.Parameters.AddWithValue(":ANNEE", annee);
+                            command.Parameters.AddWithValue(":COD_ASTRE", codeAstre);
+ //                       command.Parameters.AddWithValue(":RNE", codeRNE);
+  //                      command.Parameters.AddWithValue(":Annee", annee);
+                        using (OracleDataReader ds = command.ExecuteReader())
+
+
+
                         {
-                            while (dr.Read())
+                            while (ds.Read())
                             {
-                                resultat.Add(new InvestissementDCE(Convert.ToInt16(dr["Annee"].ToString()), dr["Libelle"].ToString(),Convert.ToDouble(dr["Montant"].ToString())));
+//                                resultat.Add(new InvestissementDCE(Convert.ToInt16(dr["Annee"].ToString()), dr["Libelle"].ToString(), Convert.ToDouble(dr["Montant"].ToString())));
+                                resultat.Add(new InvestissementDCE(Convert.ToInt16(ds["NCOD_EXEBUD"].ToString()), ds["LIB_C_COUT"].ToString(), Convert.ToDouble(ds["SUBVENTION"].ToString())));
                             }
                         }
                     }

+ 1 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Testeur/App.config

@@ -4,6 +4,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="ConnexionStringOracleSubvention" value="Data Source=SGFP;User Id=ASTRE;Password=ASTRE;"/>
+    <add key="ConnexionStringOracleAstreGF" value="Data Source=SGTP;User Id=SO;Password=SO;"/>
     <add key="ConnexionStringOracleRH" value="Data Source=SRHP;User Id=CG67_ATC;Password=ATC_CG67;"/>
     <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;"/>
   </appSettings>

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

@@ -3,10 +3,11 @@
 <configuration>
 
   <appSettings>
-      <add key="ConnexionStringSic" value="Data Source=PAN\SQLSTD2K5_1;Initial Catalog=TSic;User Id=UserTSicRW;password=UserTS!cRW!"/>
+      <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;"/>
+      <add key="ConnexionStringOracleAstreGF" value="Data Source=SGFP;User Id=SO;Password=SO;"/>
       <add key="ConnexionStringOracleRH" value="Data Source=SRHP;User Id=CG67_ATC;Password=ATC_CG67;"/>
       <add key="AnneeEnCours" value="2011"/>
   </appSettings>

+ 6 - 4
CG67.FicheCollege.root/CG67.FicheCollege/Web/CG67.FicheCollege.Web/xslt/FicheCollege.xslt

@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-  <xsl:decimal-format name="europe" decimal-separator=',' grouping-separator='.' />  
-  <xsl:output method="xml" encoding="UTF-8"  omit-xml-declaration="yes"  />
+<!--    <xsl:decimal-format name="europe" decimal-separator=',' grouping-separator='.' /> -->
+
+    <xsl:decimal-format name="europe" decimal-separator=',' grouping-separator='.' />
+    <xsl:output method="xml" encoding="UTF-8"  omit-xml-declaration="yes"  />
   
   <xsl:template match="college">
     <div id="conteneur">
@@ -674,7 +676,7 @@
                       </td>
                         <td class="sansbordure"></td>
                       <td class="sansborduredroite">
-                        <xsl:value-of select="format-number(Montant,'###.###.##0','europe')"/>
+                                 <xsl:value-of select="format-number(Montant,'###.###.##0','europe')"/>
                         <xsl:text> €</xsl:text>
                       </td>
                         <td class="sansbordure"></td>
@@ -685,7 +687,7 @@
                   <td class="totalbordure">
                     <xsl:value-of select="format-number(sum(Etablissement/LstInvestissementDCE/InvestissementDCE/Montant),'###.###.##0','europe')" />
                     <xsl:text> €</xsl:text>
-                  </td>
+                  </td>  
                 </table>
               </xsl:if>
             </td>