Sfoglia il codice sorgente

Merge branch '11-chapitre-1-fiche-d-identite-du-college' into 'experiment'

Resolve "Chapitre 1 : Fiche d’identité du Collège"

Closes #11

See merge request Culture-Territo-BI/FicheCollege!2
LEGRAND Julien 8 anni fa
parent
commit
dc7983cd35
53 ha cambiato i file con 2046 aggiunte e 226 eliminazioni
  1. 14 0
      CD67.FicheCollege.BDD/CD67.FicheCollege.BDD.refactorlog
  2. 2 0
      CD67.FicheCollege.BDD/CD67.FicheCollege.BDD.sqlproj
  3. 19 0
      CD67.FicheCollege.BDD/Colleges.sql
  4. 33 0
      CD67.FicheCollege.BDD/Identites.sql
  5. 2 1
      CD67.FicheCollege.BDD/Territoires.sql
  6. 7 0
      CD67.FicheCollege.Entity/CD67.FicheCollege.Entity.csproj
  7. 36 0
      CD67.FicheCollege.Entity/College.cs
  8. 3 1
      CD67.FicheCollege.Entity/EntityModel.Context.cs
  9. 1 1
      CD67.FicheCollege.Entity/EntityModel.Designer.cs
  10. 282 12
      CD67.FicheCollege.Entity/EntityModel.edmx
  11. 8 3
      CD67.FicheCollege.Entity/EntityModel.edmx.diagram
  12. 40 0
      CD67.FicheCollege.Entity/Extend/College.cs
  13. 3 1
      CD67.FicheCollege.Entity/Extend/Territoire.cs
  14. 49 0
      CD67.FicheCollege.Entity/Identite.cs
  15. 11 1
      CD67.FicheCollege.Entity/Territoire.cs
  16. 9 0
      CD67.FicheCollege.Entity/TypeCollege.cs
  17. 8 0
      CD67.FicheCollege.Factory/CD67.FicheCollege.Factory.csproj
  18. 27 0
      CD67.FicheCollege.Factory/CollegeFactory.cs
  19. 29 0
      CD67.FicheCollege.Factory/IdentiteFactory.cs
  20. 21 0
      CD67.FicheCollege.Factory/Internal/CollegeFactory.cs
  21. 21 0
      CD67.FicheCollege.Factory/Internal/IdentiteFactory.cs
  22. 2 2
      CD67.FicheCollege.MVC/App_Start/BundleConfig.cs
  23. 26 2
      CD67.FicheCollege.MVC/CD67.FicheCollege.MVC.csproj
  24. 0 40
      CD67.FicheCollege.MVC/Content/cd67-custom.css
  25. 87 0
      CD67.FicheCollege.MVC/Content/cd67-custom.less
  26. 69 97
      CD67.FicheCollege.MVC/Content/cd67-model.less
  27. 158 0
      CD67.FicheCollege.MVC/Controllers/CollegesController.cs
  28. 99 0
      CD67.FicheCollege.MVC/Controllers/IdentitesController.cs
  29. 9 25
      CD67.FicheCollege.MVC/Controllers/TerritoireController.cs
  30. 40 0
      CD67.FicheCollege.MVC/Internal/MvcHtmlHelpers.cs
  31. 40 0
      CD67.FicheCollege.MVC/Internal/Referentiel.cs
  32. 17 0
      CD67.FicheCollege.MVC/Models/CollegeViewModel.cs
  33. 31 0
      CD67.FicheCollege.MVC/Models/ContactViewModel.cs
  34. 20 0
      CD67.FicheCollege.MVC/Models/ModeAcces.cs
  35. 13 1
      CD67.FicheCollege.MVC/Mvc.sitemap
  36. 36 0
      CD67.FicheCollege.MVC/Properties/Settings.Designer.cs
  37. 9 0
      CD67.FicheCollege.MVC/Properties/Settings.settings
  38. 3 0
      CD67.FicheCollege.MVC/Scripts/cd67-colorbox.js
  39. 3 2
      CD67.FicheCollege.MVC/Scripts/cd67-picker.js
  40. 126 0
      CD67.FicheCollege.MVC/Views/Colleges/Details.cshtml
  41. 201 0
      CD67.FicheCollege.MVC/Views/Colleges/Edit.cshtml
  42. 74 0
      CD67.FicheCollege.MVC/Views/Colleges/Index.cshtml
  43. 3 6
      CD67.FicheCollege.MVC/Views/Home/Index.cshtml
  44. 60 0
      CD67.FicheCollege.MVC/Views/Identites/Details.cshtml
  45. 207 0
      CD67.FicheCollege.MVC/Views/Identites/Edit.cshtml
  46. 19 6
      CD67.FicheCollege.MVC/Views/Shared/_Layout.cshtml
  47. 13 6
      CD67.FicheCollege.MVC/Views/Territoire/Create.cshtml
  48. 15 0
      CD67.FicheCollege.MVC/Views/Territoire/Delete.cshtml
  49. 13 5
      CD67.FicheCollege.MVC/Views/Territoire/Edit.cshtml
  50. 6 12
      CD67.FicheCollege.MVC/Views/Territoire/Index.cshtml
  51. 1 0
      CD67.FicheCollege.MVC/Views/Web.config
  52. 20 2
      CD67.FicheCollege.MVC/Web.config
  53. 1 0
      CD67.FicheCollege.MVC/packages.config

+ 14 - 0
CD67.FicheCollege.BDD/CD67.FicheCollege.BDD.refactorlog

@@ -63,4 +63,18 @@
     <Property Name="ParentElementType" Value="SqlTable" />
     <Property Name="NewName" Value="Referent_SID" />
   </Operation>
+  <Operation Name="Rename Refactor" Key="733e13cf-50d0-43ce-b246-b440fad4771d" ChangeDateTime="01/08/2018 17:04:16">
+    <Property Name="ElementName" Value="[dbo].[College].[Code_TAD]" />
+    <Property Name="ElementType" Value="SqlSimpleColumn" />
+    <Property Name="ParentElementName" Value="[dbo].[College]" />
+    <Property Name="ParentElementType" Value="SqlTable" />
+    <Property Name="NewName" Value="Territoire_Id" />
+  </Operation>
+  <Operation Name="Rename Refactor" Key="8145a11a-e0c9-4b98-887b-77f0639a3fdf" ChangeDateTime="01/10/2018 09:09:22">
+    <Property Name="ElementName" Value="[dbo].[FicheIdentite].[Id]" />
+    <Property Name="ElementType" Value="SqlSimpleColumn" />
+    <Property Name="ParentElementName" Value="[dbo].[FicheIdentite]" />
+    <Property Name="ParentElementType" Value="SqlTable" />
+    <Property Name="NewName" Value="College_Id" />
+  </Operation>
 </Operations>

+ 2 - 0
CD67.FicheCollege.BDD/CD67.FicheCollege.BDD.sqlproj

@@ -62,6 +62,8 @@
   <ItemGroup>
     <Build Include="TypesCollege.sql" />
     <Build Include="Territoires.sql" />
+    <Build Include="Colleges.sql" />
+    <Build Include="Identites.sql" />
   </ItemGroup>
   <ItemGroup>
     <RefactorLog Include="CD67.FicheCollege.BDD.refactorlog" />

+ 19 - 0
CD67.FicheCollege.BDD/Colleges.sql

@@ -0,0 +1,19 @@
+CREATE TABLE [dbo].[Colleges]
+(
+	[Id] NVARCHAR(8) NOT NULL PRIMARY KEY, 
+	[Libelle] NVARCHAR(255) NOT NULL, 
+	[Adresse] NVARCHAR(255) NULL, 
+	[Code_Postal] NVARCHAR(5) NULL, 
+    [TypeCollege_Id] INT NOT NULL, 
+	[Commune_Insee] NVARCHAR(5) NULL, 
+	[Commune] NVARCHAR(255) NOT NULL, 
+    [Canton] NVARCHAR(255) NULL, 
+    [Territoire_Id] NVARCHAR(10) NULL, 
+    [TAD] NVARCHAR(255) NULL, 
+    [CDC] NVARCHAR(255) NULL, 
+	[Tel] NVARCHAR(255) NULL,
+	[Fax] NVARCHAR(255) NULL,
+	[Email] NVARCHAR(255) NULL,
+    CONSTRAINT [FK_Colleges_TypesCollege] FOREIGN KEY ([TypeCollege_Id]) REFERENCES [TypesCollege]([Id]), 
+    CONSTRAINT [FK_Colleges_Territoires] FOREIGN KEY ([Territoire_Id]) REFERENCES [Territoires]([Id])
+)

+ 33 - 0
CD67.FicheCollege.BDD/Identites.sql

@@ -0,0 +1,33 @@
+CREATE TABLE [dbo].[Identites]
+(
+	[College_Id] NVARCHAR(8) NOT NULL PRIMARY KEY, 
+	[Principal_SID] NVARCHAR(64) NULL, 
+	[Principal_Login] NVARCHAR(255) NULL, 
+    [Principal_Nom] NVARCHAR(255) NULL, 
+    [Principal_Prenom] NVARCHAR(255) NULL, 
+    [Principal_Email] NVARCHAR(255) NULL, 
+    [Principal_Tel] NVARCHAR(255) NULL,
+	[Principal_Structure] NVARCHAR(255) NULL,
+	[Adjoint_SID] NVARCHAR(64) NULL, 
+	[Adjoint_Login] NVARCHAR(255) NULL, 
+	[Adjoint_Nom] NVARCHAR(255) NULL, 
+    [Adjoint_Prenom] NVARCHAR(255) NULL, 
+    [Adjoint_Email] NVARCHAR(255) NULL, 
+    [Adjoint_Tel] NVARCHAR(255) NULL,
+	[Adjoint_Structure] NVARCHAR(255) NULL,
+	[Gestionnaire_SID] NVARCHAR(64) NULL, 
+	[Gestionnaire_Login] NVARCHAR(255) NULL, 
+	[Gestionnaire_Nom] NVARCHAR(255) NULL, 
+    [Gestionnaire_Prenom] NVARCHAR(255) NULL, 
+    [Gestionnaire_Email] NVARCHAR(255) NULL, 
+    [Gestionnaire_Tel] NVARCHAR(255) NULL,
+	[Gestionnaire_Structure] NVARCHAR(255) NULL,
+	[Gestionnaire2_SID] NVARCHAR(64) NULL, 
+	[Gestionnaire2_Login] NVARCHAR(255) NULL, 
+	[Gestionnaire2_Nom] NVARCHAR(255) NULL, 
+    [Gestionnaire2_Prenom] NVARCHAR(255) NULL, 
+    [Gestionnaire2_Email] NVARCHAR(255) NULL, 
+    [Gestionnaire2_Tel] NVARCHAR(255) NULL,
+	[Gestionnaire2_Structure] NVARCHAR(255) NULL, 
+    CONSTRAINT [FK_FicheIdentite_College] FOREIGN KEY ([College_Id]) REFERENCES [Colleges]([Id])
+)

+ 2 - 1
CD67.FicheCollege.BDD/Territoires.sql

@@ -1,11 +1,12 @@
 CREATE TABLE [dbo].[Territoires]
 (
-	[Id] INT NOT NULL PRIMARY KEY IDENTITY, 
+	[Id] NVARCHAR(10) NOT NULL PRIMARY KEY, 
     [Libelle] NVARCHAR(255) NOT NULL, 
     [Referent_SID] NVARCHAR(64) NULL, 
     [Referent_Nom] NVARCHAR(255) NULL, 
     [Referent_Prenom] NVARCHAR(255) NULL, 
     [Referent_Structure] NVARCHAR(255) NULL, 
     [Referent_Login] NVARCHAR(255) NULL, 
+	[Referent_Email] NVARCHAR(255) NULL, 
     [Ordre] INT NOT NULL
 )

+ 7 - 0
CD67.FicheCollege.Entity/CD67.FicheCollege.Entity.csproj

@@ -59,6 +59,9 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="College.cs">
+      <DependentUpon>EntityModel.tt</DependentUpon>
+    </Compile>
     <Compile Include="EntityModel.Context.cs">
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
@@ -74,8 +77,12 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>EntityModel.edmx</DependentUpon>
     </Compile>
+    <Compile Include="Extend\College.cs" />
     <Compile Include="Extend\Territoire.cs" />
     <Compile Include="Extend\TypeCollege.cs" />
+    <Compile Include="Identite.cs">
+      <DependentUpon>EntityModel.tt</DependentUpon>
+    </Compile>
     <Compile Include="Internal\Entities.cs" />
     <Compile Include="Internal\FormattedDbEntityValidationException.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

+ 36 - 0
CD67.FicheCollege.Entity/College.cs

@@ -0,0 +1,36 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Ce code a été généré à partir d'un modèle.
+//
+//     Des modifications manuelles apportées à ce fichier peuvent conduire à un comportement inattendu de votre application.
+//     Les modifications manuelles apportées à ce fichier sont remplacées si le code est régénéré.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace CD67.FicheCollege.Entity
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class College
+    {
+        public string Id { get; set; }
+        public string Libelle { get; set; }
+        public string Adresse { get; set; }
+        public string Code_Postal { get; set; }
+        public int TypeCollege_Id { get; set; }
+        public string Commune_Insee { get; set; }
+        public string Commune { get; set; }
+        public string Canton { get; set; }
+        public string Territoire_Id { get; set; }
+        public string TAD { get; set; }
+        public string CDC { get; set; }
+        public string Tel { get; set; }
+        public string Fax { get; set; }
+        public string Email { get; set; }
+    
+        public virtual Territoire Territoire { get; set; }
+        public virtual TypeCollege TypeCollege { get; set; }
+        public virtual Identite Identite { get; set; }
+    }
+}

+ 3 - 1
CD67.FicheCollege.Entity/EntityModel.Context.cs

@@ -25,7 +25,9 @@ namespace CD67.FicheCollege.Entity
             throw new UnintentionalCodeFirstException();
         }
     
-        public virtual DbSet<Territoire> Territoires { get; set; }
         public virtual DbSet<TypeCollege> TypesCollege { get; set; }
+        public virtual DbSet<Territoire> Territoires { get; set; }
+        public virtual DbSet<College> Colleges { get; set; }
+        public virtual DbSet<Identite> Identites { get; set; }
     }
 }

+ 1 - 1
CD67.FicheCollege.Entity/EntityModel.Designer.cs

