Преглед изворни кода

CHG Poc de l'integration de educfacile à la vue college

olivier.massot пре 7 година
родитељ
комит
060945b8ef

+ 4 - 3
CD67.FicheCollege.Entity/App.config

@@ -24,8 +24,9 @@
     </defaultConnectionFactory>
   </entityFramework>
   <connectionStrings>
-    <!-- Copie locale de la chaine de connexion pour l'éditeur graphique de modèle -->
-    <add name="EducfEntities" providerName="Npgsql" connectionString="Server=POSTGIS-01;User Id=usereducfro;Password=usereducfR0;Port=5432;Database=educf;" />
+    <!-- Copie locale de la chaine de connexion pour l'éditeur graphique de modèle --><!--<add name="EducfEntities" providerName="Npgsql" connectionString="metadata=res://*/EducfModel.csdl|res://*/EducfModel.ssdl|res://*/EducfModel.msl;Server=POSTGIS-01;User Id=usereducfro;Password=usereducfR0;Port=5432;Database=educf;" />-->
+    <add name="Entities" connectionString="metadata=res://*/EntityModel.csdl|res://*/EntityModel.ssdl|res://*/EntityModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=T-MSSQL-02\SQLSTD2K14;initial catalog=FicheCollege;persist security info=True;user id=FicheCollege_admin;password=bk9JFwqSwYw7mEPiOhnu;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+    <add name="EducfEntities" connectionString="metadata=res://*/EducfModel.csdl|res://*/EducfModel.ssdl|res://*/EducfModel.msl;provider=Npgsql;provider connection string=&quot;Host=POSTGIS-01;Username=usereducfro;Password=usereducfR0;Port=5432;Database=educf&quot;" providerName="System.Data.EntityClient" />
   </connectionStrings>
   <startup>
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
@@ -46,7 +47,7 @@
   <system.data>
     <DbProviderFactories>
       <add name="Npgsql Data Provider" invariant="Npgsql" description="Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql" />
-      <add name="dotConnect for PostgreSQL" invariant="Devart.Data.PostgreSql" description="Devart dotConnect for PostgreSQL" type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version= 7.10.1134.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
+      <!--<add name="dotConnect for PostgreSQL" invariant="Devart.Data.PostgreSql" description="Devart dotConnect for PostgreSQL" type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version= 7.10.1134.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />-->
     </DbProviderFactories>
   </system.data>
   <runtime>

+ 2 - 5
CD67.FicheCollege.Entity/EducfModel.edmx

@@ -4,7 +4,7 @@
   <edmx:Runtime>
     <!-- SSDL content -->
     <edmx:StorageModels>
-      <Schema Namespace="educfModel.Store" Provider="Npgsql" ProviderManifestToken="9.2.8" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
+    <Schema Namespace="educfModel.Store" Provider="Npgsql" ProviderManifestToken="9.2.8" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
         <EntityType Name="commune">
           <Key>
             <PropertyRef Name="id" />
@@ -107,8 +107,6 @@
           <Property Name="typerue" Type="varchar" MaxLength="100" />
           <Property Name="rivoli" Type="varchar" MaxLength="10" />
         </EntityType>
-        <!--Erreurs détectées durant la génération :
-avertissement 6002: La table/vue 'educf.educf.typeetablissement' n'a pas de clé primaire définie. La clé a été déduite et la définition a été créée en tant que table/vue en lecture seule.-->
         <Association Name="FK_EtabEffectifAnnee">
           <End Role="etablissement" Type="Self.etablissement" Multiplicity="0..1">
             <OnDelete Action="Cascade" />
@@ -152,8 +150,7 @@ avertissement 6002: La table/vue 'educf.educf.typeetablissement' n'a pas de clé
             <End Role="rues" EntitySet="rues" />
           </AssociationSet>
         </EntityContainer>
-      </Schema>
-    </edmx:StorageModels>
+      </Schema></edmx:StorageModels>
     <!-- CSDL content -->
     <edmx:ConceptualModels>
       <Schema Namespace="educfModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">

+ 7 - 0
CD67.FicheCollege.Entity/Extend/College.cs

