Celine.meneu 16 years ago
parent
commit
b8e0541250

+ 1 - 1
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Entrepot/EntrepotChiffresSignificatifs.cs

@@ -49,7 +49,7 @@ namespace CG67.FicheCollege.Entrepot
                         //command.CommandText = "SELECT sum(TotalEleves) as totalEleves FROM Effectif WHERE Effectif.Annee = @Annee";
                         //command.CommandText ="SELECT Sum(EffectifTotal.EffectifTotal) AS SommeDeEffectifTotal FROM EffectifTotal GROUP BY EffectifTotal.Annee HAVING (((EffectifTotal.Annee)=@Annee) AND (Typedonnees='R'))";
                         //command.CommandText = "SELECT Sum(EffectifTotal.EffectifTotal) AS SommeDeEffectifTotal FROM EffectifTotal WHERE Annee = @Annee ";
-                        command.CommandText = "SELECT Sum(EffectifTotal.EffectifTotal) AS SommeDeEffectifTotal FROM EffectifTotal GROUP BY EffectifTotal.Annee, EffectifTotal.Typedonnees HAVING (EffectifTotal.Annee = @Annee) AND (EffectifTotal.TypeDonnees = 'R') ";
+                        command.CommandText = "SELECT Sum(EffectifTotal.EffectifTotal) AS SommeDeEffectifTotal FROM EffectifTotal GROUP BY EffectifTotal.Annee, EffectifTotal.Typedonnees, EffectifTotal.TypeClasses HAVING (EffectifTotal.Annee = @Annee) AND (EffectifTotal.TypeDonnees = 'R') AND (EffectifTotal.TypeClasses = 'SEGPA')";
                         //command.Parameters.AddWithValue("@Annee", annee);
                         sum = command.ExecuteScalar().ToString();
                         resultat.NbTotalEleves = string.IsNullOrEmpty(sum) ? (Int32) 0 : Convert.ToInt32 (sum);

+ 26 - 14
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Entrepot/EntrepotEtablissement.cs

@@ -52,7 +52,7 @@ namespace CG67.FicheCollege.Entrepot
             Etablissement resultat = null;
             using (SqlConnection connexion = new SqlConnection(this.ChaineDeConnexion))
             {
-                //try
+                try
                 {
                     connexion.Open();
                     using (SqlCommand command = connexion.CreateCommand())
@@ -64,9 +64,20 @@ namespace CG67.FicheCollege.Entrepot
                         {
                             if (dr.Read())
                             {
-                                string adresse = dr["NumRue"].ToString() + ", " + dr["TypeDeVoie"].ToString() + " " + dr["Voie"].ToString();
-                                
-                                resultat = new Etablissement(codeRNE, annee, dr["NomCollege"].ToString(),
+                                string adresse;
+                                if (dr["NumRue"].ToString()!="")
+                                {
+                                    adresse = dr["NumRue"].ToString() + ", " + dr["TypeDeVoie"].ToString() + " " + dr["Voie"].ToString();
+                                }
+                                else
+                                {
+                                    adresse = dr["TypeDeVoie"].ToString() + " " + dr["Voie"].ToString();
+                                }
+
+
+
+
+                                    resultat = new Etablissement(codeRNE, annee, dr["NomCollege"].ToString(),
                                     dr["TypeEtablissement"].ToString(), Convert.ToInt16(dr["AnneeConstruction"].ToString()),
                                     dr["Telephone"].ToString(), dr["Email"].ToString(), dr["Fax"].ToString(),
                                     dr["NomPropriétaire"].ToString(), adresse, dr["ComplementAdresse"].ToString(),
@@ -121,8 +132,9 @@ namespace CG67.FicheCollege.Entrepot
                             }
                         }
 
-                        command.CommandText = "SELECT Annee, TypeDonnees,EffectifTotal FROM EffectifTotal WHERE CodeRNE = @RNE AND Annee > @AnneeMoins10 ORDER BY Annee ASC";
+                        command.CommandText = "SELECT Annee, TypeDonnees,EffectifTotal FROM EffectifTotal WHERE CodeRNE = @RNE AND TypeClasses = @typeclasses AND Annee > @AnneeMoins10 ORDER BY Annee ASC";
                         command.Parameters.AddWithValue("@AnneeMoins10", annee - 10);
+                        command.Parameters.AddWithValue("@typeclasses", "Normal");
                         using (SqlDataReader dr4 = command.ExecuteReader())
                         {
                             resultat.LstEffectif = new List<Effectif>();
@@ -181,15 +193,15 @@ namespace CG67.FicheCollege.Entrepot
 
                     }
                 }
-                //catch
-                //{
-                //    throw;
-                //}
-                //finally
-                //{
-                //    if (connexion.State == ConnectionState.Open)
-                //        connexion.Close();
-                //}
+                catch
+                {
+                    throw;
+                }
+                finally
+                {
+                    if (connexion.State == ConnectionState.Open)
+                        connexion.Close();
+                }
             }