@@ -1,4 +1,4 @@
-// La génération de code T4 est activée pour le modèle 'C:\Users\julien.legrand\Documents\Developpements\FicheCollege\CD67.FicheCollege.Entity\EntityModel.edmx'. 
+// La génération de code T4 est activée pour le modèle 'C:\Users\julien.legrand\Documents\Developpements\FicheCollege_new\CD67.FicheCollege.Entity\EntityModel.edmx'. 
 // Pour activer la génération de code héritée, définissez la valeur de la propriété
 // du concepteur 'Stratégie de génération de code' sur 'ObjectContext hérité'. Cette propriété est disponible dans la fenêtre Propriétés lorsque le modèle
 //  est ouvert dans le concepteur.

+ 282 - 12
CD67.FicheCollege.Entity/EntityModel.edmx

@@ -5,17 +5,71 @@
     <!-- SSDL content -->
     <edmx:StorageModels>
     <Schema Namespace="ModeleMVC.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" 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="Colleges">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="nvarchar" MaxLength="8" Nullable="false" />
+          <Property Name="Libelle" Type="nvarchar" MaxLength="255" Nullable="false" />
+          <Property Name="Adresse" Type="nvarchar" MaxLength="255" />
+          <Property Name="Code_Postal" Type="nvarchar" MaxLength="5" />
+          <Property Name="TypeCollege_Id" Type="int" Nullable="false" />
+          <Property Name="Commune_Insee" Type="nvarchar" MaxLength="5" />
+          <Property Name="Commune" Type="nvarchar" MaxLength="255" Nullable="false" />
+          <Property Name="Canton" Type="nvarchar" MaxLength="255" />
+          <Property Name="Territoire_Id" Type="nvarchar" MaxLength="10" />
+          <Property Name="TAD" Type="nvarchar" MaxLength="255" />
+          <Property Name="CDC" Type="nvarchar" MaxLength="255" />
+          <Property Name="Tel" Type="nvarchar" MaxLength="255" />
+          <Property Name="Fax" Type="nvarchar" MaxLength="255" />
+          <Property Name="Email" Type="nvarchar" MaxLength="255" />
+        </EntityType>
+        <EntityType Name="Identites">
+          <Key>
+            <PropertyRef Name="College_Id" />
+          </Key>
+          <Property Name="College_Id" Type="nvarchar" MaxLength="8" Nullable="false" />
+          <Property Name="Principal_SID" Type="nvarchar" MaxLength="64" />
+          <Property Name="Principal_Login" Type="nvarchar" MaxLength="255" />
+          <Property Name="Principal_Nom" Type="nvarchar" MaxLength="255" />
+          <Property Name="Principal_Prenom" Type="nvarchar" MaxLength="255" />
+          <Property Name="Principal_Email" Type="nvarchar" MaxLength="255" />
+          <Property Name="Principal_Tel" Type="nvarchar" MaxLength="255" />
+          <Property Name="Principal_Structure" Type="nvarchar" MaxLength="255" />
+          <Property Name="Adjoint_SID" Type="nvarchar" MaxLength="64" />
+          <Property Name="Adjoint_Login" Type="nvarchar" MaxLength="255" />
+          <Property Name="Adjoint_Nom" Type="nvarchar" MaxLength="255" />
+          <Property Name="Adjoint_Prenom" Type="nvarchar" MaxLength="255" />
+          <Property Name="Adjoint_Email" Type="nvarchar" MaxLength="255" />
+          <Property Name="Adjoint_Tel" Type="nvarchar" MaxLength="255" />
+          <Property Name="Adjoint_Structure" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire_SID" Type="nvarchar" MaxLength="64" />
+          <Property Name="Gestionnaire_Login" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire_Nom" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire_Prenom" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire_Email" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire_Tel" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire_Structure" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire2_SID" Type="nvarchar" MaxLength="64" />
+          <Property Name="Gestionnaire2_Login" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire2_Nom" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire2_Prenom" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire2_Email" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire2_Tel" Type="nvarchar" MaxLength="255" />
+          <Property Name="Gestionnaire2_Structure" Type="nvarchar" MaxLength="255" />
+        </EntityType>
         <EntityType Name="Territoires">
           <Key>
             <PropertyRef Name="Id" />
           </Key>
-          <Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Id" Type="nvarchar" MaxLength="10" Nullable="false" />
           <Property Name="Libelle" Type="nvarchar" MaxLength="255" Nullable="false" />
           <Property Name="Referent_SID" Type="nvarchar" MaxLength="64" />
           <Property Name="Referent_Nom" Type="nvarchar" MaxLength="255" />
           <Property Name="Referent_Prenom" Type="nvarchar" MaxLength="255" />
           <Property Name="Referent_Structure" Type="nvarchar" MaxLength="255" />
           <Property Name="Referent_Login" Type="nvarchar" MaxLength="255" />
+          <Property Name="Referent_Email" Type="nvarchar" MaxLength="255" />
           <Property Name="Ordre" Type="int" Nullable="false" />
         </EntityType>
         <EntityType Name="TypesCollege">
@@ -26,49 +80,219 @@
           <Property Name="Libelle" Type="nvarchar" MaxLength="255" Nullable="false" />
           <Property Name="Ordre" Type="int" Nullable="false" />
         </EntityType>
+        <Association Name="FK_Colleges_Territoires">
+          <End Role="Territoires" Type="Self.Territoires" Multiplicity="0..1" />
+          <End Role="Colleges" Type="Self.Colleges" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Territoires">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="Colleges">
+              <PropertyRef Name="Territoire_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Colleges_TypesCollege">
+          <End Role="TypesCollege" Type="Self.TypesCollege" Multiplicity="1" />
+          <End Role="Colleges" Type="Self.Colleges" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="TypesCollege">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="Colleges">
+              <PropertyRef Name="TypeCollege_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_FicheIdentite_College">
+          <End Role="Colleges" Type="Self.Colleges" Multiplicity="1" />
+          <End Role="Identites" Type="Self.Identites" Multiplicity="0..1" />
+          <ReferentialConstraint>
+            <Principal Role="Colleges">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="Identites">
+              <PropertyRef Name="College_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
         <EntityContainer Name="ModeleMVCStoreContainer">
+          <EntitySet Name="Colleges" EntityType="Self.Colleges" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Identites" EntityType="Self.Identites" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Territoires" EntityType="Self.Territoires" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="TypesCollege" EntityType="Self.TypesCollege" Schema="dbo" store:Type="Tables" />
+          <AssociationSet Name="FK_Colleges_Territoires" Association="Self.FK_Colleges_Territoires">
+            <End Role="Territoires" EntitySet="Territoires" />
+            <End Role="Colleges" EntitySet="Colleges" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Colleges_TypesCollege" Association="Self.FK_Colleges_TypesCollege">
+            <End Role="TypesCollege" EntitySet="TypesCollege" />
+            <End Role="Colleges" EntitySet="Colleges" />
+          </AssociationSet>
+          <AssociationSet Name="FK_FicheIdentite_College" Association="Self.FK_FicheIdentite_College">
+            <End Role="Colleges" EntitySet="Colleges" />
+            <End Role="Identites" EntitySet="Identites" />
+          </AssociationSet>
         </EntityContainer>
       </Schema></edmx:StorageModels>
     <!-- CSDL content -->
     <edmx:ConceptualModels>
       <Schema Namespace="CD67.FicheCollege" 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">
         <EntityContainer Name="Entities" annotation:LazyLoadingEnabled="true">
-          <EntitySet Name="Territoires" EntityType="CD67.FicheCollege.Territoire" />
           <EntitySet Name="TypesCollege" EntityType="CD67.FicheCollege.TypeCollege" />
-        </EntityContainer>
+          <EntitySet Name="Territoires" EntityType="CD67.FicheCollege.Territoire" />
+          <EntitySet Name="Colleges" EntityType="CD67.FicheCollege.College" />
+          <AssociationSet Name="FK_Colleges_Territoires" Association="CD67.FicheCollege.FK_Colleges_Territoires">
+            <End Role="Territoire" EntitySet="Territoires" />
+            <End Role="College" EntitySet="Colleges" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Colleges_TypesCollege" Association="CD67.FicheCollege.FK_Colleges_TypesCollege">
+            <End Role="TypeCollege" EntitySet="TypesCollege" />
+            <End Role="College" EntitySet="Colleges" />
+          </AssociationSet>
+          <EntitySet Name="Identites" EntityType="CD67.FicheCollege.Identite" />
+          <AssociationSet Name="FK_FicheIdentite_College" Association="CD67.FicheCollege.FK_FicheIdentite_College">
+            <End Role="College" EntitySet="Colleges" />
+            <End Role="Identite" EntitySet="Identites" />
+          </AssociationSet>
+          </EntityContainer>
+        <EntityType Name="TypeCollege">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Libelle" Type="String" Nullable="false" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Ordre" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Colleges" Relationship="CD67.FicheCollege.FK_Colleges_TypesCollege" FromRole="TypeCollege" ToRole="College" />
+        </EntityType>
         <EntityType Name="Territoire">
           <Key>
             <PropertyRef Name="Id" />
           </Key>
-          <Property Name="Id" Type="Int32" Nullable="false" />
+          <Property Name="Id" Type="String" Nullable="false" MaxLength="10" FixedLength="false" Unicode="true" />
           <Property Name="Libelle" Type="String" Nullable="false" MaxLength="255" FixedLength="false" Unicode="true" />
           <Property Name="Referent_SID" Type="String" MaxLength="64" FixedLength="false" Unicode="true" />
           <Property Name="Referent_Nom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
           <Property Name="Referent_Prenom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
           <Property Name="Referent_Structure" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
           <Property Name="Referent_Login" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Referent_Email" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
           <Property Name="Ordre" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Colleges" Relationship="CD67.FicheCollege.FK_Colleges_Territoires" FromRole="Territoire" ToRole="College" />
         </EntityType>
-        <EntityType Name="TypeCollege">
+        <EntityType Name="College">
           <Key>
             <PropertyRef Name="Id" />
           </Key>
-          <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Id" Type="String" Nullable="false" MaxLength="8" FixedLength="false" Unicode="true" />
           <Property Name="Libelle" Type="String" Nullable="false" MaxLength="255" FixedLength="false" Unicode="true" />
-          <Property Name="Ordre" Type="Int32" Nullable="false" />
+          <Property Name="Adresse" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Code_Postal" Type="String" MaxLength="5" FixedLength="false" Unicode="true" />
+          <Property Name="TypeCollege_Id" Type="Int32" Nullable="false" />
+          <Property Name="Commune_Insee" Type="String" MaxLength="5" FixedLength="false" Unicode="true" />
+          <Property Name="Commune" Type="String" Nullable="false" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Canton" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Territoire_Id" Type="String" MaxLength="10" FixedLength="false" Unicode="true" />
+          <Property Name="TAD" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="CDC" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Tel" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Fax" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Email" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <NavigationProperty Name="Territoire" Relationship="CD67.FicheCollege.FK_Colleges_Territoires" FromRole="College" ToRole="Territoire" />
+          <NavigationProperty Name="TypeCollege" Relationship="CD67.FicheCollege.FK_Colleges_TypesCollege" FromRole="College" ToRole="TypeCollege" />
+          <NavigationProperty Name="Identite" Relationship="CD67.FicheCollege.FK_FicheIdentite_College" FromRole="College" ToRole="Identite" />
+        </EntityType>
+        <Association Name="FK_Colleges_Territoires">
+          <End Type="CD67.FicheCollege.Territoire" Role="Territoire" Multiplicity="0..1" />
+          <End Type="CD67.FicheCollege.College" Role="College" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Territoire">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="College">
+              <PropertyRef Name="Territoire_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Colleges_TypesCollege">
+          <End Type="CD67.FicheCollege.TypeCollege" Role="TypeCollege" Multiplicity="1" />
+          <End Type="CD67.FicheCollege.College" Role="College" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="TypeCollege">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="College">
+              <PropertyRef Name="TypeCollege_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <EntityType Name="Identite">
+          <Key>
+            <PropertyRef Name="College_Id" />
+          </Key>
+          <Property Name="College_Id" Type="String" Nullable="false" MaxLength="8" FixedLength="false" Unicode="true" />
+          <Property Name="Principal_SID" Type="String" MaxLength="64" FixedLength="false" Unicode="true" />
+          <Property Name="Principal_Login" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Principal_Nom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Principal_Prenom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Principal_Email" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Principal_Tel" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Principal_Structure" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Adjoint_SID" Type="String" MaxLength="64" FixedLength="false" Unicode="true" />
+          <Property Name="Adjoint_Login" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Adjoint_Nom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Adjoint_Prenom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Adjoint_Email" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Adjoint_Tel" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Adjoint_Structure" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire_SID" Type="String" MaxLength="64" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire_Login" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire_Nom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire_Prenom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire_Email" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire_Tel" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire_Structure" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire2_SID" Type="String" MaxLength="64" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire2_Login" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire2_Nom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire2_Prenom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire2_Email" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire2_Tel" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Gestionnaire2_Structure" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <NavigationProperty Name="College" Relationship="CD67.FicheCollege.FK_FicheIdentite_College" FromRole="Identite" ToRole="College" />
         </EntityType>
-      </Schema>
+        <Association Name="FK_FicheIdentite_College">
+          <End Type="CD67.FicheCollege.College" Role="College" Multiplicity="1" />
+          <End Type="CD67.FicheCollege.Identite" Role="Identite" Multiplicity="0..1" />
+          <ReferentialConstraint>
+            <Principal Role="College">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="Identite">
+              <PropertyRef Name="College_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        </Schema>
     </edmx:ConceptualModels>
     <!-- C-S mapping content -->
     <edmx:Mappings>
     <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
   <EntityContainerMapping StorageEntityContainer="ModeleMVCStoreContainer" CdmEntityContainer="Entities">
+          <EntitySetMapping Name="TypesCollege">
+            <EntityTypeMapping TypeName="CD67.FicheCollege.TypeCollege">
+              <MappingFragment StoreEntitySet="TypesCollege">
+                <ScalarProperty Name="Ordre" ColumnName="Ordre" />
+                <ScalarProperty Name="Libelle" ColumnName="Libelle" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
           <EntitySetMapping Name="Territoires">
             <EntityTypeMapping TypeName="CD67.FicheCollege.Territoire">
               <MappingFragment StoreEntitySet="Territoires">
                 <ScalarProperty Name="Ordre" ColumnName="Ordre" />
+                <ScalarProperty Name="Referent_Email" ColumnName="Referent_Email" />
                 <ScalarProperty Name="Referent_Login" ColumnName="Referent_Login" />
                 <ScalarProperty Name="Referent_Structure" ColumnName="Referent_Structure" />
                 <ScalarProperty Name="Referent_Prenom" ColumnName="Referent_Prenom" />
