|
|
@@ -16,6 +16,9 @@ namespace CG67.FicheCollege.Entrepot
|
|
|
Contact cg = GetConseillerGeneralByRNE(codeRNE);
|
|
|
if (cg != null)
|
|
|
resultat.Add(cg);
|
|
|
+ Contact cg1 = GetConseillerGeneralSuppleantByRNE(codeRNE);
|
|
|
+ if (cg1 != null)
|
|
|
+ resultat.Add(cg1);
|
|
|
return resultat;
|
|
|
}
|
|
|
public IList<Contact> GetByCodeRNE(string codeRNE)
|
|
|
@@ -88,5 +91,44 @@ namespace CG67.FicheCollege.Entrepot
|
|
|
return resultat;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public Contact GetConseillerGeneralSuppleantByRNE(string codeRNE)
|
|
|
+ {
|
|
|
+ Contact resultat = null;
|
|
|
+ using (SqlConnection connexion = new SqlConnection(this.ChaineDeConnexion))
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ connexion.Open();
|
|
|
+ using (SqlCommand command = connexion.CreateCommand())
|
|
|
+ {
|
|
|
+ //command.CommandText = "SELECT * FROM Contact WHERE id = (select idConseillerGeneral from etablissement where codeRNE=@RNE)";
|
|
|
+ command.CommandText = "SELECT * FROM Contact, Fonction WHERE (IdFonction = Fonction.Id) and Contact.id = (select IdSuppleant from etablissement where codeRNE=@RNE)";
|
|
|
+ command.Parameters.AddWithValue("@RNE", codeRNE);
|
|
|
+ string sup="suppleant";
|
|
|
+ using (SqlDataReader dr = command.ExecuteReader())
|
|
|
+ {
|
|
|
+ if (dr.Read())
|
|
|
+ {
|
|
|
+ resultat = new Contact(dr["Civilite"].ToString(), dr["Nom"].ToString(), dr["Prenom"].ToString(),sup, dr["TypeContact"].ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ if (connexion.State == ConnectionState.Open)
|
|
|
+ connexion.Close();
|
|
|
+ }
|
|
|
+ return resultat;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|