Explorar el Código

archivage _ modif:
ajouter une suppleant pour les élus et les principaux des collèges

Celine.meneu hace 14 años
padre
commit
df968b4a66

+ 23 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Domaine/Etablissement.cs

@@ -642,6 +642,18 @@ namespace CG67.FicheCollege.Domaine
                 return retour;
             }
         }
+
+        public string PrincipalAdjoint
+        {
+            get
+            {
+                string retour = string.Empty;
+                foreach (Contact cont in Contacts)
+                    if (cont.Fonction.ToLower() == "principal adjoint")
+                        retour = cont.Civilite + " " + Utile.formatStringPrenom(cont.Prenom) + " " + cont.Nom.ToUpper();
+                return retour;
+            }
+        }
         /// <summary>
         /// retourne le gestionnaire de l'établissement
         /// </summary>
@@ -670,6 +682,17 @@ namespace CG67.FicheCollege.Domaine
                 return retour;
             }
         }
+        public string ConseillerGeneralSuppleant
+        {
+            get
+            {
+                string retour = string.Empty;
+                foreach (Contact cont in Contacts)
+                    if (cont.Fonction.ToLower() == "suppleant")
+                        retour = cont.Civilite + " " + Utile.formatStringPrenom(cont.Prenom) + " " + cont.Nom.ToUpper();
+                return retour;
+            }
+        }
         /// <summary>
         /// retourne la phrase decrivant l'effectif de l'établissement
         /// </summary>

+ 42 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Entrepot/EntrepotContact.cs

@@ -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;
+            }
+        }
     }
 }
+
+

+ 1 - 0
CG67.FicheCollege.root/CG67.FicheCollege/Core/CG67.FicheCollege.Interface/IEntrepotContact.cs

@@ -10,5 +10,6 @@ namespace CG67.FicheCollege.Interface
         IList<Contact> GetAllContactByCodeRNE(string codeRNE);
         IList<Contact> GetByCodeRNE(string codeRNE);
         Contact GetConseillerGeneralByRNE(string codeRNE);
+        Contact GetConseillerGeneralSuppleantByRNE(string codeRNE);
     }
 }

+ 32 - 10
CG67.FicheCollege.root/CG67.FicheCollege/Web/CG67.FicheCollege.Web/xslt/FicheCollege.xslt

@@ -85,22 +85,44 @@
             <xsl:value-of select="Etablissement/Principal"></xsl:value-of>
           </td>
         </tr>
+          <tr>
+              <td>Principal Adjoint</td>
+              <td>
+                  <xsl:if test ="Etablissement/PrincipalAdjoint!=''">
+                      <xsl:value-of select="Etablissement/PrincipalAdjoint"></xsl:value-of>
+                  </xsl:if>
+                  <xsl:if test ="Etablissement/PrincipalAdjoint=''">
+                      Vacant
+                  </xsl:if>
+               </td>
+          </tr>
         <tr>
           <td>Gestionnaire</td>
           <td>
             <xsl:value-of select="Etablissement/Gestionnaire"></xsl:value-of>
           </td>
         </tr>
-        <tr>
-          <td>Conseiller Général</td>
-          <td>
-            <xsl:if test ="Etablissement/ConseillerGeneral!=''">
-              <xsl:value-of select="Etablissement/ConseillerGeneral"></xsl:value-of>
-            </xsl:if>
-            <xsl:if test ="Etablissement/ConseillerGeneral=''">
-             Vacant
-            </xsl:if>
-          </td>
+          <tr>
+              <td>Conseiller Général</td>
+              <td>
+                  <xsl:if test ="Etablissement/ConseillerGeneral!=''">
+                      <xsl:value-of select="Etablissement/ConseillerGeneral"></xsl:value-of>
+                  </xsl:if>
+                  <xsl:if test ="Etablissement/ConseillerGeneral=''">
+                      Vacant
+                  </xsl:if>
+              </td>
+          </tr>
+          <tr>
+            <td>Suppléant</td>
+            <td>
+                <xsl:if test ="Etablissement/ConseillerGeneralSuppleant!=''">
+                    <xsl:value-of select="Etablissement/ConseillerGeneralSuppleant"></xsl:value-of>
+                </xsl:if>
+                <xsl:if test ="Etablissement/ConseillerGeneralSuppleant=''">
+                    Vacant
+                </xsl:if>
+            </td>
         </tr>
         <tr>
           <td>