@@ -79,15 +303,61 @@
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
-          <EntitySetMapping Name="TypesCollege">
-            <EntityTypeMapping TypeName="CD67.FicheCollege.TypeCollege">
-              <MappingFragment StoreEntitySet="TypesCollege">
-                <ScalarProperty Name="Ordre" ColumnName="Ordre" />
+          <EntitySetMapping Name="Colleges">
+            <EntityTypeMapping TypeName="CD67.FicheCollege.College">
+              <MappingFragment StoreEntitySet="Colleges">
+                <ScalarProperty Name="Email" ColumnName="Email" />
+                <ScalarProperty Name="Fax" ColumnName="Fax" />
+                <ScalarProperty Name="Tel" ColumnName="Tel" />
+                <ScalarProperty Name="CDC" ColumnName="CDC" />
+                <ScalarProperty Name="TAD" ColumnName="TAD" />
+                <ScalarProperty Name="Territoire_Id" ColumnName="Territoire_Id" />
+                <ScalarProperty Name="Canton" ColumnName="Canton" />
+                <ScalarProperty Name="Commune" ColumnName="Commune" />
+                <ScalarProperty Name="Commune_Insee" ColumnName="Commune_Insee" />
+                <ScalarProperty Name="TypeCollege_Id" ColumnName="TypeCollege_Id" />
+                <ScalarProperty Name="Code_Postal" ColumnName="Code_Postal" />
+                <ScalarProperty Name="Adresse" ColumnName="Adresse" />
                 <ScalarProperty Name="Libelle" ColumnName="Libelle" />
                 <ScalarProperty Name="Id" ColumnName="Id" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
+          <EntitySetMapping Name="Identites">
+            <EntityTypeMapping TypeName="CD67.FicheCollege.Identite">
+              <MappingFragment StoreEntitySet="Identites">
+                <ScalarProperty Name="Gestionnaire2_Structure" ColumnName="Gestionnaire2_Structure" />
+                <ScalarProperty Name="Gestionnaire2_Tel" ColumnName="Gestionnaire2_Tel" />
+                <ScalarProperty Name="Gestionnaire2_Email" ColumnName="Gestionnaire2_Email" />
+                <ScalarProperty Name="Gestionnaire2_Prenom" ColumnName="Gestionnaire2_Prenom" />
+                <ScalarProperty Name="Gestionnaire2_Nom" ColumnName="Gestionnaire2_Nom" />
+                <ScalarProperty Name="Gestionnaire2_Login" ColumnName="Gestionnaire2_Login" />
+                <ScalarProperty Name="Gestionnaire2_SID" ColumnName="Gestionnaire2_SID" />
+                <ScalarProperty Name="Gestionnaire_Structure" ColumnName="Gestionnaire_Structure" />
+                <ScalarProperty Name="Gestionnaire_Tel" ColumnName="Gestionnaire_Tel" />
+                <ScalarProperty Name="Gestionnaire_Email" ColumnName="Gestionnaire_Email" />
+                <ScalarProperty Name="Gestionnaire_Prenom" ColumnName="Gestionnaire_Prenom" />
+                <ScalarProperty Name="Gestionnaire_Nom" ColumnName="Gestionnaire_Nom" />
+                <ScalarProperty Name="Gestionnaire_Login" ColumnName="Gestionnaire_Login" />
+                <ScalarProperty Name="Gestionnaire_SID" ColumnName="Gestionnaire_SID" />
+                <ScalarProperty Name="Adjoint_Structure" ColumnName="Adjoint_Structure" />
+                <ScalarProperty Name="Adjoint_Tel" ColumnName="Adjoint_Tel" />
+                <ScalarProperty Name="Adjoint_Email" ColumnName="Adjoint_Email" />
+                <ScalarProperty Name="Adjoint_Prenom" ColumnName="Adjoint_Prenom" />
+                <ScalarProperty Name="Adjoint_Nom" ColumnName="Adjoint_Nom" />
+                <ScalarProperty Name="Adjoint_Login" ColumnName="Adjoint_Login" />
+                <ScalarProperty Name="Adjoint_SID" ColumnName="Adjoint_SID" />
+                <ScalarProperty Name="Principal_Structure" ColumnName="Principal_Structure" />
+                <ScalarProperty Name="Principal_Tel" ColumnName="Principal_Tel" />
+                <ScalarProperty Name="Principal_Email" ColumnName="Principal_Email" />
+                <ScalarProperty Name="Principal_Prenom" ColumnName="Principal_Prenom" />
+                <ScalarProperty Name="Principal_Nom" ColumnName="Principal_Nom" />
+                <ScalarProperty Name="Principal_Login" ColumnName="Principal_Login" />
+                <ScalarProperty Name="Principal_SID" ColumnName="Principal_SID" />
+                <ScalarProperty Name="College_Id" ColumnName="College_Id" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
         </EntityContainerMapping>
 </Mapping></edmx:Mappings>
   </edmx:Runtime>

+ 8 - 3
CD67.FicheCollege.Entity/EntityModel.edmx.diagram

@@ -5,9 +5,14 @@
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
       <Diagram DiagramId="86b727c7572a49c5b7e8139c8d489465" Name="Diagram1">
-        <EntityTypeShape EntityType="CD67.FicheCollege.Territoire" Width="1.5" PointX="0.75" PointY="0.75" />
-        <EntityTypeShape EntityType="CD67.FicheCollege.TypeCollege" Width="1.5" PointX="2.75" PointY="0.75" />
-      </Diagram>
+        <EntityTypeShape EntityType="CD67.FicheCollege.TypeCollege" Width="1.5" PointX="0.75" PointY="0.75" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.Territoire" Width="1.5" PointX="0.75" PointY="2.75" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.College" Width="1.5" PointX="3" PointY="1.125" />
+        <AssociationConnector Association="CD67.FicheCollege.FK_Colleges_Territoires" />
+        <AssociationConnector Association="CD67.FicheCollege.FK_Colleges_TypesCollege" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.Identite" Width="1.875" PointX="5.125" PointY="1.125" />
+        <AssociationConnector Association="CD67.FicheCollege.FK_FicheIdentite_College" />
+        </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>
 </edmx:Edmx>

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

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CD67.FicheCollege.Entity
+{
+    /// <summary>
+    /// Classe d'extension de celle d'Entity, nécessaire pour y associer les Metadata
+    /// </summary>
+    [MetadataType(typeof(College_Metadata))]
+    public partial class College
+    {
+        public string AdresseComplete => $"{this.Adresse}\n{this.Code_Postal} {this.Commune}";
+    }
+
+    /// <summary>
+    /// Classe contenant les DataAnnotations pour chaque champ
+    /// </summary>
+    public class College_Metadata
+    {
+        [Required]
+        [Display(Name = "Code RNE du collège")]
+        public string Id { get; set; }
+        [Required]
+        [Display(Name = "Collège")]
+        public string Libelle { get; set; }
+        [Display(Name = "Code postal")]
+        public string Code_Postal { get; set; }
+        [Display(Name = "Type d'établissement")]
+        public int TypeCollege_Id { get; set; }
+        [Display(Name = "Territoire de rattachement")]
+        public string Territoire_Id { get; set; }
+        [Display(Name = "Canton de rattachement")]
+        public string Canton { get; set; }
+
+    }
+}

+ 3 - 1
CD67.FicheCollege.Entity/Extend/Territoire.cs

@@ -22,7 +22,7 @@ namespace CD67.FicheCollege.Entity
     public class Territoire_Metadata
     {
         [Required(ErrorMessage = "Obligatoire")]
-        public int Id { get; set; }
+        public string Id { get; set; }
         [Required(ErrorMessage = "Obligatoire")]
         [Display(Name = "Territoire")]
         public string Libelle { get; set; }
@@ -36,6 +36,8 @@ namespace CD67.FicheCollege.Entity
         public string Referent_Structure { get; set; }
         [Display(Name = "Login du référent")]
         public string Referent_Login { get; set; }
+        [Display(Name = "Email du référent")]
+        public string Referent_Email { get; set; }
         public int Ordre { get; set; }
 
         [Display(Name = "Référent")]

+ 49 - 0
CD67.FicheCollege.Entity/Identite.cs

@@ -0,0 +1,49 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Ce code a été généré à partir d'un modèle.
+//
+//     Des modifications manuelles apportées à ce fichier peuvent conduire à un comportement inattendu de votre application.
+//     Les modifications manuelles apportées à ce fichier sont remplacées si le code est régénéré.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace CD67.FicheCollege.Entity
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Identite
+    {
+        public string College_Id { get; set; }
+        public string Principal_SID { get; set; }
+        public string Principal_Login { get; set; }
+        public string Principal_Nom { get; set; }
+        public string Principal_Prenom { get; set; }
+        public string Principal_Email { get; set; }
+        public string Principal_Tel { get; set; }
+        public string Principal_Structure { get; set; }
+        public string Adjoint_SID { get; set; }
+        public string Adjoint_Login { get; set; }
+        public string Adjoint_Nom { get; set; }
+        public string Adjoint_Prenom { get; set; }
+        public string Adjoint_Email { get; set; }
+        public string Adjoint_Tel { get; set; }
+        public string Adjoint_Structure { get; set; }
+        public string Gestionnaire_SID { get; set; }
+        public string Gestionnaire_Login { get; set; }
+        public string Gestionnaire_Nom { get; set; }
+        public string Gestionnaire_Prenom { get; set; }
+        public string Gestionnaire_Email { get; set; }
+        public string Gestionnaire_Tel { get; set; }
+        public string Gestionnaire_Structure { get; set; }
+        public string Gestionnaire2_SID { get; set; }
+        public string Gestionnaire2_Login { get; set; }
+        public string Gestionnaire2_Nom { get; set; }
+        public string Gestionnaire2_Prenom { get; set; }
+        public string Gestionnaire2_Email { get; set; }
+        public string Gestionnaire2_Tel { get; set; }
+        public string Gestionnaire2_Structure { get; set; }
+    
+        public virtual College College { get; set; }
+    }
+}

+ 11 - 1
CD67.FicheCollege.Entity/Territoire.cs