@@ -2,6 +2,7 @@
 using CD67.FicheCollege.Entity.WsAgents;
 using CD67.FicheCollege.Entity.WsExternes;
 using System;
+using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 
 namespace CD67.FicheCollege.Entity
@@ -18,6 +19,7 @@ namespace CD67.FicheCollege.Entity
         public WsExternes.Agent adjoint;
         public WsAgents.Agent gestionnaire1;
         public WsAgents.Agent gestionnaire2;
+        public Dictionary<string, string> educfData = new Dictionary<string, string>();
 
         // Charge les données d'identité des agents depuis le web-service
         public void hydrate()
@@ -45,6 +47,11 @@ namespace CD67.FicheCollege.Entity
             }
 
         }
+
+        public void loadEducfData(EducfEntities educfdb)
+        {
+
+        }
     }
 
     /// <summary>

+ 18 - 1
CD67.FicheCollege.MVC/Controllers/CollegesController.cs

@@ -38,6 +38,23 @@ namespace CD67.FicheCollege.MVC.Controllers
             }
 
             college.hydrate();
+
+            // Chargement des données Educ'facile
+            if (!string.IsNullOrEmpty(college.CodeRne))
+            {
+                EducfEntities educfdb = new EducfEntities();
+                EducfEtablissementFactory educfFact = new EducfEtablissementFactory(educfdb);
+                etablissement educf_etablissement = educfFact.getByRne(college.CodeRne);
+                if (educf_etablissement != null)
+                {
+                    college.educfData.Add("commune", educf_etablissement.rue.commune.nom);
+                }
+                else
+                {
+                    college.educfData.Add("commune", "Pas de données");
+                }
+            }
+            
             CollegeViewModel model = new CollegeViewModel(college, db, ModeAcces.Lecture);
 
             return View(model);
@@ -149,7 +166,7 @@ namespace CD67.FicheCollege.MVC.Controllers
             collegeFactory.delete(ref college);
             return RedirectToAction("Index", new { annee_id = annee_id });
         }
-
+        
         protected override void Dispose(bool disposing)
         {
             if (disposing)

+ 20 - 5
CD67.FicheCollege.MVC/Views/Colleges/Details.cshtml

@@ -32,9 +32,15 @@
     </legend>
     <dl class="dl-horizontal">
         <dt>
-            @Html.DisplayNameFor(model => college.TypeCollege.Libelle)
+            @Html.DisplayNameFor(model => college.CodeRne)
         </dt>
+        <dd>
+            @Html.DisplayFor(model => college.CodeRne)
+        </dd>
 
+        <dt>
+            @Html.DisplayNameFor(model => college.TypeCollege.Libelle)
+        </dt>
         <dd>
             @Html.DisplayFor(model => college.TypeCollege.Libelle)
         </dd>
@@ -42,7 +48,6 @@
         <dt>
             @Html.DisplayNameFor(model => college.Adresse)
         </dt>
-
         <dd>
             @Html.DisplayFor(model => college.AdresseComplete)
         </dd>
@@ -50,7 +55,6 @@
         <dt>
             @Html.DisplayNameFor(model => college.Tel)
         </dt>
-
         <dd>
             @Html.DisplayFor(model => college.Tel)
         </dd>
@@ -58,7 +62,6 @@
         <dt>
             @Html.DisplayNameFor(model => college.Fax)
         </dt>
-
         <dd>
             @Html.DisplayFor(model => college.Fax)
         </dd>
@@ -66,7 +69,6 @@
         <dt>
             @Html.DisplayNameFor(model => college.Email)
         </dt>
-
         <dd>
             @Html.DisplayFor(model => college.Email)
         </dd>
@@ -190,7 +192,20 @@
     }
 </div>
 
+<legend>
+    Educ'Facile
+</legend>
 
+<div>
+    <table class="datatable table">
+        @foreach(KeyValuePair<string, string> entry in college.educfData){
+            <tr>
+                <th>@entry.Key</th>
+                <td>@entry.Value</td>
+            </tr>
+        }
+    </table>
+</div>