|
@@ -20,20 +20,27 @@ namespace CG67.FicheCollege.Entrepot
|
|
|
connexion.Open();
|
|
connexion.Open();
|
|
|
using (SqlCommand command = connexion.CreateCommand())
|
|
using (SqlCommand command = connexion.CreateCommand())
|
|
|
{
|
|
{
|
|
|
- command.CommandText = "SELECT count(Logement.Id) as NbrLogements, Contact.Fonction FROM Logement LEFT JOIN Logement_Contact ON (Logement.Id = Logement_Contact.IdLogement) LEFT JOIN Contact ON (Logement_Contact.IdContact = Contact.Id) WHERE Logement.CodeRNE = @RNE AND Logement_Contact.DateSortie is NULL AND Contact.CodeRNE = @RNE Group BY Contact.Fonction";
|
|
|
|
|
|
|
+ command.CommandText = "SELECT FonctionLocataire FROM Logement INNER JOIN Logement_Contact ON (Logement.Id = Logement_Contact.IdLogement) WHERE (Logement.CodeRNE= @RNE)";
|
|
|
command.Parameters.AddWithValue("@RNE", codeRNE);
|
|
command.Parameters.AddWithValue("@RNE", codeRNE);
|
|
|
using (SqlDataReader dr = command.ExecuteReader())
|
|
using (SqlDataReader dr = command.ExecuteReader())
|
|
|
{
|
|
{
|
|
|
|
|
+ int NbrAgents = 0;
|
|
|
|
|
+ int NbrLogements = 0;
|
|
|
while (dr.Read())
|
|
while (dr.Read())
|
|
|
- {
|
|
|
|
|
- resultat.NbrLogements += Convert.ToInt16(dr["NbrLogements"].ToString());
|
|
|
|
|
- // Si la fonction est de type ATC* (maintenance, entretien, etc...) on ajoute le nombre de logements au nombre d'agents logés (cf. requete)
|
|
|
|
|
- if (dr["Fonction"].ToString().StartsWith ("ATC"))
|
|
|
|
|
- resultat.NbrAgentsLoges += Convert.ToInt16(dr["NbrLogements"].ToString());
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ NbrLogements = NbrLogements + 1 ;
|
|
|
|
|
+
|
|
|
|
|
+ if (dr["FonctionLocataire"].ToString().Contains("ATC"))
|
|
|
|
|
+ NbrAgents=NbrAgents + 1 ;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ resultat.NbrLogements = Convert.ToInt16(NbrAgents.ToString());
|
|
|
|
|
+ resultat.NbrAgentsLoges = Convert.ToInt16(NbrAgents.ToString());
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
catch
|
|
catch
|
|
|
{
|
|
{
|
|
|
throw;
|
|
throw;
|
|
@@ -46,5 +53,6 @@ namespace CG67.FicheCollege.Entrepot
|
|
|
}
|
|
}
|
|
|
return resultat;
|
|
return resultat;
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+
|