@@ -14,13 +14,23 @@ namespace CD67.FicheCollege.Entity
     
     public partial class Territoire
     {
-        public int Id { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Territoire()
+        {
+            this.Colleges = new HashSet<College>();
+        }
+    
+        public string Id { get; set; }
         public string Libelle { get; set; }
         public string Referent_SID { get; set; }
         public string Referent_Nom { get; set; }
         public string Referent_Prenom { get; set; }
         public string Referent_Structure { get; set; }
         public string Referent_Login { get; set; }
+        public string Referent_Email { get; set; }
         public int Ordre { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<College> Colleges { get; set; }
     }
 }

+ 9 - 0
CD67.FicheCollege.Entity/TypeCollege.cs

@@ -14,8 +14,17 @@ namespace CD67.FicheCollege.Entity
     
     public partial class TypeCollege
     {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public TypeCollege()
+        {
+            this.Colleges = new HashSet<College>();
+        }
+    
         public int Id { get; set; }
         public string Libelle { get; set; }
         public int Ordre { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<College> Colleges { get; set; }
     }
 }

+ 8 - 0
CD67.FicheCollege.Factory/CD67.FicheCollege.Factory.csproj

@@ -54,12 +54,20 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="CollegeFactory.cs" />
+    <Compile Include="IdentiteFactory.cs" />
+    <Compile Include="Internal\CollegeFactory.cs">
+      <DependentUpon>GenericFactories.tt</DependentUpon>
+    </Compile>
     <Compile Include="Internal\GenericFactories.cs">
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
       <DependentUpon>GenericFactories.tt</DependentUpon>
     </Compile>
     <Compile Include="Internal\BaseFactory.cs" />
+    <Compile Include="Internal\IdentiteFactory.cs">
+      <DependentUpon>GenericFactories.tt</DependentUpon>
+    </Compile>
     <Compile Include="Internal\TerritoireFactory.cs">
       <DependentUpon>GenericFactories.tt</DependentUpon>
     </Compile>

+ 27 - 0
CD67.FicheCollege.Factory/CollegeFactory.cs

@@ -0,0 +1,27 @@
+using CD67.FicheCollege.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Data.Entity;
+
+namespace CD67.FicheCollege.Factory
+{
+    public partial class CollegeFactory : Internal.BaseFactory<Entity.College>
+    {
+        public override void delete(ref College entity)
+        {
+            //Suppression en cascade
+            //Identité
+            IdentiteFactory identiteFactory = new IdentiteFactory(dbContext);
+            if (entity.Identite == null) dbContext.Entry(entity).Reference(i => i.Identite).Load();
+            if (entity.Identite != null)
+            {
+                Entity.Identite identite = entity.Identite;
+                identiteFactory.delete(ref identite);
+            }
+
+            base.delete(ref entity);
+        }
+    }
+}

+ 29 - 0
CD67.FicheCollege.Factory/IdentiteFactory.cs

@@ -0,0 +1,29 @@
+using CD67.FicheCollege.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Data.Entity;
+
+namespace CD67.FicheCollege.Factory
+{
+    public partial class IdentiteFactory : Internal.BaseFactory<Entity.Identite>
+    {
+        public override Identite getById(params object[] keyValues)
+        {
+            //si l'élément n'existe pas, on le créé
+            Entity.Identite identite = base.getById(keyValues);
+            if(identite ==null)
+            {
+                string id = keyValues[0].ToString();
+                identite = new Identite()
+                {
+                    College_Id = id
+                };
+                this.add(ref identite);
+            }
+
+            return identite;
+        }
+    }
+}

+ 21 - 0
CD67.FicheCollege.Factory/Internal/CollegeFactory.cs

@@ -0,0 +1,21 @@
+using CD67.FicheCollege.Entity;
+using System.Linq;
+
+namespace CD67.FicheCollege.Factory
+{
+	/// <summary>
+    /// NE PAS MODIFIER
+    /// C'est une classe partielle, elle peut être complétée avec une classe partielle du même nom
+    /// Factory générée automatiquement à l'aide du fichier GenericFactories.tt
+    /// pour toutes les entités du fichier entity : /CD67.FicheCollege.Entity/EntityModel.edmx
+    /// </summary>
+	public partial class CollegeFactory : Internal.BaseFactory<Entity.College>
+	{
+		/// <summary>
+        /// Constructeur public lié au constructeur de base
+        /// </summary>
+        /// <param name="dbContext">Context Entity Framework utilisé dans la classe</param>
+		public CollegeFactory(Entities dbContext) : base(dbContext) { }
+	}
+}
+	

+ 21 - 0
CD67.FicheCollege.Factory/Internal/IdentiteFactory.cs

@@ -0,0 +1,21 @@
+using CD67.FicheCollege.Entity;
+using System.Linq;
+
+namespace CD67.FicheCollege.Factory
+{
+	/// <summary>
+    /// NE PAS MODIFIER
+    /// C'est une classe partielle, elle peut être complétée avec une classe partielle du même nom
+    /// Factory générée automatiquement à l'aide du fichier GenericFactories.tt
+    /// pour toutes les entités du fichier entity : /CD67.FicheCollege.Entity/EntityModel.edmx
+    /// </summary>
+	public partial class IdentiteFactory : Internal.BaseFactory<Entity.Identite>
+	{
+		/// <summary>
+        /// Constructeur public lié au constructeur de base
+        /// </summary>
+        /// <param name="dbContext">Context Entity Framework utilisé dans la classe</param>
+		public IdentiteFactory(Entities dbContext) : base(dbContext) { }
+	}
+}
+	

+ 2 - 2
CD67.FicheCollege.MVC/App_Start/BundleConfig.cs

@@ -25,8 +25,8 @@ namespace CD67.FicheCollege.MVC
                       "~/Content/bootstrap.min.css",
                       "~/Content/font-awesome.css",
                       "~/Content/jquery.validate.css",
-                      "~/Content/cd67-model.css",
-                      "~/Content/cd67-custom.css"));
+                      "~/Content/cd67-model.less",
+                      "~/Content/cd67-custom.less"));
 
             // Jquery-ui
             bundles.Add(new ScriptBundle("~/bundles/jquery-ui").Include(

+ 26 - 2
CD67.FicheCollege.MVC/CD67.FicheCollege.MVC.csproj

@@ -45,6 +45,10 @@
       <HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
       <Private>True</Private>
     </Reference>
+    <Reference Include="dotless.Core, Version=1.5.2.0, Culture=neutral, PublicKeyToken=96b446c9e63eae34, processorArchitecture=MSIL">
+      <HintPath>..\packages\dotless.1.5.2\lib\dotless.Core.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
       <Private>True</Private>
@@ -153,18 +157,29 @@
   <ItemGroup>
     <Compile Include="App_Start\BundleConfig.cs" />
     <Compile Include="Controllers\AdminController.cs" />
+    <Compile Include="Controllers\CollegesController.cs" />
     <Compile Include="Controllers\HomeController.cs" />
+    <Compile Include="Controllers\IdentitesController.cs" />
     <Compile Include="Controllers\TerritoireController.cs" />
     <Compile Include="Controllers\TypeCollegeController.cs" />
     <Compile Include="Global.asax.cs">
       <DependentUpon>Global.asax</DependentUpon>
     </Compile>
+    <Compile Include="Internal\Referentiel.cs" />
     <Compile Include="Internal\FlashMessageExtensions.cs" />
     <Compile Include="Internal\MvcHtmlHelpers.cs" />
     <Compile Include="Internal\Navigation.cs" />
     <Compile Include="Internal\UtilisateurConnecteFactory.cs" />
+    <Compile Include="Models\CollegeViewModel.cs" />
+    <Compile Include="Models\ContactViewModel.cs" />
+    <Compile Include="Models\ModeAcces.cs" />
     <Compile Include="Models\UtilisateurConnecte.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+      <DependentUpon>Settings.settings</DependentUpon>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="App_Start\FilterConfig.cs" />
@@ -174,8 +189,6 @@
     <Content Include="Content\bootstrap-theme.min.css" />
     <Content Include="Content\bootstrap.css" />
     <Content Include="Content\bootstrap.min.css" />
-    <Content Include="Content\cd67-custom.css" />
-    <Content Include="Content\cd67-model.css" />
     <Content Include="Content\colorbox\colorbox.css" />
     <Content Include="Content\colorbox\images\border.png" />
     <Content Include="Content\colorbox\images\controls.png" />
@@ -245,6 +258,12 @@
     <Content Include="Scripts\cd67-AutoComplete.js" />
     <Content Include="Scripts\cd67-colorbox.js" />
     <Content Include="Scripts\cd67-Menu.js" />
+    <Content Include="Content\cd67-custom.less" />
+    <Content Include="Content\cd67-model.less" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
     <None Include="Scripts\jquery-3.2.1.intellisense.js" />
     <Content Include="Scripts\cd67-picker.js" />
     <Content Include="Scripts\colorbox\i18n\jquery.colorbox-ar.js" />
@@ -363,6 +382,11 @@
     <Content Include="Views\Territoire\Delete.cshtml" />
     <Content Include="Views\Territoire\Edit.cshtml" />
     <Content Include="Views\Territoire\Index.cshtml" />
+    <Content Include="Views\Colleges\Details.cshtml" />
+    <Content Include="Views\Colleges\Edit.cshtml" />
+    <Content Include="Views\Colleges\Index.cshtml" />
+    <Content Include="Views\Identites\Details.cshtml" />
+    <Content Include="Views\Identites\Edit.cshtml" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="App_Data\" />

+ 0 - 40
CD67.FicheCollege.MVC/Content/cd67-custom.css

@@ -1,40 +0,0 @@
-/* Breadcrumb et mise en avant */
-.color1 {
-    color: #DA1251;
-}
-
-#breadcrumbs-one a {
-    color: black;
-}
-
-/* Fond de la sidebar */
-.color2 {
-    color: #5a5555;
-}
-
-#wrapper.toggled-2 #sidebar-wrapper {
-    background-color: #5a5555;
-}
-
-.background-color2 {
-    background-color: #5a5555;
-}
-
-#a-li-menu-l2-active {
-    border-bottom-color: #5a5555;
-}
-
-textarea:not(:empty):not(:placeholder-shown):not(:focus)[aria-invalid='true'],input:not([value=""]):not(:placeholder-shown):not(:focus)[aria-invalid='true']{
-    background-color: rgba(255, 0, 0, 0.5) /*rgba(218, 18, 81, O.5)*/}
-
-input[aria-required='true'], textarea[aria-required='true'] {
-     border-color:#f00
-}
-
-.pagination {
-     background: #eee;
-    padding: 10px;
-    width: 100%;
-    text-align:center;
-    margin:0;
-}

+ 87 - 0
CD67.FicheCollege.MVC/Content/cd67-custom.less

@@ -0,0 +1,87 @@
+@focus-color : cadetblue;
+
+/* Breadcrumb et mise en avant */
+.color1 {
+    color: @focus-color;
+}
+
+.menu_principal a, .menu_principal div {
+    background-color: @focus-color;
+}
+
+.submenu a{
+    background-color: #fff;
+    color: @focus-color;
+}
+
+.menu-button{
+    background: @focus-color;
+    border-color: @focus-color;
+}
+
+.input-group-addon{
+    background-color: @focus-color;
+    border-color: @focus-color;
+}
+
+.menu_principal a:hover, .menu_principal div:hover {
+    background-color: darken(@focus-color, 25%);
+}
+
+legend {
+    height: 40px !important;
+    border-color: @focus-color;
+}
+
+#breadcrumbs-one a {
+    color: black;
+}
+
+/* Fond de la sidebar */
+.color2 {
+    color: #5a5555;
+}
+
+#wrapper.toggled-2 #sidebar-wrapper {
+    background-color: #5a5555;
+}
+
+.background-color2 {
+    background-color: #5a5555;
+}
+
+#a-li-menu-l2-active {
+    border-bottom-color: #5a5555;
+}
+
+textarea:not(:empty):not(:placeholder-shown):not(:focus)[aria-invalid='true'],input:not([value=""]):not(:placeholder-shown):not(:focus)[aria-invalid='true']{
+    background-color: rgba(255, 0, 0, 0.5) /*rgba(218, 18, 81, O.5)*/}
+
+input[aria-required='true'], textarea[aria-required='true'] {
+     border-color:#f00
+}
+
+.pagination {
+     background: #eee;
+    padding: 10px;
+    width: 100%;
+    text-align:center;
+    margin:0;
+}
+
+.flex-list {
+    display: flex;
+    flex-direction: row;
+    flex-wrap: wrap;
+    justify-content: space-around;
+}
+
+.flex-col {
+    display: flex;
+    flex-direction: column;
+}
+
+.disabled-input-as-label {
+    border: 0px;
+    background: none;
+}

+ 69 - 97
CD67.FicheCollege.MVC/Content/cd67-model.css → CD67.FicheCollege.MVC/Content/cd67-model.less

@@ -86,33 +86,36 @@ label[for=recherche]{
     margin: 0;
     padding: 110px 40px 40px;
     background-color: #fff; 
-}
-.menu_principal li{
-    list-style: none;
-}
-.menu_principal a, .menu_principal div{
-    background-color: #DA1251;
-    color:#fff;
-    -webkit-transition: all 0.3s ease 0s;
-    -moz-transition: all 0.3s ease 0s;
-    -o-transition: all 0.3s ease 0s;
-    -ms-transition: all 0.3s ease 0s;
-    transition: all 0.3s ease 0s;
-    font-size: 24px;
-    line-height: 24px;
-    border-bottom: 1px solid #fff;
-    display: block;
-    
-}
-.submenu a{
-    padding:15px 47px;
+
+    li{
+        list-style: none;
+    }
+
+    a, div{
+        color:#fff;
+        -webkit-transition: all 0.3s ease 0s;
+        -moz-transition: all 0.3s ease 0s;
+        -o-transition: all 0.3s ease 0s;
+        -ms-transition: all 0.3s ease 0s;
+        transition: all 0.3s ease 0s;
+        font-size: 24px;
+        line-height: 24px;
+        border-bottom: 1px solid #fff;
+        display: block;
+    }
+
+    a:hover, div:hover{
+        background-color: #237C4E;
+        cursor:pointer;
+        color:white;
+    }
 }
 
 .submenu a{
+    padding:15px 47px;
     background-color: #fff;
-    color:#DA1251
-
 }
+
 .submenu li:first-child{
     font-weight:bolder;
 }
@@ -121,14 +124,7 @@ label[for=recherche]{
    margin-left:30px;
 }
 
-.menu_principal a:hover, .menu_principal div:hover{
-    background-color: #237C4E;
-    cursor:pointer;
-    color:white;
-}
-
 .menu-button{
-    background: #DA1251;
     border: medium none;
     color: transparent;
     height: 50px;
@@ -203,7 +199,6 @@ label[for=recherche]{
     transform: rotate3d(0, 0, 1, -45deg);
 }
 
-
 .navbar-login-session {
     padding: 10px;
     padding-bottom: 0px;
@@ -230,8 +225,6 @@ label[for=recherche]{
     margin-top: -1px;
 }
 
-
-
 .navigation {
     transition: width 0.3s ease;
 }
@@ -281,28 +274,26 @@ label[for=recherche]{
     margin-top: -12px;
 }
 
-
 h1 {
     margin-right: 0;
     margin-top: 5px;
     font-size: 30px;
     padding-bottom: 5px;
-    border-bottom: solid 1px #DA1251;
 }
 
-.navbar-inner ul li {
-    float: left;
-    display: block;
+.navbar-inner{
+    ul li {
+        float: left;
+        display: block;
+    }
 }
 
 #topbar {
     text-align: center;
-    
 }
 
 #titre {
     display: inline-block;
-
 }
 
 .row {
@@ -317,14 +308,24 @@ h1 {
     list-style: none;
     margin-top: 9px;
     white-space:nowrap;
-}
 
-    
+    li a {
+        display: block;
+        text-decoration: none;
+    }     
 
-.sidebar-nav li a {
-    display: block;
-    text-decoration: none;
-          
+    > .sidebar-brand {
+        height: 65px;
+        font-size: 18px;
+        line-height: 60px;
+    }
+    > .sidebar-brand a {
+        color: #999999;
+    }
+     > .sidebar-brand a:hover {
+        color: #fff;
+        background: none;
+    }
 }
 
 .active_tab {
@@ -346,9 +347,6 @@ h1 {
     padding-top: 34px;
 }
 
-
-
-
 .brand{
     padding-left:70px;
     padding-bottom : 8px;
@@ -359,26 +357,6 @@ h1 {
     padding-top:24px
 }
 
-/*p {
-    text-align: center;
-    margin-top: 20px;
-}*/
-
-.sidebar-nav > .sidebar-brand {
-    height: 65px;
-    font-size: 18px;
-    line-height: 60px;
-}
-
-.sidebar-nav > .sidebar-brand a {
-    color: #999999;
-}
-
-.sidebar-nav > .sidebar-brand a:hover {
-    color: #fff;
-    background: none;
-}
-
 .no-margin {
     margin: 0;
 }
@@ -406,9 +384,6 @@ h1 {
     width: auto;
 }
 
-
-
-
 #page-content-wrapper {
     padding: 10px;
     position: relative;
@@ -450,28 +425,31 @@ ul {
     overflow: hidden;
     width: 100%;
     margin-bottom: 15px;
-}
 
-#breadcrumbs-one li {
-    float: left;
-}
+    li {
+        float: left;
+    }
 
-#breadcrumbs-one a {
-    padding: .7em 0.5em .7em 0.5em;
-    float: left;
-    color: #444;
-    position: relative;
-}
+    a {
+        padding: .7em 0.5em .7em 0.5em;
+        float: left;
+        color: #444;
+        position: relative;
+    }
 
-#breadcrumbs-one li:first-child a {
-    padding-left: 1em;
-    border-radius: 5px 0 0 5px;
-}
- 
-#breadcrumbs-one a::before {
-    border-left-color: #eeeeee;
-    right: -1.1em;
-    z-index: 1;
+    li:first-child a {
+        border-radius: 5px 0 0 5px;
+        padding: .7em 0.5em .7em 1em;
+        float: left;
+        color: #444;
+        position: relative;
+    }
+
+    a::before {
+        border-left-color: #eeeeee;
+        right: -1.1em;
+        z-index: 1;
+    }
 }
 
 .link:hover  {
@@ -590,12 +568,6 @@ ul {
     margin : 0;
 }
 
-
-.input-group-addon{
-    background-color: #DA1251;
-    border-color:#DA1251;
-}
-
 .input-group{
     padding : 0px 10px;
-}
+}

+ 158 - 0
CD67.FicheCollege.MVC/Controllers/CollegesController.cs

@@ -0,0 +1,158 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Linq;
+using System.Net;
+using System.Web;
+using System.Web.Mvc;
+using CD67.FicheCollege.Entity;
+using CD67.FicheCollege.Factory;
+
+namespace CD67.FicheCollege.MVC.Controllers
+{
+    public class CollegesController : Controller
+    {
+        private Entities db = new Entities();
+
+        // GET: College
+        public ActionResult Index()
+        {
+            CollegeFactory collegeFactory = new CollegeFactory(db);
+            return View(collegeFactory.getAll());
+        }
+
+        // GET: College/Details/5
+        public ActionResult Details(string id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            CollegeFactory collegeFactory = new CollegeFactory(db);
+            Entity.College college = collegeFactory.getById(id);
+            if (college == null)
+            {
+                return HttpNotFound();
+            }
+            return View(GetViewModel(college, Models.ModeAcces.Lecture));
+        }
+
+        // GET: College/Create
+        public ActionResult Create()
+        {
+            Entity.College college = new Entity.College();
+            return View("Edit", GetViewModel(college, Models.ModeAcces.Creation));
+        }
+
+        // POST: College/Create
+        // Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour 
+        // plus de détails, voir  http://go.microsoft.com/fwlink/?LinkId=317598.
+        [HttpPost]
+        [ValidateAntiForgeryToken]
+        public ActionResult Create(Entity.College Contenu)
+        {
+            if (ModelState.IsValid)
+            {
+                CollegeFactory collegeFactory = new CollegeFactory(db);
+                collegeFactory.add(ref Contenu);
+                return RedirectToAction("Index");
+            }
+
+            return View("Edit", GetViewModel(Contenu, Models.ModeAcces.Creation));
+        }
+
+        // GET: College/Edit/5
+        public ActionResult Edit(string id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            CollegeFactory collegeFactory = new CollegeFactory(db);
+            Entity.College college = collegeFactory.getById(id);
+            if (college == null)
+            {
+                return HttpNotFound();
+            }
+            return View(GetViewModel(college, Models.ModeAcces.Modification));
+        }
+
+        // POST: College/Edit/5
+        // Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour 
+        // plus de détails, voir  http://go.microsoft.com/fwlink/?LinkId=317598.
+        [HttpPost]
+        [ValidateAntiForgeryToken]
+        public ActionResult Edit(Entity.College Contenu)
+        {
+            if (ModelState.IsValid)
+            {
+                CollegeFactory collegeFactory = new CollegeFactory(db);
+                collegeFactory.update(ref Contenu);
+                return RedirectToAction("Details", new { Id = Contenu.Id });
+            }
+            return View(GetViewModel(Contenu, Models.ModeAcces.Modification));
+        }
+
+        // GET: College/Delete/5
+        public ActionResult Delete(string id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            CollegeFactory collegeFactory = new CollegeFactory(db);
+            Entity.College college = collegeFactory.getById(id);
+            if (college == null)
+            {
+                return HttpNotFound();
+            }
+            return View("Details", GetViewModel(college, Models.ModeAcces.Suppression));
+        }
+
+        // POST: College/Delete/5
+        [HttpPost, ActionName("Delete")]
+        [ValidateAntiForgeryToken]
+        public ActionResult DeleteConfirmed(string id)
+        {
+            CollegeFactory collegeFactory = new CollegeFactory(db);
+            Entity.College college = collegeFactory.getById(id);
+            collegeFactory.delete(ref college);
+            return RedirectToAction("Index");
+        }
+
+        private Models.CollegeViewModel GetViewModel(Entity.College entity, Models.ModeAcces Acces)
+        {
+            Dictionary<string, SelectList> listes = new Dictionary<string, SelectList>();
+
+            //On prépare les listes de choix en création ou modification
+            if (Acces == Models.ModeAcces.Creation || Acces == Models.ModeAcces.Modification)
+            {
+                TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+                SelectList listeTypeCollege = new SelectList(typeCollegeFactory.getAll("Ordre"), "Id", "Libelle", entity.TypeCollege_Id);
+                listes.Add("TypeCollege_Id", listeTypeCollege);
+
+                SelectList listeCodesPostaux = new SelectList(Internal.Referentiel.GetCodesPostaux(entity.Commune_Insee), entity.Code_Postal);
+                listes.Add("Code_Postal", listeCodesPostaux);
+            }
+
+            return new Models.CollegeViewModel()
+            {
+                College_Id = entity.Id,
+                College_Libelle = entity.Libelle,
+                Contenu = entity,
+                Acces = Acces,
+                Listes = listes
+            };
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                db.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+    }
+}

+ 99 - 0
CD67.FicheCollege.MVC/Controllers/IdentitesController.cs

@@ -0,0 +1,99 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Linq;
+using System.Net;
+using System.Web;
+using System.Web.Mvc;
+using CD67.FicheCollege.Entity;
+using CD67.FicheCollege.Factory;
+
+namespace CD67.FicheCollege.MVC.Controllers
+{
+    public class IdentitesController : Controller
+    {
+        private Entities db = new Entities();
+
+        // GET: Identite/Details/5
+        public ActionResult Details(string id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            IdentiteFactory identiteFactory = new IdentiteFactory(db);
+            Entity.Identite identite = identiteFactory.getById(id);
+            if (identite == null)
+            {
+                return HttpNotFound();
+            }
+            return View(GetViewModel(identite, Models.ModeAcces.Lecture));
+        }
+
+        // GET: Identite/Edit/5
+        public ActionResult Edit(string id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            IdentiteFactory identiteFactory = new IdentiteFactory(db);
+            Entity.Identite identite = identiteFactory.getById(id);
+            if (identite == null)
+            {
+                return HttpNotFound();
+            }
+            return View(GetViewModel(identite, Models.ModeAcces.Modification));
+        }
+
+        // POST: Identite/Edit/5
+        // Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour 
+        // plus de détails, voir  http://go.microsoft.com/fwlink/?LinkId=317598.
+        [HttpPost]
+        [ValidateAntiForgeryToken]
+        public ActionResult Edit(Entity.Identite Contenu)
+        {
+            if (ModelState.IsValid)
+            {
+                IdentiteFactory identiteFactory = new IdentiteFactory(db);
+                identiteFactory.update(ref Contenu);
+                return RedirectToAction("Details", new { Id = Contenu.College_Id });
+            }
+            return View(GetViewModel(Contenu, Models.ModeAcces.Modification));
+        }
+
+        private Models.CollegeViewModel GetViewModel(Entity.Identite entity, Models.ModeAcces Acces)
+        {
+            object contenu;
+            if (Acces == Models.ModeAcces.Lecture)
+            {
+                List<Models.ContactViewModel> listeContacts = new List<Models.ContactViewModel>();
+                if (entity.Principal_SID != null) listeContacts.Add(new Models.ContactViewModel("Principal", entity.Principal_SID, entity.Principal_Login, entity.Principal_Nom, entity.Principal_Prenom, entity.Principal_Email, entity.Principal_Tel, entity.Principal_Structure));
+                if (entity.Adjoint_SID != null) listeContacts.Add(new Models.ContactViewModel("Principal adjoint", entity.Adjoint_SID, entity.Adjoint_Login, entity.Adjoint_Nom, entity.Adjoint_Prenom, entity.Adjoint_Email, entity.Adjoint_Tel, entity.Adjoint_Structure));
+                if (entity.Gestionnaire_SID != null) listeContacts.Add(new Models.ContactViewModel("Gestionnaire", entity.Gestionnaire_SID, entity.Gestionnaire_Login, entity.Gestionnaire_Nom, entity.Gestionnaire_Prenom, entity.Gestionnaire_Email, entity.Gestionnaire_Tel, entity.Gestionnaire_Structure));
+                if (entity.Gestionnaire2_SID != null) listeContacts.Add(new Models.ContactViewModel("Gestionnaire n°2", entity.Gestionnaire2_SID, entity.Gestionnaire2_Login, entity.Gestionnaire2_Nom, entity.Gestionnaire2_Prenom, entity.Gestionnaire2_Email, entity.Gestionnaire2_Tel, entity.Gestionnaire2_Structure));
+                contenu = listeContacts;
+            }
+            else contenu = entity;
+
+            return new Models.CollegeViewModel()
+            {
+                College_Id = entity.College.Id,
+                College_Libelle = entity.College.Libelle,
+                Contenu = contenu,
+                Acces = Acces,
+                Listes = null
+            };
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                db.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+    }
+}

+ 9 - 25
CD67.FicheCollege.MVC/Controllers/TerritoireController.cs

@@ -22,22 +22,6 @@ namespace CD67.FicheCollege.MVC.Controllers
             return View(territoireFactory.getAll());
         }
 
-        // GET: Territoire/Details/5
-        public ActionResult Details(int? id)
-        {
-            if (id == null)
-            {
-                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
-            }
-            TerritoireFactory territoireFactory = new TerritoireFactory(db);
-            Entity.Territoire territoire = territoireFactory.getById(id.Value);
-            if (territoire == null)
-            {
-                return HttpNotFound();
-            }
-            return View(territoire);
-        }
-
         // GET: Territoire/Create
         public ActionResult Create()
         {
@@ -63,14 +47,14 @@ namespace CD67.FicheCollege.MVC.Controllers
         }
 
         // GET: Territoire/Edit/5
-        public ActionResult Edit(int? id)
+        public ActionResult Edit(string id)
         {
             if (id == null)
             {
                 return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
             }
             TerritoireFactory territoireFactory = new TerritoireFactory(db);
-            Entity.Territoire territoire = territoireFactory.getById(id.Value);
+            Entity.Territoire territoire = territoireFactory.getById(id);
             if (territoire == null)
             {
                 return HttpNotFound();
@@ -95,14 +79,14 @@ namespace CD67.FicheCollege.MVC.Controllers
         }
 
         // GET: Territoire/Delete/5
-        public ActionResult Delete(int? id)
+        public ActionResult Delete(string id)
         {
             if (id == null)
             {
                 return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
             }
             TerritoireFactory territoireFactory = new TerritoireFactory(db);
-            Entity.Territoire territoire = territoireFactory.getById(id.Value);
+            Entity.Territoire territoire = territoireFactory.getById(id);
             if (territoire == null)
             {
                 return HttpNotFound();
@@ -113,7 +97,7 @@ namespace CD67.FicheCollege.MVC.Controllers
         // POST: Territoire/Delete/5
         [HttpPost, ActionName("Delete")]
         [ValidateAntiForgeryToken]
-        public ActionResult DeleteConfirmed(int id)
+        public ActionResult DeleteConfirmed(string id)
         {
             TerritoireFactory territoireFactory = new TerritoireFactory(db);
             Entity.Territoire territoire = territoireFactory.getById(id);
@@ -121,26 +105,26 @@ namespace CD67.FicheCollege.MVC.Controllers
             return RedirectToAction("Index");
         }
 
-        public ActionResult Up(int? id)
+        public ActionResult Up(string id)
         {
             if (id == null)
             {
                 return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
             }
             TerritoireFactory territoireFactory = new TerritoireFactory(db);
-            Entity.Territoire territoire = territoireFactory.getById(id.Value);
+            Entity.Territoire territoire = territoireFactory.getById(id);
             territoireFactory.Up(ref territoire);
             return RedirectToAction("Index");
         }
 
-        public ActionResult Down(int? id)
+        public ActionResult Down(string id)
         {
             if (id == null)
             {
                 return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
             }
             TerritoireFactory territoireFactory = new TerritoireFactory(db);
-            Entity.Territoire territoire = territoireFactory.getById(id.Value);
+            Entity.Territoire territoire = territoireFactory.getById(id);
             territoireFactory.Down(ref territoire);
             return RedirectToAction("Index");
         }

+ 40 - 0
CD67.FicheCollege.MVC/Internal/MvcHtmlHelpers.cs

@@ -1,5 +1,8 @@
 using System;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
 using System.Linq.Expressions;
+using System.Web;
 using System.Web.Mvc;
 
 namespace CD67.FicheCollege.MVC
@@ -23,5 +26,42 @@ namespace CD67.FicheCollege.MVC
 
             return MvcHtmlString.Create(string.Format(@"<span>{0}</span>", description));
         }
+
+        /// <summary>
+        /// Affiche le "display name" pour un élément d'énumération
+        /// </summary>
+        /// <param name="item">Elément d'énumaration courant</param>
+        /// <param name="value">Valeur souhaitée</param>
+        /// <returns>Valeur de l'annotation Display name de l'élément d'énumération courant</returns>
+        public static HtmlString EnumDisplayNameFor(this Enum item, DisplayValue value)
+        {
+            var type = item.GetType();
+            var member = type.GetMember(item.ToString());
+            DisplayAttribute displayAttribute = (DisplayAttribute)member[0].GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault();
+
+            if (displayAttribute != null)
+            {
+                switch (value)
+                {
+                    case DisplayValue.Name:
+                        return new HtmlString(displayAttribute.Name);
+                    case DisplayValue.Prompt:
+                        return new HtmlString(displayAttribute.Prompt);
+                    case DisplayValue.Description:
+                        return new HtmlString(displayAttribute.Description);
+                    default:
+                        return new HtmlString(item.ToString());
+                }
+            }
+
+            return new HtmlString(item.ToString());
+        }
+
+        public enum DisplayValue
+        {
+            Name,
+            Prompt,
+            Description
+        }
     }
 }

+ 40 - 0
CD67.FicheCollege.MVC/Internal/Referentiel.cs

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Web;
+using System.Xml;
+
+namespace CD67.FicheCollege.MVC.Internal
+{
+    public class Referentiel
+    {
+        /// <summary>
+        /// Fonction qui interroge l'index SolR du référentiel commune pour retourner les codes postaux par communes
+        /// </summary>
+        /// <param name="Insee">Code Insee de la commune souhaitée</param>
+        /// <returns>Liste des codes postaux possibles</returns>
+        public static List<string> GetCodesPostaux(string Insee)
+        {
+            //cas de sortie immédiat
+            if (Insee == null) return new List<string>();
+
+            var m_strFilePath = String.Format(Properties.Settings.Default.GetCodesPostaux_URL, Insee);
+            string xmlStr;
+            using (var wc = new WebClient())
+            {
+                xmlStr = wc.DownloadString(m_strFilePath);
+            }
+            var xmlDoc = new XmlDocument();
+            xmlDoc.LoadXml(xmlStr);
+
+            //Recherche des données
+            List<string> result = new List<string>();
+            foreach (XmlNode item in xmlDoc.GetElementsByTagName("str"))
+            {
+                result.Add(item.InnerText);
+            }
+            return result;
+        }
+    }
+}

+ 17 - 0
CD67.FicheCollege.MVC/Models/CollegeViewModel.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace CD67.FicheCollege.MVC.Models
+{
+    public class CollegeViewModel
+    {
+        public string College_Id { get; set; }
+        public string College_Libelle { get; set; }
+        public object Contenu { get; set; }
+        public ModeAcces Acces { get; set; }
+        public Dictionary<String, SelectList> Listes { get; set; }
+    }
+}

+ 31 - 0
CD67.FicheCollege.MVC/Models/ContactViewModel.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace CD67.FicheCollege.MVC.Models
+{
+    public class ContactViewModel
+    {
+        public string Role { get; set; }
+        public string SID { get; set; }
+        public string Login { get; set; }
+        public string Nom { get; set; }
+        public string Prenom { get; set; }
+        public string Email { get; set; }
+        public string Tel { get; set; }
+        public string Structure { get; set; }
+
+        public ContactViewModel(string Role, string SID, string Login, string Nom, string Prenom, string Email, string Tel, string Structure)
+        {
+            this.Role = Role;
+            this.SID = SID;
+            this.Login = Login;
+            this.Nom = Nom;
+            this.Prenom = Prenom;
+            this.Email = Email;
+            this.Tel = Tel;
+            this.Structure = Structure;
+        }
+    }
+}

+ 20 - 0
CD67.FicheCollege.MVC/Models/ModeAcces.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Web;
+
+namespace CD67.FicheCollege.MVC.Models
+{
+    public enum ModeAcces
+    {
+        [Display(Prompt = "Ajouter")]
+        Creation,
+        [Display(Prompt = "Lire")]
+        Lecture,
+        [Display(Prompt = "Modifier")]
+        Modification,
+        [Display(Prompt = "Supprimer")]
+        Suppression
+    }
+}

+ 13 - 1
CD67.FicheCollege.MVC/Mvc.sitemap

@@ -5,6 +5,19 @@
             enableLocalization="true">
 
   <mvcSiteMapNode title="Accueil" controller="Home" action="Index">
+    <mvcSiteMapNode title="Collèges" controller="Colleges" action="Index">
+      <mvcSiteMapNode title="Ajout d'un nouveau collège" controller="Colleges" action="Create" />
+      <mvcSiteMapNode title="Détail d'un collège" controller="Colleges" action="Details" preservedRouteParameters="id" >
+        <mvcSiteMapNode title="Edition d'un collège" controller="Colleges" action="Edit" preservedRouteParameters="id" />
+        <mvcSiteMapNode title="Suppression d'un collège" controller="Colleges" action="Delete" preservedRouteParameters="id" />
+
+        <mvcSiteMapNode title="Identité" controller="Identites" action="Details" preservedRouteParameters="id" >
+          <mvcSiteMapNode title="Edition de l'identité" controller="Identites" action="Edit" preservedRouteParameters="id" />
+        </mvcSiteMapNode>
+          
+      </mvcSiteMapNode>
+    </mvcSiteMapNode>
+
     <mvcSiteMapNode title="Administration" controller="Admin" action="Index">
       <mvcSiteMapNode title="Types de collège" controller="TypeCollege" action="Index">
         <mvcSiteMapNode title="Création d'un type de collège" controller="TypeCollege" action="Create" />
@@ -19,5 +32,4 @@
       </mvcSiteMapNode>
     </mvcSiteMapNode>
   </mvcSiteMapNode>
-
 </mvcSiteMap>

+ 36 - 0
CD67.FicheCollege.MVC/Properties/Settings.Designer.cs

@@ -0,0 +1,36 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Ce code a été généré par un outil.
+//     Version du runtime :4.0.30319.42000
+//
+//     Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
+//     le code est régénéré.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace CD67.FicheCollege.MVC.Properties {
+    
+    
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+        
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+        
+        public static Settings Default {
+            get {
+                return defaultInstance;
+            }
+        }
+        
+        [global::System.Configuration.ApplicationScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("http://lunr4:8080/solr/referentiel-communes/select?q=id%3A{0}&fl=code_postal&wt=x" +
+            "ml&indent=true&hl=false&omitHeader=true")]
+        public string GetCodesPostaux_URL {
+            get {
+                return ((string)(this["GetCodesPostaux_URL"]));
+            }
+        }
+    }
+}

+ 9 - 0
CD67.FicheCollege.MVC/Properties/Settings.settings

@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CD67.FicheCollege.MVC.Properties" GeneratedClassName="Settings">
+  <Profiles />
+  <Settings>
+    <Setting Name="GetCodesPostaux_URL" Type="System.String" Scope="Application">
+      <Value Profile="(Default)">http://lunr4:8080/solr/referentiel-communes/select?q=id%3A{0}&amp;fl=code_postal&amp;wt=xml&amp;indent=true&amp;hl=false&amp;omitHeader=true</Value>
+    </Setting>
+  </Settings>
+</SettingsFile>

+ 3 - 0
CD67.FicheCollege.MVC/Scripts/cd67-colorbox.js

@@ -1,3 +1,6 @@
 $(document).ready(function () {
     $(".modal-window").colorbox({ iframe: true, width: "96%", height: "96%" });
+
+    //L'utilisation de cette classe requiert de gérer les 2 functions : onModalOpen() et onModalClose()
+    $(".modal-window-events").colorbox({ iframe: true, width: "96%", height: "96%", onOpen: function () { onModalOpen(); }, onClosed: function () { onModalClose(); } });
 });

+ 3 - 2
CD67.FicheCollege.MVC/Scripts/cd67-picker.js

@@ -10,19 +10,20 @@
                 console.log('type = ' + oEvent.data.type)
                 var filtreType = '';
                 if (oEvent.data.type != null) filtreType = "div[data-picker-type='" + oEvent.data.type + "'] ";
-                if ($(filtreType + "input[data-picker='" + current + "']").length > 0) $(filtreType + "input[data-picker='" + current + "']").val(value.replace(/_@_/g, "'"));
+                if ($(filtreType + "input[data-picker='" + current + "']").length > 0) $(filtreType + "input[data-picker='" + current + "']").val(String(value).replace(/_@_/g, "'"));
 
                 /* custom */
                 var span = $(filtreType + "span[data-picker='" + current + "']");
                 if (span.length > 0) {
                     span.closest(".panel").show();
-                    span.html(value.replace(/_@_/g, "'"));
+                    span.html(String(value).replace(/_@_/g, "'"));
                 }
             });
         }
         else return false;
 
         $(".modal-window").colorbox.close();
+        $(".modal-window-events").colorbox.close();
         
     });
 });

+ 126 - 0
CD67.FicheCollege.MVC/Views/Colleges/Details.cshtml

@@ -0,0 +1,126 @@
+@using CD67.FicheCollege.MVC.Models
+@model CollegeViewModel
+
+@{
+    ViewBag.Title = "Details";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+    College contenu = Model.Contenu as College;
+}
+
+<!-- Menu de niveau 2 -->
+<div>
+    <ul id="menu-l2">
+        <li id="li-menu-l2"><a id="a-li-menu-l2-active" class="btn-sm" href="@Url.Action("Details", "Colleges", new { Id = Model.College_Id })">Général</a></li>
+        <li id="li-menu-l2"><a id="a-li-menu-l2" class="btn-sm" href="@Url.Action("Details", "Identites", new { Id = Model.College_Id })/">Identité</a></li>
+    </ul>
+</div>
+
+<h1>@Model.College_Libelle</h1>
+@if(Model.Acces==ModeAcces.Suppression) {
+    <h2 class="text-danger">Voulez-vous vraiment supprimer cet élément?</h2>
+    <p class="text-danger">
+        Le collège ainsi que toutes les informations liées seront supprimées.
+    </p>
+}
+
+<fieldset>
+    <legend>
+        Informations générales
+        @if (Model.Acces == ModeAcces.Lecture)
+        {
+            <div class="pull-right">
+                @Html.ActionLink("Supprimer", "Delete", "Colleges", new { Id = Model.College_Id }, new { @class = "btn btn-danger" })
+                @Html.ActionLink("Modifier", "Edit", "Colleges", new { Id = Model.College_Id }, new { @class = "btn btn-default" })
+            </div>
+        }
+    </legend>
+    <dl class="dl-horizontal">
+        <dt>
+            @Html.DisplayNameFor(model => contenu.TypeCollege.Libelle)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => contenu.TypeCollege.Libelle)
+        </dd>
+
+        <dt>
+            @Html.DisplayNameFor(model => contenu.Adresse)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => contenu.AdresseComplete)
+        </dd>
+
+        <dt>
+            @Html.DisplayNameFor(model => contenu.Tel)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => contenu.Tel)
+        </dd>
+
+        <dt>
+            @Html.DisplayNameFor(model => contenu.Fax)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => contenu.Fax)
+        </dd>
+
+        <dt>
+            @Html.DisplayNameFor(model => contenu.Email)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => contenu.Email)
+        </dd>
+
+        <dt>
+            @Html.DisplayNameFor(model => contenu.Commune)
+        </dt>
+
+        <dd>
+            @if (contenu.Commune != null)
+            {
+                <div class="col-sm-8 col-md-4">
+                    <div class="panel panel-default">
+                        <div class="panel-heading clearfix">
+                            <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
+                                <i class="fa fa-map-marker color1" aria-hidden="true"></i>
+                                Localisation (commune)
+                            </h4>
+                        </div>
+                        <div class="panel-body" style="text-align: center;">
+                            <span style="white-space: pre-line;"><b>@contenu.Commune</b>
+                                Canton : @contenu.Canton
+                                TAD : @contenu.TAD
+                                CDC : @contenu.CDC
+                            </span>
+                        </div>
+                    </div>
+                </div>
+            }
+        </dd>
+
+        <dt>
+            @Html.DisplayNameFor(model => contenu.Code_Postal)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => contenu.Code_Postal)
+        </dd>
+    </dl>
+</fieldset>
+
+@if (Model.Acces == ModeAcces.Suppression)
+{
+    using (Html.BeginForm())
+    {
+        @Html.AntiForgeryToken()
+
+        <div class="form-actions no-color">
+            <input type="submit" value="@Model.Acces.EnumDisplayNameFor(MvcHtmlHelpers.DisplayValue.Prompt)" class="btn btn-danger" /> |
+            @Html.ActionLink("Annuler", "Details", new { Id = Model.College_Id })
+        </div>
+    }
+}

+ 201 - 0
CD67.FicheCollege.MVC/Views/Colleges/Edit.cshtml

@@ -0,0 +1,201 @@
+@using CD67.FicheCollege.MVC.Models
+@model CollegeViewModel
+
+@{
+    ViewBag.Title = "Ajout";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+    College contenu = Model.Contenu as College;
+}
+
+<h1>@Model.College_Libelle</h1>
+
+@using (Html.BeginForm())
+{
+    @Html.AntiForgeryToken()
+
+    <fieldset>
+        <legend>
+            Informations générales - @Model.Acces.ToString()
+        </legend>
+        <div class="form-horizontal">
+            <h4>Collège</h4>
+            <hr />
+            @Html.ValidationSummary(true, "", new { @class = "text-danger" })
+
+            @if (Model.Acces == ModeAcces.Modification)
+            {
+                @Html.HiddenFor(model => contenu.Id)
+            }
+            <div class="form-group">
+                @Html.LabelFor(model => contenu.Id, htmlAttributes: new { @class = "control-label col-md-2" })
+                <div class="col-md-10">
+                    @if (Model.Acces == ModeAcces.Modification)
+                    {
+                        @Html.EditorFor(model => contenu.Id, new { htmlAttributes = new { @class = "form-control", @disabled = true } })
+                    }
+                    else
+                    {
+                        @Html.EditorFor(model => contenu.Id, new { htmlAttributes = new { @class = "form-control" } })
+                    }
+                    @Html.ValidationMessageFor(model => contenu.Id, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
+            <div class="form-group">
+                @Html.LabelFor(model => contenu.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
+                <div class="col-md-10">
+                    @Html.EditorFor(model => contenu.Libelle, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => contenu.Libelle, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
+            <div class="form-group">
+                @Html.LabelFor(model => contenu.TypeCollege_Id, htmlAttributes: new { @class = "control-label col-md-2" })
+                <div class="col-md-10">
+                    @Html.DropDownListFor(model => contenu.TypeCollege_Id, Model.Listes["TypeCollege_Id"], htmlAttributes: new { @class = "form-control" })
+                    @Html.ValidationMessageFor(model => contenu.TypeCollege_Id, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
+            <div class="form-group">
+                @Html.LabelFor(model => contenu.Adresse, htmlAttributes: new { @class = "control-label col-md-2" })
+                <div class="col-md-10">
+                    @Html.EditorFor(model => contenu.Adresse, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => contenu.Adresse, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
+            @Html.HiddenFor(model => contenu.Commune_Insee, new { data_picker = "commune.insee" })
+            @Html.HiddenFor(model => contenu.Commune, new { data_picker = "commune.nom" })
+            @Html.HiddenFor(model => contenu.Canton, new { data_picker = "commune.canton" })
+            @Html.HiddenFor(model => contenu.Territoire_Id, new { data_picker = "commune.code_tad" })
+            @Html.HiddenFor(model => contenu.TAD, new { data_picker = "commune.tad" })
+            @Html.HiddenFor(model => contenu.CDC, new { data_picker = "commune.cdc" })
+            <div class="form-group">
+                @Html.LabelFor(model => contenu.Commune, htmlAttributes: new { @class = "control-label col-md-2 required" })
+                <div class="col-md-4">
+                    <a class='modal-window-events' href="http://referentiel.bas-rhin.fr/picker/cd67/com67/" title="Selection commune (nouvelle fenetre)">Sélectionner une commune</a>
+                    <br />
+                    <div class="panel panel-default" id="Commune_Panel" name="Commune_Panel" style="@if (contenu.Commune_Insee == null) { <text>display: none;</text> }">
+                        <div class="panel-heading clearfix">
+                            <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
+                                <i class="fa fa-map-marker color1" aria-hidden="true"></i>
+                                Localisation (commune)
+                            </h4>
+                            <div class="pull-right">
+                                <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="commune"></span>
+                            </div>
+                        </div>
+                        <div class="panel-body" style="text-align: center;">
+                            <span>
+                                <b><span data-picker="commune.nom">@contenu.Commune</span ></b >
+                                <br />Canton : <span data-picker="commune.canton">@contenu.Canton</span >
+                                <br />TAD : <span data-picker="commune.tad">@contenu.TAD</span >
+                                <br />CDC : <span data-picker="commune.cdc">@contenu.CDC</span >
+                            </span>
+                        </div>
+                    </div>
+                    @Html.ValidationMessageFor(model => contenu.Commune, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
+            <div class="form-group">
+                @Html.LabelFor(model => contenu.Code_Postal, htmlAttributes: new { @class = "control-label col-md-2" })
+                <div class="col-md-10">
+                    Code(s) postal(aux) associé(s) à la commune <span id="CP-warning" class="text-danger" style="@if (Model.Listes["Code_Postal"].Count() == 1) { <text>display: none;</text> }">(attention, plusieurs choix possibles)</span> : <input id="code_postaux" data-picker="commune.code_postal" value="@String.Join(",", Model.Listes["Code_Postal"].Select(i => i.Text))" class="disabled-input-as-label" />
+                    <br />
+                    @Html.DropDownListFor(model => contenu.Code_Postal, Model.Listes["Code_Postal"], htmlAttributes: new { @class = "form-control" })
+                    @Html.ValidationMessageFor(model => contenu.Code_Postal, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
+            <div class="form-group">
+                @Html.LabelFor(model => contenu.Tel, htmlAttributes: new { @class = "control-label col-md-2" })
+                <div class="col-md-10">
+                    @Html.EditorFor(model => contenu.Tel, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => contenu.Tel, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
+            <div class="form-group">
+                @Html.LabelFor(model => contenu.Fax, htmlAttributes: new { @class = "control-label col-md-2" })
+                <div class="col-md-10">
+                    @Html.EditorFor(model => contenu.Fax, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => contenu.Fax, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
+            <div class="form-group">
+                @Html.LabelFor(model => contenu.Email, htmlAttributes: new { @class = "control-label col-md-2" })
+                <div class="col-md-10">
+                    @Html.EditorFor(model => contenu.Email, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => contenu.Email, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
+            <div class="form-group">
+                <div class="col-md-offset-2 col-md-10">
+                    <input type="submit" value="@Model.Acces.EnumDisplayNameFor(MvcHtmlHelpers.DisplayValue.Prompt)" class="btn btn-default" /> |
+                    @if (Model.Acces == ModeAcces.Creation)
+                    { @Html.ActionLink("Annuler", "Index") }
+                    else
+                    { @Html.ActionLink("Annuler", "Details", new { Id = Model.College_Id }) }
+                </div>
+            </div>
+        </div>
+    </fieldset>
+}
+
+@section Scripts {
+    <script type="text/javascript">
+        $(".removeItem").click(function () {
+            switch ($(this).data("type")) {
+                case 'commune':
+                    $('#Code_Postal').val(null);
+                    $('#Commune_Insee').val(null);
+                    $('#Commune').val(null);
+                    $('#Canton').val(null);
+                    $('#Territoire_Id').val(null);
+                    $('#TAD').val(null);
+                    $('#CDC').val(null);
+                    $('#Commune_Panel').hide();
+
+                    //suppression du champ en dessous
+                    $('#code_postaux').val(null);
+                    $('#contenu_Code_Postal').empty();
+                    $('#CP-warning').hide();
+                    break;
+                default:
+                    return false;
+            }
+        });
+
+        // Function à implémenter pour éviter une erreur
+        function onModalOpen()
+        {
+            $('#CP-warning').hide();
+        }
+
+        function onModalClose()
+        {
+            var code_postaux = $('#code_postaux').val();
+            if (code_postaux != '') {
+                //On vide la liste actuelle
+                $('#contenu_Code_Postal').empty();
+
+                var liste = code_postaux.split(',');
+                liste.forEach(function (element) {
+                    //On ajoute les choix
+                    $('#contenu_Code_Postal').append($('<option>', {
+                        value: element,
+                        text: element
+                    }));
+                });
+
+                if (liste.length > 1) $('#CP-warning').show();
+            }
+        }
+    </script>
+
+    @Scripts.Render("~/bundles/jqueryval")
+}

+ 74 - 0
CD67.FicheCollege.MVC/Views/Colleges/Index.cshtml

@@ -0,0 +1,74 @@
+@model IEnumerable<CD67.FicheCollege.Entity.College>
+
+@{
+    ViewBag.Title = "Liste";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Index</h2>
+
+<p>
+    <a href="@Url.Action("Create")">
+        <span class="glyphicon glyphicon-plus-sign fa-2x color1" style="vertical-align: middle" aria-hidden="true"></span>
+        Ajouter un nouveau collège
+    </a>
+</p>
+
+<table class="table">
+    <tr>
+        <th>
+            @Html.DisplayNameFor(model => model.Id)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.Adresse)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.CDC)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.Tel)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.Fax)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.Email)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.Territoire.Libelle)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.TypeCollege.Libelle)
+        </th>
+    </tr>
+
+@foreach (var item in Model) {
+    <tr>
+        <th>
+            @Html.ActionLink(item.Id, "Details", new { id = item.Id })
+        </th>
+        <td>
+            @Html.DisplayFor(modelItem => item.AdresseComplete)
+        </td>
+        <td>
+            @Html.DisplayFor(modelItem => item.CDC)
+        </td>
+        <td>
+            @Html.DisplayFor(modelItem => item.Tel)
+        </td>
+        <td>
+            @Html.DisplayFor(modelItem => item.Fax)
+        </td>
+        <td>
+            @Html.DisplayFor(modelItem => item.Email)
+        </td>
+        <td>
+            @Html.DisplayFor(modelItem => item.Territoire.Libelle)
+        </td>
+        <td>
+            @Html.DisplayFor(modelItem => item.TypeCollege.Libelle)
+        </td>
+    </tr>
+}
+
+</table>

+ 3 - 6
CD67.FicheCollege.MVC/Views/Home/Index.cshtml

@@ -5,10 +5,7 @@
     Layout = "~/Views/Shared/_Layout.cshtml";
 }
 
-<h1>Accueil</h1>
+<h2>Accueil</h2>
 
-<div>
-    <ul id="menu-l2">
-        <li id="li-menu-l2"><a id="a-li-menu-l2-active" class="btn-sm" href="~/">Sous&#160;menu&#160;1</a></li>
-    </ul>
-</div>
+@Html.ActionLink("Les collèges", "Index", "Colleges")<br />
+@Html.ActionLink("La page d'administration du site", "Index", "Admin")<br />

+ 60 - 0
CD67.FicheCollege.MVC/Views/Identites/Details.cshtml

@@ -0,0 +1,60 @@
+@using CD67.FicheCollege.MVC.Models
+@model CollegeViewModel
+
+@{
+    ViewBag.Title = "Details";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+    List<ContactViewModel> contenu = Model.Contenu as List<ContactViewModel>;
+}
+
+<!-- Menu de niveau 2 -->
+<div>
+    <ul id="menu-l2">
+        <li id="li-menu-l2"><a id="a-li-menu-l2" class="btn-sm" href="@Url.Action("Details", "Colleges", new { Id = Model.College_Id })">Général</a></li>
+        <li id="li-menu-l2"><a id="a-li-menu-l2-active" class="btn-sm" href="@Url.Action("Details", "Identites", new { Id = Model.College_Id })/">Identité</a></li>
+    </ul>
+</div>
+
+
+<h1>@Model.College_Libelle</h1>
+
+<fieldset>
+    <legend>
+        Identité du collège
+        @if (Model.Acces == ModeAcces.Lecture)
+        {
+            <div class="pull-right">
+                @Html.ActionLink("Modifier", "Edit", "Identites", new { Id = Model.College_Id }, new { @class = "btn btn-default" })
+            </div>
+        }
+    </legend>
+
+    @if (contenu.Count == 0)
+    {
+        <text>Aucun contact défini</text>
+    }
+    else
+    {
+        <div class="flex-list">
+            @foreach (var item in contenu)
+            {
+                <div style="width:400px !important">
+                    <div class="panel panel-default" style="overflow: hidden;">
+                        <div class="panel-heading clearfix">
+                            <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
+                                <i class="fa fa-user color1" aria-hidden="true"></i>
+                                @Html.DisplayFor(model => item.Role)
+                            </h4>
+                        </div>
+                        <div class="panel-body" style="text-align: center;">
+                            <b>@Html.DisplayFor(model => item.Prenom) @Html.DisplayFor(model => item.Nom)</b><br />
+                            @Html.DisplayFor(model => item.Structure)<br />
+                            @Html.DisplayFor(model => item.Email)<br />
+                            Tel : @Html.DisplayFor(model => item.Tel)<br />
+                        </div>
+                    </div>
+                </div>
+            }
+        </div>
+    }
+</fieldset>

+ 207 - 0
CD67.FicheCollege.MVC/Views/Identites/Edit.cshtml

@@ -0,0 +1,207 @@
+@using CD67.FicheCollege.MVC.Models
+@model CollegeViewModel
+
+@{
+    ViewBag.Title = "Edit";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+    Identite contenu = Model.Contenu as Identite;
+}
+
+<h1>@Model.College_Libelle</h1>
+
+@using (Html.BeginForm())
+{
+    @Html.AntiForgeryToken()
+    
+    <fieldset>
+        <legend>
+            Identité du collège - @Model.Acces.ToString()
+        </legend>
+        <div class="form-horizontal">
+            @Html.ValidationSummary(true, "", new { @class = "text-danger" })
+            @Html.HiddenFor(model => contenu.College_Id)
+
+            <div class="form-group">
+                @Html.Label("Principal et ajoint", htmlAttributes: new { @class = "control-label col-md-2" })
+
+                <div class="col-md-4" data-picker-type="principal">
+                    @Html.HiddenFor(model => contenu.Principal_SID, new { data_picker = "agent.id" })
+                    @Html.HiddenFor(model => contenu.Principal_Login, new { data_picker = "agent.login" })
+                    @Html.HiddenFor(model => contenu.Principal_Nom, new { data_picker = "agent.nom" })
+                    @Html.HiddenFor(model => contenu.Principal_Prenom, new { data_picker = "agent.prenom" })
+                    @Html.HiddenFor(model => contenu.Principal_Email, new { data_picker = "agent.mail" })
+                    @Html.HiddenFor(model => contenu.Principal_Structure, new { data_picker = "agent.chemin" })
+                    @Html.HiddenFor(model => contenu.Principal_Tel, new { data_picker = "agent.telephone" })
+                    <a class='modal-window' href="http://referentiel.bas-rhin.fr/picker/cd67/ad67/?type=principal" title="Selection du principal (nouvelle fenetre)">Sélectionner un principal</a>
+                    <br />
+                    <div class="panel panel-default" id="Principal_Panel" name="Principal_Panel" style="@if (contenu.Principal_SID == null) { <text>display: none;</text> }">
+                        <div class="panel-heading clearfix">
+                            <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
+                                <i class="fa fa-user color1" aria-hidden="true"></i>
+                                Principal
+                            </h4>
+                            <div class="pull-right">
+                                <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="principal"></span>
+                            </div>
+                        </div>
+                        <div class="panel-body" style="text-align: center;">
+                            <b><span data-picker="agent.prenom">@contenu.Principal_Prenom</span> <span data-picker="agent.nom">@contenu.Principal_Nom</span></b>
+                            <br /><span data-picker="agent.chemin">@contenu.Principal_Structure</span>
+                            <br /><span data-picker="agent.mail">@contenu.Principal_Email</span>
+                            <br />Tel : <span data-picker="agent.telephone">@contenu.Principal_Tel</span>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="col-md-4" data-picker-type="adjoint">
+                    @Html.HiddenFor(model => contenu.Adjoint_SID, new { data_picker = "agent.id" })
+                    @Html.HiddenFor(model => contenu.Adjoint_Login, new { data_picker = "agent.login" })
+                    @Html.HiddenFor(model => contenu.Adjoint_Nom, new { data_picker = "agent.nom" })
+                    @Html.HiddenFor(model => contenu.Adjoint_Prenom, new { data_picker = "agent.prenom" })
+                    @Html.HiddenFor(model => contenu.Adjoint_Email, new { data_picker = "agent.mail" })
+                    @Html.HiddenFor(model => contenu.Adjoint_Structure, new { data_picker = "agent.chemin" })
+                    @Html.HiddenFor(model => contenu.Adjoint_Tel, new { data_picker = "agent.telephone" })
+                    <a class='modal-window' href="http://referentiel.bas-rhin.fr/picker/cd67/ad67/?type=adjoint" title="Selection du principal adjoint (nouvelle fenetre)">Sélectionner un principal adjoint</a>
+                    <br />
+                    <div class="panel panel-default" id="Adjoint_Panel" name="Adjoint_Panel" style="@if (contenu.Adjoint_SID == null) { <text>display: none;</text> }">
+                        <div class="panel-heading clearfix">
+                            <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
+                                <i class="fa fa-user color1" aria-hidden="true"></i>
+                                Principal adjoint
+                            </h4>
+                            <div class="pull-right">
+                                <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="adjoint"></span>
+                            </div>
+                        </div>
+                        <div class="panel-body" style="text-align: center;">
+                            <b><span data-picker="agent.prenom">@contenu.Adjoint_Prenom</span> <span data-picker="agent.nom">@contenu.Adjoint_Nom</span></b>
+                            <br /><span data-picker="agent.chemin">@contenu.Adjoint_Structure</span>
+                            <br /><span data-picker="agent.mail">@contenu.Adjoint_Email</span>
+                            <br />Tel : <span data-picker="agent.telephone">@contenu.Adjoint_Tel</span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="form-group">
+                @Html.Label("Gestionnaire et ajoint", htmlAttributes: new { @class = "control-label col-md-2" })
+
+                <div class="col-md-4" data-picker-type="gestionnaire">
+                    @Html.HiddenFor(model => contenu.Gestionnaire_SID, new { data_picker = "agent.id" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire_Login, new { data_picker = "agent.login" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire_Nom, new { data_picker = "agent.nom" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire_Prenom, new { data_picker = "agent.prenom" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire_Email, new { data_picker = "agent.mail" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire_Structure, new { data_picker = "agent.chemin" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire_Tel, new { data_picker = "agent.telephone" })
+                    <a class='modal-window' href="http://referentiel.bas-rhin.fr/picker/cd67/ad67/?type=gestionnaire" title="Selection du gestionnaire (nouvelle fenetre)">Sélectionner un gestionnaire</a>
+                    <br />
+                    <div class="panel panel-default" id="Gestionnaire_Panel" name="Gestionnaire_Panel" style="@if (contenu.Gestionnaire_SID == null) { <text>display: none;</text> }">
+                        <div class="panel-heading clearfix">
+                            <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
+                                <i class="fa fa-user color1" aria-hidden="true"></i>
+                                Gestionnaire
+                            </h4>
+                            <div class="pull-right">
+                                <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="gestionnaire"></span>
+                            </div>
+                        </div>
+                        <div class="panel-body" style="text-align: center;">
+                            <b><span data-picker="agent.prenom">@contenu.Gestionnaire_Prenom</span> <span data-picker="agent.nom">@contenu.Gestionnaire_Nom</span></b>
+                            <br /><span data-picker="agent.chemin">@contenu.Gestionnaire_Structure</span>
+                            <br /><span data-picker="agent.mail">@contenu.Gestionnaire_Email</span>
+                            <br />Tel : <span data-picker="agent.telephone">@contenu.Gestionnaire_Tel</span>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="col-md-4" data-picker-type="gestionnaire2">
+                    @Html.HiddenFor(model => contenu.Gestionnaire2_SID, new { data_picker = "agent.id" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire2_Login, new { data_picker = "agent.login" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire2_Nom, new { data_picker = "agent.nom" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire2_Prenom, new { data_picker = "agent.prenom" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire2_Email, new { data_picker = "agent.mail" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire2_Structure, new { data_picker = "agent.chemin" })
+                    @Html.HiddenFor(model => contenu.Gestionnaire2_Tel, new { data_picker = "agent.telephone" })
+                    <a class='modal-window' href="http://referentiel.bas-rhin.fr/picker/cd67/ad67/?type=gestionnaire2" title="Selection du gestionnaire n°2 (nouvelle fenetre)">Sélectionner un gestionnaire n°2</a>
+                    <br />
+                    <div class="panel panel-default" id="Gestionnaire2_Panel" name="Gestionnaire2_Panel" style="@if (contenu.Gestionnaire2_SID == null) { <text>display: none;</text> }">
+                        <div class="panel-heading clearfix">
+                            <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
+                                <i class="fa fa-user color1" aria-hidden="true"></i>
+                                Gestionnaire n°2
+                            </h4>
+                            <div class="pull-right">
+                                <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="gestionnaire2"></span>
+                            </div>
+                        </div>
+                        <div class="panel-body" style="text-align: center;">
+                            <b><span data-picker="agent.prenom">@contenu.Gestionnaire2_Prenom</span> <span data-picker="agent.nom">@contenu.Gestionnaire2_Nom</span></b>
+                            <br /><span data-picker="agent.chemin">@contenu.Gestionnaire2_Structure</span>
+                            <br /><span data-picker="agent.mail">@contenu.Gestionnaire2_Email</span>
+                            <br />Tel : <span data-picker="agent.telephone">@contenu.Gestionnaire2_Tel</span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="form-group">
+                <div class="col-md-offset-2 col-md-10">
+                    <input type="submit" value="@Model.Acces.EnumDisplayNameFor(MvcHtmlHelpers.DisplayValue.Prompt)" class="btn btn-default" /> |
+                    @Html.ActionLink("Annuler", "Details", new { Id = Model.College_Id })
+                </div>
+            </div>
+        </div>
+    </fieldset>
+}
+
+@section Scripts {
+    <script type="text/javascript">
+        $(".removeItem").click(function () {
+            switch ($(this).data("type")) {
+                case 'principal':
+                    $('#contenu_Principal_SID').val(null);
+                    $('#contenu_Principal_Login').val(null);
+                    $('#contenu_Principal_Nom').val(null);
+                    $('#contenu_Principal_Prenom').val(null);
+                    $('#contenu_Principal_Email').val(null);
+                    $('#contenu_Principal_Structure').val(null);
+                    $('#contenu_Principal_Tel').val(null);
+                    $('#Principal_Panel').hide();
+                    break;
+                case 'adjoint':
+                    $('#contenu_Adjoint_SID').val(null);
+                    $('#contenu_Adjoint_Login').val(null);
+                    $('#contenu_Adjoint_Nom').val(null);
+                    $('#contenu_Adjoint_Prenom').val(null);
+                    $('#contenu_Adjoint_Email').val(null);
+                    $('#contenu_Adjoint_Structure').val(null);
+                    $('#contenu_Adjoint_Tel').val(null);
+                    $('#Adjoint_Panel').hide();
+                    break;
+                case 'gestionnaire':
+                    $('#contenu_Gestionnaire_SID').val(null);
+                    $('#contenu_Gestionnaire_Login').val(null);
+                    $('#contenu_Gestionnaire_Nom').val(null);
+                    $('#contenu_Gestionnaire_Prenom').val(null);
+                    $('#contenu_Gestionnaire_Email').val(null);
+                    $('#contenu_Gestionnaire_Structure').val(null);
+                    $('#contenu_Gestionnaire_Tel').val(null);
+                    $('#Gestionnaire_Panel').hide();
+                    break;
+                case 'gestionnaire2':
+                    $('#contenu_Gestionnaire2_SID').val(null);
+                    $('#contenu_Gestionnaire2_Login').val(null);
+                    $('#contenu_Gestionnaire2_Nom').val(null);
+                    $('#contenu_Gestionnaire2_Prenom').val(null);
+                    $('#contenu_Gestionnaire2_Email').val(null);
+                    $('#contenu_Gestionnaire2_Structure').val(null);
+                    $('#contenu_Gestionnaire2_Tel').val(null);
+                    $('#Gestionnaire2_Panel').hide();
+                    break;
+                default:
+                    return false;
+            }
+        });
+    </script>
+}

+ 19 - 6
CD67.FicheCollege.MVC/Views/Shared/_Layout.cshtml

@@ -83,12 +83,25 @@
         <sidebar class="no-print navbar-collapse collapse hidden" >
             <ul class="sidebar-nav nav-stacked menu_principal">
                 <li>
-                    <div  class="active menu-1">
-                        <span class="fa fa-headphones title">Accueil</span>
-                    </div>
-                    <ul class="submenu hidden">
-                        <li><a href="@Url.Action("Index", "Admin", new { })"><span>Administration</span></a></li>
-                    </ul>
+                    <a href="@Url.Action("Index", "home", new { })">
+                        <div class="active menu-1">
+                            <span class="fa fa-home title">Accueil</span>
+                        </div>
+                    </a>
+                </li>
+                <li>
+                    <a href="@Url.Action("Index", "Colleges", new { })">
+                        <div class="active menu-1">
+                            <span class="fa fa-building title">Collèges</span>
+                        </div>
+                    </a>
+                </li>
+                <li>
+                    <a href="@Url.Action("Index", "Admin", new { })">
+                        <div class="active menu-1">
+                            <span class="fa fa-cog title">Administration</span>
+                        </div>
+                    </a>
                 </li>
             </ul>
         </sidebar>

+ 13 - 6
CD67.FicheCollege.MVC/Views/Territoire/Create.cshtml

@@ -16,9 +16,16 @@
         <h4>Territoire</h4>
         <hr />
         @Html.ValidationSummary(true, "", new { @class = "text-danger" })
-        @Html.HiddenFor(model => model.Id)
         @Html.HiddenFor(model => model.Ordre)
 
+        <div class="form-group">
+            @Html.LabelFor(model => model.Id, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.EditorFor(model => model.Id, new { htmlAttributes = new { @class = "form-control", @autofocus = true } })
+                @Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" })
+            </div>
+        </div>
+
         <div class="form-group">
             @Html.LabelFor(model => model.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
             <div class="col-md-10">
@@ -35,6 +42,7 @@
                 @Html.HiddenFor(model => model.Referent_Prenom, new { data_picker = "agent.prenom" })
                 @Html.HiddenFor(model => model.Referent_Structure, new { data_picker = "agent.chemin" })
                 @Html.HiddenFor(model => model.Referent_Login, new { data_picker = "agent.login" })
+                @Html.HiddenFor(model => model.Referent_Email, new { data_picker = "agent.mail" })
                 <a class='modal-window' href="http://referentiel.bas-rhin.fr/picker/cd67/ad67/?type=referent" title="Selection d'un référent (nouvelle fenetre)">Sélectionner un référent</a>
                 <br />
                 <div class="panel panel-default" id="Referent_Panel" name="Referent_Panel" style="@if (Model.Referent_SID == null) { <text>display: none;</text> }">
@@ -43,10 +51,8 @@
                             <i class="fa fa-user color1" aria-hidden="true"></i>
                             Agent
                         </h4>
-                        <div class="btn-group pull-right">
-                            <a class="btn btn-danger btn-sm" href="#">
-                                <span class="glyphicon glyphicon-trash removeItem" aria-hidden="true" data-type="referent"></span>
-                            </a>
+                        <div class="pull-right">
+                            <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="referent"></span>
                         </div>
                     </div>
                     <div class="panel-body" style="text-align: center;">
@@ -75,10 +81,11 @@
             switch ($(this).data("type")) {
                 case 'referent':
                     $('#Referent_SID').val(null);
-                    $('#Referent_Prenom').val(null);
                     $('#Referent_Nom').val(null);
+                    $('#Referent_Prenom').val(null);
                     $('#Referent_Structure').val(null);
                     $('#Referent_Login').val(null);
+                    $('#Referent_Email').val(null);
                     $('#Referent_Panel').hide();
                     break;
                 default:

+ 15 - 0
CD67.FicheCollege.MVC/Views/Territoire/Delete.cshtml

@@ -12,6 +12,14 @@
     <h4>Territoire</h4>
     <hr />
     <dl class="dl-horizontal">
+        <dt>
+            @Html.DisplayNameFor(model => model.Id)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => model.Id)
+        </dd>
+
         <dt>
             @Html.DisplayNameFor(model => model.Libelle)
         </dt>
@@ -20,6 +28,13 @@
             @Html.DisplayFor(model => model.Libelle)
         </dd>
 
+        <dt>
+            @Html.DisplayNameFor(model => model.Referent)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => model.Referent)
+        </dd>
     </dl>
 
     @using (Html.BeginForm()) {

+ 13 - 5
CD67.FicheCollege.MVC/Views/Territoire/Edit.cshtml

@@ -19,6 +19,14 @@
         @Html.HiddenFor(model => model.Id)
         @Html.HiddenFor(model => model.Ordre)
 
+        <div class="form-group">
+            @Html.LabelFor(model => model.Id, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.EditorFor(model => model.Id, new { htmlAttributes = new { @class = "form-control", @disabled = true } })
+                @Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" })
+            </div>
+        </div>
+
         <div class="form-group">
             @Html.LabelFor(model => model.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
             <div class="col-md-10">
@@ -35,6 +43,7 @@
                 @Html.HiddenFor(model => model.Referent_Prenom, new { data_picker = "agent.prenom" })
                 @Html.HiddenFor(model => model.Referent_Structure, new { data_picker = "agent.chemin" })
                 @Html.HiddenFor(model => model.Referent_Login, new { data_picker = "agent.login" })
+                @Html.HiddenFor(model => model.Referent_Email, new { data_picker = "agent.mail" })
                 <a class='modal-window' href="http://referentiel.bas-rhin.fr/picker/cd67/ad67/?type=referent" title="Selection d'un référent (nouvelle fenetre)">Sélectionner un référent</a>
                 <br />
                 <div class="panel panel-default" id="Referent_Panel" name="Referent_Panel" style="@if (Model.Referent_SID == null) { <text>display: none;</text> }">
@@ -43,10 +52,8 @@
                             <i class="fa fa-user color1" aria-hidden="true"></i>
                             Agent
                         </h4>
-                        <div class="btn-group pull-right">
-                            <a class="btn btn-danger btn-sm" href="#">
-                                <span class="glyphicon glyphicon-trash removeItem" aria-hidden="true" data-type="referent"></span>
-                            </a>
+                        <div class="pull-right">
+                            <span class="glyphicon glyphicon-trash removeItem btn btn-danger btn-sm" aria-hidden="true" data-type="referent"></span>
                         </div>
                     </div>
                     <div class="panel-body" style="text-align: center;">
@@ -75,10 +82,11 @@
             switch ($(this).data("type")) {
                 case 'referent':
                     $('#Referent_SID').val(null);
-                    $('#Referent_Prenom').val(null);
                     $('#Referent_Nom').val(null);
+                    $('#Referent_Prenom').val(null);
                     $('#Referent_Structure').val(null);
                     $('#Referent_Login').val(null);
+                    $('#Referent_Email').val(null);
                     $('#Referent_Panel').hide();
                     break;
                 default:

+ 6 - 12
CD67.FicheCollege.MVC/Views/Territoire/Index.cshtml

@@ -18,24 +18,18 @@
 
 <table class="table">
     <tr>
-        <th>
-            @Html.DisplayNameFor(model => model.Libelle)
-        </th>
-        <th>
-            @Html.DisplayNameFor(model => model.Referent)
-        </th>
+        <th>@Html.DisplayNameFor(model => model.Id)</th>
+        <th>@Html.DisplayNameFor(model => model.Libelle)</th>
+        <th>@Html.DisplayNameFor(model => model.Referent)</th>
         <th></th>
     </tr>
 
 @foreach (var item in Model)
 {
     <tr>
-        <td>
-            @Html.DisplayFor(modelItem => item.Libelle)
-        </td>
-        <td>
-            @Html.DisplayFor(modelItem => item.Referent)
-        </td>
+        <td>@Html.DisplayFor(modelItem => item.Id)</td>
+        <td>@Html.DisplayFor(modelItem => item.Libelle)</td>
+        <td>@Html.DisplayFor(modelItem => item.Referent)</td>
         <td>
             @if (row != 1)
                 {

+ 1 - 0
CD67.FicheCollege.MVC/Views/Web.config

@@ -18,6 +18,7 @@
         <add namespace="System.Web.Routing" />
         <add namespace="System.Web.Optimization" />
         <add namespace="CD67.FicheCollege.MVC" />
+        <add namespace="CD67.FicheCollege.Entity" />
       </namespaces>
     </pages>
   </system.web.webPages.razor>

+ 20 - 2
CD67.FicheCollege.MVC/Web.config

@@ -6,8 +6,14 @@
 <configuration>
   <configSections>
     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
-  </configSections>
+    
+  
+  <section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
+  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+      <section name="CD67.FicheCollege.MVC.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+    </sectionGroup>
+                                                                                                                      </configSections>
   <connectionStrings>
     <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" />
   </connectionStrings>
@@ -51,6 +57,9 @@
         <add namespace="System.Web.WebPages" />
       </namespaces>
     </pages>
+    <httpHandlers>
+      <add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
+    </httpHandlers>
   </system.web>
   <system.webServer>
     <staticContent>
@@ -62,6 +71,7 @@
       <remove name="OPTIONSVerbHandler" />
       <remove name="TRACEVerbHandler" />
       <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
+      <add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
     </handlers>
   </system.webServer>
   <entityFramework>
@@ -113,4 +123,12 @@
       </dependentAssembly>
     </assemblyBinding>
   </runtime>
+  <dotless minifyCss="false" cache="true" web="false" strictMath="false" />
+  <applicationSettings>
+    <CD67.FicheCollege.MVC.Properties.Settings>
+      <setting name="GetCodesPostaux_URL" serializeAs="String">
+        <value>http://lunr4:8080/solr/referentiel-communes/select?q=id%3A{0}&amp;fl=code_postal&amp;wt=xml&amp;indent=true&amp;hl=false&amp;omitHeader=true</value>
+      </setting>
+    </CD67.FicheCollege.MVC.Properties.Settings>
+  </applicationSettings>
 </configuration>

+ 1 - 0
CD67.FicheCollege.MVC/packages.config

@@ -3,6 +3,7 @@
   <package id="Antlr" version="3.5.0.2" targetFramework="net451" />
   <package id="bootstrap" version="3.3.7" targetFramework="net451" />
   <package id="colorbox" version="1.4.29" targetFramework="net461" />
+  <package id="dotless" version="1.5.2" targetFramework="net461" />
   <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
   <package id="FontAwesome" version="4.7.0" targetFramework="net451" />
   <package id="Freyd.SolrTools" version="1.6.14" targetFramework="net461" />