Browse Source

Merge branch '27-ajout-de-l-annualisation-des-donnees' into experiment

julien.legrand 7 years ago
parent
commit
ccdffbd2a2
50 changed files with 1272 additions and 508 deletions
  1. 1 1
      CD67.FicheCollege.BDD/Actions-CLAS.sql
  2. 5 0
      CD67.FicheCollege.BDD/Annees.sql
  3. 7 0
      CD67.FicheCollege.BDD/CD67.FicheCollege.BDD.refactorlog
  4. 1 0
      CD67.FicheCollege.BDD/CD67.FicheCollege.BDD.sqlproj
  5. 7 4
      CD67.FicheCollege.BDD/Colleges.sql
  6. 1 1
      CD67.FicheCollege.BDD/Identites.sql
  7. 8 2
      CD67.FicheCollege.Entity/ActionCLAS.cs
  8. 29 0
      CD67.FicheCollege.Entity/Annee.cs
  9. 6 0
      CD67.FicheCollege.Entity/CD67.FicheCollege.Entity.csproj
  10. 4 1
      CD67.FicheCollege.Entity/College.cs
  11. 1 0
      CD67.FicheCollege.Entity/EntityModel.Context.cs
  12. 1 1
      CD67.FicheCollege.Entity/EntityModel.Designer.cs
  13. 152 88
      CD67.FicheCollege.Entity/EntityModel.edmx
  14. 7 5
      CD67.FicheCollege.Entity/EntityModel.edmx.diagram
  15. 197 36
      CD67.FicheCollege.Entity/EntityModel.edmx.sql
  16. 4 2
      CD67.FicheCollege.Entity/Extend/ActionCLAS.cs
  17. 21 0
      CD67.FicheCollege.Entity/Extend/Annee.cs
  18. 6 8
      CD67.FicheCollege.Entity/Extend/College.cs
  19. 25 0
      CD67.FicheCollege.Entity/Extend/Identite.cs
  20. 1 1
      CD67.FicheCollege.Entity/Identite.cs
  21. 137 0
      CD67.FicheCollege.Entity/Model_initial_inserts.sql
  22. 4 4
      CD67.FicheCollege.Factory/ActionCLASFactory.cs
  23. 49 0
      CD67.FicheCollege.Factory/AnneeFactory.cs
  24. 4 0
      CD67.FicheCollege.Factory/CD67.FicheCollege.Factory.csproj
  25. 1 1
      CD67.FicheCollege.Factory/IdentiteFactory.cs
  26. 21 0
      CD67.FicheCollege.Factory/Internal/AnneeFactory.cs
  27. 8 2
      CD67.FicheCollege.MVC/CD67.FicheCollege.MVC.csproj
  28. 14 20
      CD67.FicheCollege.MVC/Controllers/ActionsCLASController.cs
  29. 79 0
      CD67.FicheCollege.MVC/Controllers/AnneesController.cs
  30. 65 63
      CD67.FicheCollege.MVC/Controllers/CollegesController.cs
  31. 11 3
      CD67.FicheCollege.MVC/Controllers/HomeController.cs
  32. 15 31
      CD67.FicheCollege.MVC/Controllers/IdentitesController.cs
  33. 6 12
      CD67.FicheCollege.MVC/Controllers/TerritoireController.cs
  34. 15 0
      CD67.FicheCollege.MVC/Models/ActionClasViewModel.cs
  35. 24 0
      CD67.FicheCollege.MVC/Models/AnneeViewModel.cs
  36. 63 0
      CD67.FicheCollege.MVC/Models/BaseViewModel.cs
  37. 19 9
      CD67.FicheCollege.MVC/Models/CollegeViewModel.cs
  38. 1 0
      CD67.FicheCollege.MVC/Models/ContactViewModel.cs
  39. 25 0
      CD67.FicheCollege.MVC/Models/IdentiteViewModel.cs
  40. 0 20
      CD67.FicheCollege.MVC/Models/ModeAcces.cs
  41. 8 8
      CD67.FicheCollege.MVC/Views/ActionsCLAS/Details.cshtml
  42. 11 11
      CD67.FicheCollege.MVC/Views/ActionsCLAS/Edit.cshtml
  43. 15 0
      CD67.FicheCollege.MVC/Views/Annees/Details.cshtml
  44. 17 0
      CD67.FicheCollege.MVC/Views/Annees/Index.cshtml
  45. 23 24
      CD67.FicheCollege.MVC/Views/Colleges/Details.cshtml
  46. 58 49
      CD67.FicheCollege.MVC/Views/Colleges/Edit.cshtml
  47. 23 21
      CD67.FicheCollege.MVC/Views/Colleges/Index.cshtml
  48. 6 6
      CD67.FicheCollege.MVC/Views/Identites/Details.cshtml
  49. 53 53
      CD67.FicheCollege.MVC/Views/Identites/Edit.cshtml
  50. 13 21
      CD67.FicheCollege.MVC/Views/Shared/_Layout.cshtml

+ 1 - 1
CD67.FicheCollege.BDD/Actions-CLAS.sql

@@ -1,6 +1,6 @@
 CREATE TABLE [dbo].[Actions-CLAS]
 (
-	[College_Id] NVARCHAR(8) NOT NULL PRIMARY KEY, 
+	[College_Id] INT NOT NULL PRIMARY KEY, 
     [Action] BIT NULL, 
     [Commentaire] NTEXT NULL, 
     CONSTRAINT [FK_Actions-CLAS_College] FOREIGN KEY ([College_Id]) REFERENCES [Colleges]([Id])

+ 5 - 0
CD67.FicheCollege.BDD/Annees.sql

@@ -0,0 +1,5 @@
+CREATE TABLE [dbo].[Annees] (
+    [Id] int IDENTITY(1,1) NOT NULL  PRIMARY KEY,
+    [Libelle] nvarchar(12)  NOT NULL
+);
+

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

@@ -84,4 +84,11 @@
     <Property Name="ParentElementType" Value="SqlTable" />
     <Property Name="NewName" Value="Action" />
   </Operation>
+  <Operation Name="Rename Refactor" Key="845f4240-dd04-4510-afce-e01d0ff501bc" ChangeDateTime="02/01/2018 09:41:57">
+    <Property Name="ElementName" Value="[dbo].[Annees].[libelle]" />
+    <Property Name="ElementType" Value="SqlSimpleColumn" />
+    <Property Name="ParentElementName" Value="[dbo].[Annees]" />
+    <Property Name="ParentElementType" Value="SqlTable" />
+    <Property Name="NewName" Value="Libelle" />
+  </Operation>
 </Operations>

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

@@ -65,6 +65,7 @@
     <Build Include="Colleges.sql" />
     <Build Include="Identites.sql" />
     <Build Include="Actions-CLAS.sql" />
+    <Build Include="Annees.sql" />
   </ItemGroup>
   <ItemGroup>
     <RefactorLog Include="CD67.FicheCollege.BDD.refactorlog" />

+ 7 - 4
CD67.FicheCollege.BDD/Colleges.sql

@@ -1,19 +1,22 @@
 CREATE TABLE [dbo].[Colleges]
 (
-	[Id] NVARCHAR(8) NOT NULL PRIMARY KEY, 
-	[Libelle] NVARCHAR(255) NOT NULL, 
+	[Id] INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
+    [Annee_Id] int  NOT NULL,
+	[CodeRne] NVARCHAR(10) NOT NULL, 
+	[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, 
+    [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])
+    CONSTRAINT [FK_Colleges_Territoires] FOREIGN KEY ([Territoire_Id]) REFERENCES [Territoires]([Id]),
+    CONSTRAINT [FK_Annees_Colleges] FOREIGN KEY ([Annee_Id]) REFERENCES [Annees]([Id])
 )

+ 1 - 1
CD67.FicheCollege.BDD/Identites.sql

@@ -1,6 +1,6 @@
 CREATE TABLE [dbo].[Identites]
 (
-	[College_Id] NVARCHAR(8) NOT NULL PRIMARY KEY, 
+	[College_Id] INT NOT NULL PRIMARY KEY, 
 	[Principal_SID] NVARCHAR(64) NULL, 
 	[Principal_Login] NVARCHAR(255) NULL, 
     [Principal_Nom] NVARCHAR(255) NULL, 

+ 8 - 2
CD67.FicheCollege.Entity/ActionCLAS.cs

@@ -14,8 +14,14 @@ namespace CD67.FicheCollege.Entity
     
     public partial class ActionCLAS
     {
-        public string College_Id { get; set; }
-        public Nullable<bool> Action { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public ActionCLAS()
+        {
+            this.Action = false;
+        }
+    
+        public int College_Id { get; set; }
+        public bool Action { get; set; }
         public string Commentaire { get; set; }
     
         public virtual College College { get; set; }

+ 29 - 0
CD67.FicheCollege.Entity/Annee.cs

@@ -0,0 +1,29 @@
+//------------------------------------------------------------------------------
+// <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 Annee
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Annee()
+        {
+            this.Colleges = new HashSet<College>();
+        }
+    
+        public int Id { get; set; }
+        public string Libelle { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<College> Colleges { get; set; }
+    }
+}

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

@@ -62,6 +62,9 @@
     <Compile Include="ActionCLAS.cs">
       <DependentUpon>EntityModel.tt</DependentUpon>
     </Compile>
+    <Compile Include="Annee.cs">
+      <DependentUpon>EntityModel.tt</DependentUpon>
+    </Compile>
     <Compile Include="College.cs">
       <DependentUpon>EntityModel.tt</DependentUpon>
     </Compile>
@@ -80,9 +83,11 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>EntityModel.edmx</DependentUpon>
     </Compile>
+    <Compile Include="Extend\Annee.cs" />
     <Compile Include="Extend\ActionCLAS.cs" />
     <Compile Include="Extend\College.cs" />
     <Compile Include="Extend\Territoire.cs" />
+    <Compile Include="Extend\Identite.cs" />
     <Compile Include="Extend\TypeCollege.cs" />
     <Compile Include="Identite.cs">
       <DependentUpon>EntityModel.tt</DependentUpon>
@@ -127,6 +132,7 @@
       <DependentUpon>EntityModel.edmx</DependentUpon>
       <LastGenOutput>EntityModel.cs</LastGenOutput>
     </Content>
+    <Content Include="Model_initial_inserts.sql" />
   </ItemGroup>
   <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

+ 4 - 1
CD67.FicheCollege.Entity/College.cs

@@ -14,7 +14,9 @@ namespace CD67.FicheCollege.Entity
     
     public partial class College
     {
-        public string Id { get; set; }
+        public int Id { get; set; }
+        public int Annee_Id { get; set; }
+        public string CodeRne { get; set; }
         public string Libelle { get; set; }
         public string Adresse { get; set; }
         public string Code_Postal { get; set; }
@@ -32,6 +34,7 @@ namespace CD67.FicheCollege.Entity
         public virtual Territoire Territoire { get; set; }
         public virtual TypeCollege TypeCollege { get; set; }
         public virtual Identite Identite { get; set; }
+        public virtual Annee Annee { get; set; }
         public virtual ActionCLAS Actions_CLAS { get; set; }
     }
 }

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

@@ -29,6 +29,7 @@ namespace CD67.FicheCollege.Entity
         public virtual DbSet<Territoire> Territoires { get; set; }
         public virtual DbSet<College> Colleges { get; set; }
         public virtual DbSet<Identite> Identites { get; set; }
+        public virtual DbSet<Annee> Annees { get; set; }
         public virtual DbSet<ActionCLAS> ActionsCLAS { 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_new\CD67.FicheCollege.Entity\EntityModel.edmx'. 
+// La génération de code T4 est activée pour le modèle 'C:\dev\dotnet\FicheCollege\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.

+ 152 - 88
CD67.FicheCollege.Entity/EntityModel.edmx

@@ -4,20 +4,29 @@
   <edmx:Runtime>
     <!-- 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">
+    <Schema Namespace="CD67.FicheCollege.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="Actions-CLAS">
           <Key>
             <PropertyRef Name="College_Id" />
           </Key>
-          <Property Name="College_Id" Type="nvarchar" MaxLength="8" Nullable="false" />
+          <Property Name="College_Id" Type="int" Nullable="false" />
           <Property Name="Action" Type="bit" />
           <Property Name="Commentaire" Type="ntext" />
         </EntityType>
+        <EntityType Name="Annees">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Libelle" Type="nvarchar" MaxLength="12" Nullable="false" />
+        </EntityType>
         <EntityType Name="Colleges">
           <Key>
             <PropertyRef Name="Id" />
           </Key>
-          <Property Name="Id" Type="nvarchar" MaxLength="8" Nullable="false" />
+          <Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Annee_Id" Type="int" Nullable="false" />
+          <Property Name="CodeRne" Type="nvarchar" MaxLength="10" 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" />
@@ -36,7 +45,7 @@
           <Key>
             <PropertyRef Name="College_Id" />
           </Key>
-          <Property Name="College_Id" Type="nvarchar" MaxLength="8" Nullable="false" />
+          <Property Name="College_Id" Type="int" 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" />
@@ -100,6 +109,18 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
+        <Association Name="FK_Annees_Colleges">
+          <End Role="Annees" Type="Self.Annees" Multiplicity="1" />
+          <End Role="Colleges" Type="Self.Colleges" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Annees">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="Colleges">
+              <PropertyRef Name="Annee_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
         <Association Name="FK_Colleges_Territoires">
           <End Role="Territoires" Type="Self.Territoires" Multiplicity="0..1" />
           <End Role="Colleges" Type="Self.Colleges" Multiplicity="*" />
@@ -136,8 +157,9 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
-        <EntityContainer Name="ModeleMVCStoreContainer">
+        <EntityContainer Name="CD67FicheCollegeStoreContainer">
           <EntitySet Name="Actions-CLAS" EntityType="Self.Actions-CLAS" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Annees" EntityType="Self.Annees" Schema="dbo" store:Type="Tables" />
           <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" />
@@ -146,6 +168,10 @@
             <End Role="Colleges" EntitySet="Colleges" />
             <End Role="Actions-CLAS" EntitySet="Actions-CLAS" />
           </AssociationSet>
+          <AssociationSet Name="FK_Annees_Colleges" Association="Self.FK_Annees_Colleges">
+            <End Role="Annees" EntitySet="Annees" />
+            <End Role="Colleges" EntitySet="Colleges" />
+          </AssociationSet>
           <AssociationSet Name="FK_Colleges_Territoires" Association="Self.FK_Colleges_Territoires">
             <End Role="Territoires" EntitySet="Territoires" />
             <End Role="Colleges" EntitySet="Colleges" />
@@ -180,6 +206,11 @@
             <End Role="College" EntitySet="Colleges" />
             <End Role="Identite" EntitySet="Identites" />
           </AssociationSet>
+          <EntitySet Name="Annees" EntityType="CD67.FicheCollege.Annee" />
+          <AssociationSet Name="AnneeCollege" Association="CD67.FicheCollege.AnneeCollege">
+            <End Role="Annee" EntitySet="Annees" />
+            <End Role="College" EntitySet="Colleges" />
+          </AssociationSet>
           <EntitySet Name="ActionsCLAS" EntityType="CD67.FicheCollege.ActionCLAS" />
           <AssociationSet Name="FK_Actions_CLAS_College" Association="CD67.FicheCollege.FK_Actions_CLAS_College">
             <End Role="College" EntitySet="Colleges" />
@@ -214,7 +245,9 @@
           <Key>
             <PropertyRef Name="Id" />
           </Key>
-          <Property Name="Id" Type="String" Nullable="false" MaxLength="8" FixedLength="false" Unicode="true" />
+          <Property Name="Id" Type="Int32" Nullable="false" />
+          <Property Name="Annee_Id" Type="Int32" Nullable="false" />
+          <Property Name="CodeRne" 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="Adresse" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
           <Property Name="Code_Postal" Type="String" MaxLength="5" FixedLength="false" Unicode="true" />
@@ -231,6 +264,7 @@
           <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" />
+          <NavigationProperty Name="Annee" Relationship="CD67.FicheCollege.AnneeCollege" FromRole="College" ToRole="Annee" />
           <NavigationProperty Name="Actions_CLAS" Relationship="CD67.FicheCollege.FK_Actions_CLAS_College" FromRole="College" ToRole="Actions_CLAS" />
         </EntityType>
         <Association Name="FK_Colleges_Territoires">
@@ -261,7 +295,7 @@
           <Key>
             <PropertyRef Name="College_Id" />
           </Key>
-          <Property Name="College_Id" Type="String" Nullable="false" MaxLength="8" FixedLength="false" Unicode="true" />
+          <Property Name="College_Id" Type="Int32" Nullable="false" />
           <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" />
@@ -304,12 +338,32 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
+        <EntityType Name="Annee">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <NavigationProperty Name="Colleges" Relationship="CD67.FicheCollege.AnneeCollege" FromRole="Annee" ToRole="College" />
+          <Property Name="Libelle" Type="String" Nullable="false" MaxLength="12" FixedLength="false" Unicode="true" />
+        </EntityType>
+        <Association Name="AnneeCollege">
+          <End Type="CD67.FicheCollege.Annee" Role="Annee" Multiplicity="1" />
+          <End Type="CD67.FicheCollege.College" Role="College" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Annee">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="College">
+              <PropertyRef Name="Annee_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
         <EntityType Name="ActionCLAS">
           <Key>
             <PropertyRef Name="College_Id" />
           </Key>
-          <Property Name="College_Id" Type="String" Nullable="false" MaxLength="8" FixedLength="false" Unicode="true" />
-          <Property Name="Action" Type="Boolean" />
+          <Property Name="College_Id" Type="Int32" Nullable="false" />
+          <Property Name="Action" Type="Boolean" Nullable="false" DefaultValue="false" />
           <Property Name="Commentaire" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
           <NavigationProperty Name="College" Relationship="CD67.FicheCollege.FK_Actions_CLAS_College" FromRole="Actions_CLAS" ToRole="College" />
         </EntityType>
@@ -330,86 +384,96 @@
     <!-- 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" />
-                <ScalarProperty Name="Referent_Nom" ColumnName="Referent_Nom" />
-                <ScalarProperty Name="Referent_SID" ColumnName="Referent_SID" />
-                <ScalarProperty Name="Libelle" ColumnName="Libelle" />
+  <EntityContainerMapping StorageEntityContainer="CD67FicheCollegeStoreContainer" CdmEntityContainer="Entities">
+    <EntitySetMapping Name="TypesCollege">
+      <EntityTypeMapping TypeName="IsTypeOf(CD67.FicheCollege.TypeCollege)">
+        <MappingFragment StoreEntitySet="TypesCollege">
+          <ScalarProperty Name="Id" ColumnName="Id" />
+          <ScalarProperty Name="Libelle" ColumnName="Libelle" />
+          <ScalarProperty Name="Ordre" ColumnName="Ordre" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Territoires">
+      <EntityTypeMapping TypeName="IsTypeOf(CD67.FicheCollege.Territoire)">
+        <MappingFragment StoreEntitySet="Territoires">
+          <ScalarProperty Name="Id" ColumnName="Id" />
+          <ScalarProperty Name="Libelle" ColumnName="Libelle" />
+          <ScalarProperty Name="Referent_SID" ColumnName="Referent_SID" />
+          <ScalarProperty Name="Referent_Nom" ColumnName="Referent_Nom" />
+          <ScalarProperty Name="Referent_Prenom" ColumnName="Referent_Prenom" />
+          <ScalarProperty Name="Referent_Structure" ColumnName="Referent_Structure" />
+          <ScalarProperty Name="Referent_Login" ColumnName="Referent_Login" />
+          <ScalarProperty Name="Referent_Email" ColumnName="Referent_Email" />
+          <ScalarProperty Name="Ordre" ColumnName="Ordre" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Colleges">
+      <EntityTypeMapping TypeName="IsTypeOf(CD67.FicheCollege.College)">
+        <MappingFragment StoreEntitySet="Colleges">
+          <ScalarProperty Name="CodeRne" ColumnName="CodeRne" />
                 <ScalarProperty Name="Id" ColumnName="Id" />
-              </MappingFragment>
-            </EntityTypeMapping>
-          </EntitySetMapping>
-          <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="Libelle" ColumnName="Libelle" />
+          <ScalarProperty Name="Adresse" ColumnName="Adresse" />
+          <ScalarProperty Name="Code_Postal" ColumnName="Code_Postal" />
+          <ScalarProperty Name="TypeCollege_Id" ColumnName="TypeCollege_Id" />
+          <ScalarProperty Name="Commune_Insee" ColumnName="Commune_Insee" />
+          <ScalarProperty Name="Commune" ColumnName="Commune" />
+          <ScalarProperty Name="Canton" ColumnName="Canton" />
+          <ScalarProperty Name="Territoire_Id" ColumnName="Territoire_Id" />
+          <ScalarProperty Name="TAD" ColumnName="TAD" />
+          <ScalarProperty Name="CDC" ColumnName="CDC" />
+          <ScalarProperty Name="Tel" ColumnName="Tel" />
+          <ScalarProperty Name="Fax" ColumnName="Fax" />
+          <ScalarProperty Name="Email" ColumnName="Email" />
+          <ScalarProperty Name="Annee_Id" ColumnName="Annee_Id" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Identites">
+      <EntityTypeMapping TypeName="IsTypeOf(CD67.FicheCollege.Identite)">
+        <MappingFragment StoreEntitySet="Identites">
+          <ScalarProperty Name="College_Id" ColumnName="College_Id" />
+          <ScalarProperty Name="Principal_SID" ColumnName="Principal_SID" />
+          <ScalarProperty Name="Principal_Login" ColumnName="Principal_Login" />
+          <ScalarProperty Name="Principal_Nom" ColumnName="Principal_Nom" />
+          <ScalarProperty Name="Principal_Prenom" ColumnName="Principal_Prenom" />
+          <ScalarProperty Name="Principal_Email" ColumnName="Principal_Email" />
+          <ScalarProperty Name="Principal_Tel" ColumnName="Principal_Tel" />
+          <ScalarProperty Name="Principal_Structure" ColumnName="Principal_Structure" />
+          <ScalarProperty Name="Adjoint_SID" ColumnName="Adjoint_SID" />
+          <ScalarProperty Name="Adjoint_Login" ColumnName="Adjoint_Login" />
+          <ScalarProperty Name="Adjoint_Nom" ColumnName="Adjoint_Nom" />
+          <ScalarProperty Name="Adjoint_Prenom" ColumnName="Adjoint_Prenom" />
+          <ScalarProperty Name="Adjoint_Email" ColumnName="Adjoint_Email" />
+          <ScalarProperty Name="Adjoint_Tel" ColumnName="Adjoint_Tel" />
+          <ScalarProperty Name="Adjoint_Structure" ColumnName="Adjoint_Structure" />
+          <ScalarProperty Name="Gestionnaire_SID" ColumnName="Gestionnaire_SID" />
+          <ScalarProperty Name="Gestionnaire_Login" ColumnName="Gestionnaire_Login" />
+          <ScalarProperty Name="Gestionnaire_Nom" ColumnName="Gestionnaire_Nom" />
+          <ScalarProperty Name="Gestionnaire_Prenom" ColumnName="Gestionnaire_Prenom" />
+          <ScalarProperty Name="Gestionnaire_Email" ColumnName="Gestionnaire_Email" />
+          <ScalarProperty Name="Gestionnaire_Tel" ColumnName="Gestionnaire_Tel" />
+          <ScalarProperty Name="Gestionnaire_Structure" ColumnName="Gestionnaire_Structure" />
+          <ScalarProperty Name="Gestionnaire2_SID" ColumnName="Gestionnaire2_SID" />
+          <ScalarProperty Name="Gestionnaire2_Login" ColumnName="Gestionnaire2_Login" />
+          <ScalarProperty Name="Gestionnaire2_Nom" ColumnName="Gestionnaire2_Nom" />
+          <ScalarProperty Name="Gestionnaire2_Prenom" ColumnName="Gestionnaire2_Prenom" />
+          <ScalarProperty Name="Gestionnaire2_Email" ColumnName="Gestionnaire2_Email" />
+          <ScalarProperty Name="Gestionnaire2_Tel" ColumnName="Gestionnaire2_Tel" />
+          <ScalarProperty Name="Gestionnaire2_Structure" ColumnName="Gestionnaire2_Structure" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Annees">
+      <EntityTypeMapping TypeName="IsTypeOf(CD67.FicheCollege.Annee)">
+        <MappingFragment StoreEntitySet="Annees">
+          <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>
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
           <EntitySetMapping Name="ActionsCLAS">
             <EntityTypeMapping TypeName="CD67.FicheCollege.ActionCLAS">
               <MappingFragment StoreEntitySet="Actions-CLAS">
@@ -419,7 +483,7 @@
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
-        </EntityContainerMapping>
+  </EntityContainerMapping>
 </Mapping></edmx:Mappings>
   </edmx:Runtime>
   <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->

+ 7 - 5
CD67.FicheCollege.Entity/EntityModel.edmx.diagram

@@ -5,14 +5,16 @@
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
       <Diagram DiagramId="86b727c7572a49c5b7e8139c8d489465" Name="Diagram1">
-        <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" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.TypeCollege" Width="1.5" PointX="0.625" PointY="2.25" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.Territoire" Width="1.5" PointX="0.75" PointY="4.375" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.College" Width="1.75" PointX="3" PointY="2.625" />
         <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" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.Identite" Width="1.875" PointX="5.5" PointY="3.875" />
         <AssociationConnector Association="CD67.FicheCollege.FK_FicheIdentite_College" />
-        <EntityTypeShape EntityType="CD67.FicheCollege.ActionCLAS" Width="1.5" PointX="7.5" PointY="1.125" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.Annee" Width="1.5" PointX="3" PointY="0.5" />
+        <AssociationConnector Association="CD67.FicheCollege.AnneeCollege" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.ActionCLAS" Width="1.5" PointX="6.125" PointY="1.125" />
         <AssociationConnector Association="CD67.FicheCollege.FK_Actions_CLAS_College" />
         </Diagram>
     </edmx:Diagrams>

+ 197 - 36
CD67.FicheCollege.Entity/EntityModel.edmx.sql

@@ -2,13 +2,13 @@
 -- --------------------------------------------------
 -- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
 -- --------------------------------------------------
--- Date Created: 08/22/2017 15:00:11
--- Generated from EDMX file: C:\dev\dotnet\ModeleMVC\CD67.FicheCollege.Entity\EntityModel.edmx
+-- Date Created: 02/01/2018 10:35:41
+-- Generated from EDMX file: C:\dev\dotnet\FicheCollege\CD67.FicheCollege.Entity\EntityModel.edmx
 -- --------------------------------------------------
 
 SET QUOTED_IDENTIFIER OFF;
 GO
-USE [ModeleMVC];
+USE [FicheCollege];
 GO
 IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
 GO
@@ -17,42 +17,131 @@ GO
 -- Dropping existing FOREIGN KEY constraints
 -- --------------------------------------------------
 
-IF OBJECT_ID(N'[dbo].[FK_TypesVikingVikings]', 'F') IS NOT NULL
-    ALTER TABLE [dbo].[Vikings] DROP CONSTRAINT [FK_TypesVikingVikings];
+IF OBJECT_ID(N'[dbo].[FK_Actions-CLAS_College]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[Actions-CLAS] DROP CONSTRAINT [FK_Actions-CLAS_College];
+GO
+IF OBJECT_ID(N'[dbo].[FK_Colleges_Territoires]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[Colleges] DROP CONSTRAINT [FK_Colleges_Territoires];
+GO
+IF OBJECT_ID(N'[dbo].[FK_Colleges_TypesCollege]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[Colleges] DROP CONSTRAINT [FK_Colleges_TypesCollege];
+GO
+IF OBJECT_ID(N'[dbo].[FK_FicheIdentite_College]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[Identites] DROP CONSTRAINT [FK_FicheIdentite_College];
 GO
 
 -- --------------------------------------------------
 -- Dropping existing tables
 -- --------------------------------------------------
 
-IF OBJECT_ID(N'[dbo].[TypesViking]', 'U') IS NOT NULL
-    DROP TABLE [dbo].[TypesViking];
+IF OBJECT_ID(N'[dbo].[Actions-CLAS]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Actions-CLAS];
+GO
+IF OBJECT_ID(N'[dbo].[Colleges]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Colleges];
+GO
+IF OBJECT_ID(N'[dbo].[Identites]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Identites];
+GO
+IF OBJECT_ID(N'[dbo].[Territoires]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Territoires];
 GO
-IF OBJECT_ID(N'[dbo].[Vikings]', 'U') IS NOT NULL
-    DROP TABLE [dbo].[Vikings];
+IF OBJECT_ID(N'[dbo].[TypesCollege]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[TypesCollege];
 GO
 
 -- --------------------------------------------------
 -- Creating all tables
 -- --------------------------------------------------
 
--- Creating table 'TypesViking'
-CREATE TABLE [dbo].[TypesViking] (
+-- Creating table 'TypesCollege'
+CREATE TABLE [dbo].[TypesCollege] (
     [Id] int IDENTITY(1,1) NOT NULL,
-    [Libelle] nvarchar(100)  NOT NULL
+    [Libelle] nvarchar(255)  NOT NULL,
+    [Ordre] int  NOT NULL
+);
+GO
+
+-- Creating table 'Territoires'
+CREATE TABLE [dbo].[Territoires] (
+    [Id] nvarchar(10)  NOT NULL,
+    [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
+);
+GO
+
+-- Creating table 'Colleges'
+CREATE TABLE [dbo].[Colleges] (
+    [Id] nvarchar(8)  NOT NULL,
+    [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,
+    [Annee_Id] int  NOT NULL
 );
 GO
 
--- Creating table 'Vikings'
-CREATE TABLE [dbo].[Vikings] (
+-- Creating table 'Identites'
+CREATE TABLE [dbo].[Identites] (
+    [College_Id] nvarchar(8)  NOT NULL,
+    [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
+);
+GO
+
+-- Creating table 'ActionsCLAS'
+CREATE TABLE [dbo].[ActionsCLAS] (
+    [College_Id] nvarchar(8)  NOT NULL,
+    [Action] bit  NULL,
+    [Commentaire] nvarchar(max)  NULL
+);
+GO
+
+-- Creating table 'Annees'
+CREATE TABLE [dbo].[Annees] (
     [Id] int IDENTITY(1,1) NOT NULL,
-    [Nom] nvarchar(100)  NOT NULL,
-    [CasqueCornu] bit  NOT NULL,
-    [NombreVictoires] int  NULL,
-    [Description] nvarchar(max)  NULL,
-    [DateCreation] datetime  NOT NULL,
-    [DateEdition] datetime  NOT NULL,
-    [TypeVikingId] int  NOT NULL
+    [libelle] nvarchar(max)  NOT NULL
 );
 GO
 
@@ -60,15 +149,39 @@ GO
 -- Creating all PRIMARY KEY constraints
 -- --------------------------------------------------
 
--- Creating primary key on [Id] in table 'TypesViking'
-ALTER TABLE [dbo].[TypesViking]
-ADD CONSTRAINT [PK_TypesViking]
+-- Creating primary key on [Id] in table 'TypesCollege'
+ALTER TABLE [dbo].[TypesCollege]
+ADD CONSTRAINT [PK_TypesCollege]
+    PRIMARY KEY CLUSTERED ([Id] ASC);
+GO
+
+-- Creating primary key on [Id] in table 'Territoires'
+ALTER TABLE [dbo].[Territoires]
+ADD CONSTRAINT [PK_Territoires]
+    PRIMARY KEY CLUSTERED ([Id] ASC);
+GO
+
+-- Creating primary key on [Id] in table 'Colleges'
+ALTER TABLE [dbo].[Colleges]
+ADD CONSTRAINT [PK_Colleges]
     PRIMARY KEY CLUSTERED ([Id] ASC);
 GO
 
--- Creating primary key on [Id] in table 'Vikings'
-ALTER TABLE [dbo].[Vikings]
-ADD CONSTRAINT [PK_Vikings]
+-- Creating primary key on [College_Id] in table 'Identites'
+ALTER TABLE [dbo].[Identites]
+ADD CONSTRAINT [PK_Identites]
+    PRIMARY KEY CLUSTERED ([College_Id] ASC);
+GO
+
+-- Creating primary key on [College_Id] in table 'ActionsCLAS'
+ALTER TABLE [dbo].[ActionsCLAS]
+ADD CONSTRAINT [PK_ActionsCLAS]
+    PRIMARY KEY CLUSTERED ([College_Id] ASC);
+GO
+
+-- Creating primary key on [Id] in table 'Annees'
+ALTER TABLE [dbo].[Annees]
+ADD CONSTRAINT [PK_Annees]
     PRIMARY KEY CLUSTERED ([Id] ASC);
 GO
 
@@ -76,19 +189,67 @@ GO
 -- Creating all FOREIGN KEY constraints
 -- --------------------------------------------------
 
--- Creating foreign key on [TypeVikingId] in table 'Vikings'
-ALTER TABLE [dbo].[Vikings]
-ADD CONSTRAINT [FK_TypeVikingViking]
-    FOREIGN KEY ([TypeVikingId])
-    REFERENCES [dbo].[TypesViking]
+-- Creating foreign key on [Territoire_Id] in table 'Colleges'
+ALTER TABLE [dbo].[Colleges]
+ADD CONSTRAINT [FK_Colleges_Territoires]
+    FOREIGN KEY ([Territoire_Id])
+    REFERENCES [dbo].[Territoires]
+        ([Id])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK_Colleges_Territoires'
+CREATE INDEX [IX_FK_Colleges_Territoires]
+ON [dbo].[Colleges]
+    ([Territoire_Id]);
+GO
+
+-- Creating foreign key on [TypeCollege_Id] in table 'Colleges'
+ALTER TABLE [dbo].[Colleges]
+ADD CONSTRAINT [FK_Colleges_TypesCollege]
+    FOREIGN KEY ([TypeCollege_Id])
+    REFERENCES [dbo].[TypesCollege]
+        ([Id])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK_Colleges_TypesCollege'
+CREATE INDEX [IX_FK_Colleges_TypesCollege]
+ON [dbo].[Colleges]
+    ([TypeCollege_Id]);
+GO
+
+-- Creating foreign key on [College_Id] in table 'Identites'
+ALTER TABLE [dbo].[Identites]
+ADD CONSTRAINT [FK_FicheIdentite_College]
+    FOREIGN KEY ([College_Id])
+    REFERENCES [dbo].[Colleges]
+        ([Id])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating foreign key on [College_Id] in table 'ActionsCLAS'
+ALTER TABLE [dbo].[ActionsCLAS]
+ADD CONSTRAINT [FK_Actions_CLAS_College]
+    FOREIGN KEY ([College_Id])
+    REFERENCES [dbo].[Colleges]
+        ([Id])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating foreign key on [Annee_Id] in table 'Colleges'
+ALTER TABLE [dbo].[Colleges]
+ADD CONSTRAINT [FK_AnneeCollege]
+    FOREIGN KEY ([Annee_Id])
+    REFERENCES [dbo].[Annees]
         ([Id])
     ON DELETE NO ACTION ON UPDATE NO ACTION;
 GO
 
--- Creating non-clustered index for FOREIGN KEY 'FK_TypeVikingViking'
-CREATE INDEX [IX_FK_TypeVikingViking]
-ON [dbo].[Vikings]
-    ([TypeVikingId]);
+-- Creating non-clustered index for FOREIGN KEY 'FK_AnneeCollege'
+CREATE INDEX [IX_FK_AnneeCollege]
+ON [dbo].[Colleges]
+    ([Annee_Id]);
 GO
 
 -- --------------------------------------------------

+ 4 - 2
CD67.FicheCollege.Entity/Extend/ActionCLAS.cs

@@ -13,6 +13,7 @@ namespace CD67.FicheCollege.Entity
     [MetadataType(typeof(ActionCLAS_Metadata))]
     public partial class ActionCLAS
     {
+        public int Id { get { return College_Id; } }
     }
 
     /// <summary>
@@ -20,8 +21,9 @@ namespace CD67.FicheCollege.Entity
     /// </summary>
     public class ActionCLAS_Metadata
     {
-        [UIHint("YesNoBool")]
-        public Nullable<bool> Action { get; set; }
+        //[UIHint("YesNoBool")]
+        public bool? Action { get; set; }
+
         [DataType(DataType.MultilineText)]
         public string Commentaire { get; set; }
     }

+ 21 - 0
CD67.FicheCollege.Entity/Extend/Annee.cs

@@ -0,0 +1,21 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+
+namespace CD67.FicheCollege.Entity
+{
+    /// <summary>
+    /// Classe d'extension de celle d'Entity, nécessaire pour y associer les Metadata
+    /// </summary>
+    [MetadataType(typeof(Annee_Metadata))]
+    public partial class Annee
+    {
+    }
+
+    /// <summary>
+    /// Classe contenant les DataAnnotations pour chaque champ
+    /// </summary>
+    public class Annee_Metadata
+    {
+    }
+}

+ 6 - 8
CD67.FicheCollege.Entity/Extend/College.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.ComponentModel.DataAnnotations;
 
 namespace CD67.FicheCollege.Entity
 {
@@ -22,9 +17,13 @@ namespace CD67.FicheCollege.Entity
     public class College_Metadata
     {
         [Required]
-        [Display(Name = "Code RNE du collège")]
         public string Id { get; set; }
         [Required]
+        [Display(Name = "Code RNE du collège")]
+        public string CodeRne { get; set; }
+        [Display(Name = "Année scolaire")]
+        public string Annee_Id { get; set; }
+        [Required]
         [Display(Name = "Collège")]
         public string Libelle { get; set; }
         [Display(Name = "Code postal")]
@@ -35,6 +34,5 @@ namespace CD67.FicheCollege.Entity
         public string Territoire_Id { get; set; }
         [Display(Name = "Canton de rattachement")]
         public string Canton { get; set; }
-
     }
 }

+ 25 - 0
CD67.FicheCollege.Entity/Extend/Identite.cs

@@ -0,0 +1,25 @@
+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(Identite_Metadata))]
+    public partial class Identite
+    {
+        public int Id { get { return College_Id; } }
+    }
+
+    /// <summary>
+    /// Classe contenant les DataAnnotations pour chaque champ
+    /// </summary>
+    public class Identite_Metadata
+    {
+    }
+}

+ 1 - 1
CD67.FicheCollege.Entity/Identite.cs

@@ -14,7 +14,7 @@ namespace CD67.FicheCollege.Entity
     
     public partial class Identite
     {
-        public string College_Id { get; set; }
+        public int College_Id { get; set; }
         public string Principal_SID { get; set; }
         public string Principal_Login { get; set; }
         public string Principal_Nom { get; set; }

+ 137 - 0
CD67.FicheCollege.Entity/Model_initial_inserts.sql

@@ -0,0 +1,137 @@
+USE [FicheCollege]
+
+DELETE FROM [Actions-CLAS];
+DELETE FROM Identites;
+DELETE FROM Colleges;
+
+DELETE FROM Annees;
+DELETE FROM Territoires;
+DELETE FROM TypesCollege;
+
+IF EXISTS (SELECT * FROM sys.identity_columns WHERE OBJECT_NAME(OBJECT_ID) = 'Colleges' AND last_value IS NOT NULL) 
+	DBCC CHECKIDENT(Colleges, RESEED,-1)
+ELSE
+	DBCC CHECKIDENT(Colleges, RESEED,0)
+
+IF EXISTS (SELECT * FROM sys.identity_columns WHERE OBJECT_NAME(OBJECT_ID) = 'Annees' AND last_value IS NOT NULL) 
+	DBCC CHECKIDENT(Annees, RESEED,-1)
+ELSE
+	DBCC CHECKIDENT(Annees, RESEED,0)
+
+IF EXISTS (SELECT * FROM sys.identity_columns WHERE OBJECT_NAME(OBJECT_ID) = 'TypesCollege' AND last_value IS NOT NULL) 
+	DBCC CHECKIDENT(TypesCollege, RESEED,-1)
+ELSE
+	DBCC CHECKIDENT(TypesCollege, RESEED,0)
+
+
+INSERT INTO TypesCollege(Libelle, Ordre)
+VALUES  ('Collège Publique',1), 
+		('Collège Privé',2),
+		('Cité Scolaire',3);
+
+INSERT INTO Territoires(Id, Libelle, Ordre)
+VALUES	('TE', 'Territoire Eurométropole',1),
+		('TO', 'Territoire Ouest',2), 
+		('TS', 'Territoire Sud',3), 
+		('TN', 'Territoire Nord',4);
+
+INSERT INTO Annees(Libelle) 
+VALUES ('2000-2001'),
+		('2001-2002'),
+		('2002-2003'),
+		('2003-2004'),
+		('2004-2005'),
+		('2005-2006'),
+		('2006-2007'),
+		('2007-2008'),
+		('2008-2009'),
+		('2009-2010'),
+		('2010-2011'),
+		('2011-2012'),
+		('2012-2013'),
+		('2013-2014'),
+		('2014-2015'),
+		('2015-2016'),
+		('2016-2017'),
+		('2017-2018'),
+		('2018-2019'),
+		('2019-2020'),
+		('2020-2021'),
+		('2021-2022'),
+		('2022-2023'),
+		('2023-2024'),
+		('2024-2025'),
+		('2025-2026'),
+		('2026-2027'),
+		('2027-2028'),
+		('2028-2029'),
+		('2029-2030'),
+		('2030-2031'),
+		('2031-2032'),
+		('2032-2033'),
+		('2033-2034'),
+		('2034-2035'),
+		('2035-2036'),
+		('2036-2037'),
+		('2037-2038'),
+		('2038-2039'),
+		('2039-2040'),
+		('2040-2041'),
+		('2041-2042'),
+		('2042-2043'),
+		('2043-2044'),
+		('2044-2045'),
+		('2045-2046'),
+		('2046-2047'),
+		('2047-2048'),
+		('2048-2049'),
+		('2049-2050'),
+		('2050-2051'),
+		('2051-2052'),
+		('2052-2053'),
+		('2053-2054'),
+		('2054-2055'),
+		('2055-2056'),
+		('2056-2057'),
+		('2057-2058'),
+		('2058-2059'),
+		('2059-2060'),
+		('2060-2061'),
+		('2061-2062'),
+		('2062-2063'),
+		('2063-2064'),
+		('2064-2065'),
+		('2065-2066'),
+		('2066-2067'),
+		('2067-2068'),
+		('2068-2069'),
+		('2069-2070'),
+		('2070-2071'),
+		('2071-2072'),
+		('2072-2073'),
+		('2073-2074'),
+		('2074-2075'),
+		('2075-2076'),
+		('2076-2077'),
+		('2077-2078'),
+		('2078-2079'),
+		('2079-2080'),
+		('2080-2081'),
+		('2081-2082'),
+		('2082-2083'),
+		('2083-2084'),
+		('2084-2085'),
+		('2085-2086'),
+		('2086-2087'),
+		('2087-2088'),
+		('2088-2089'),
+		('2089-2090'),
+		('2090-2091'),
+		('2091-2092'),
+		('2092-2093'),
+		('2093-2094'),
+		('2094-2095'),
+		('2095-2096'),
+		('2096-2097'),
+		('2097-2098'),
+		('2098-2099');

+ 4 - 4
CD67.FicheCollege.Factory/ActionCLASFactory.cs

@@ -7,15 +7,15 @@ using System.Data.Entity;
 
 namespace CD67.FicheCollege.Factory
 {
-    public partial class ActionCLASFactory : Internal.BaseFactory<Entity.ActionCLAS>
+    public partial class ActionCLASFactory : Internal.BaseFactory<ActionCLAS>
     {
-        public override Entity.ActionCLAS getById(params object[] keyValues)
+        public override ActionCLAS getById(params object[] keyValues)
         {
             //si l'élément n'existe pas, on le créé
-            Entity.ActionCLAS item = base.getById(keyValues);
+            ActionCLAS item = base.getById(keyValues);
             if(item == null)
             {
-                string id = keyValues[0].ToString();
+                int id = (int)keyValues[0];
                 item = new ActionCLAS()
                 {
                     College_Id = id

+ 49 - 0
CD67.FicheCollege.Factory/AnneeFactory.cs

@@ -0,0 +1,49 @@
+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 AnneeFactory : Internal.BaseFactory<Entity.Annee>
+    {
+        //public AnneeFactory(Entities dbContext) : base(dbContext) { }
+
+        public Annee getByLibelle(params object[] keyValues)
+        {
+            string libelle = keyValues[0].ToString();
+            
+            Annee annee = base.getAll().Where(a=>a.Libelle == libelle).First();
+            //si l'élément n'existe pas, on le créé
+            if (annee == null)
+            {
+                annee = new Annee()
+                {
+                    Libelle = libelle
+                };
+                this.add(ref annee);
+                dbContext.Entry(annee).Reference(i => i.Colleges).Load();
+            }
+
+            return annee;
+        }
+
+        // Retourne l'id de l'année courante
+        public int get_current_year_id()
+        {
+            string annee_lib;
+            if (DateTime.Now.Month <= 7)
+            {
+                annee_lib = String.Format("{0}-{1}", DateTime.Now.Year - 1, DateTime.Now.Year);
+            }
+            else
+            {
+                annee_lib = String.Format("{0}-{1}", DateTime.Now.Year, DateTime.Now.Year + 1);
+            }
+            return dbContext.Annees.Where(a => a.Libelle == annee_lib).First().Id;
+        }
+
+    }
+}

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

@@ -54,12 +54,16 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="AnneeFactory.cs" />
     <Compile Include="CollegeFactory.cs" />
     <Compile Include="ActionCLASFactory.cs" />
     <Compile Include="IdentiteFactory.cs" />
     <Compile Include="Internal\ActionCLASFactory.cs">
       <DependentUpon>GenericFactories.tt</DependentUpon>
     </Compile>
+    <Compile Include="Internal\AnneeFactory.cs">
+      <DependentUpon>GenericFactories.tt</DependentUpon>
+    </Compile>
     <Compile Include="Internal\CollegeFactory.cs">
       <DependentUpon>GenericFactories.tt</DependentUpon>
     </Compile>

+ 1 - 1
CD67.FicheCollege.Factory/IdentiteFactory.cs

@@ -15,7 +15,7 @@ namespace CD67.FicheCollege.Factory
             Entity.Identite item = base.getById(keyValues);
             if(item ==null)
             {
-                string id = keyValues[0].ToString();
+                int id = (int)keyValues[0];
                 item = new Identite()
                 {
                     College_Id = id

+ 21 - 0
CD67.FicheCollege.Factory/Internal/AnneeFactory.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 AnneeFactory : Internal.BaseFactory<Entity.Annee>
+	{
+		/// <summary>
+        /// Constructeur public lié au constructeur de base
+        /// </summary>
+        /// <param name="dbContext">Context Entity Framework utilisé dans la classe</param>
+		public AnneeFactory(Entities dbContext) : base(dbContext) { }
+	}
+}
+	

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

@@ -160,6 +160,7 @@
     <Compile Include="Controllers\AdminController.cs" />
     <Compile Include="Controllers\CollegesController.cs" />
     <Compile Include="Controllers\GestionActionsController.cs" />
+    <Compile Include="Controllers\AnneesController.cs" />
     <Compile Include="Controllers\HomeController.cs" />
     <Compile Include="Controllers\IdentitesController.cs" />
     <Compile Include="Controllers\TerritoireController.cs" />
@@ -172,9 +173,12 @@
     <Compile Include="Internal\MvcHtmlHelpers.cs" />
     <Compile Include="Internal\Navigation.cs" />
     <Compile Include="Internal\UtilisateurConnecteFactory.cs" />
+    <Compile Include="Models\ActionClasViewModel.cs" />
+    <Compile Include="Models\IdentiteViewModel.cs" />
     <Compile Include="Models\CollegeViewModel.cs" />
+    <Compile Include="Models\AnneeViewModel.cs" />
     <Compile Include="Models\ContactViewModel.cs" />
-    <Compile Include="Models\ModeAcces.cs" />
+    <Compile Include="Models\BaseViewModel.cs" />
     <Compile Include="Models\UtilisateurConnecte.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Properties\Settings.Designer.cs">
@@ -386,12 +390,14 @@
     <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" />
     <Content Include="Views\ActionsCLAS\Details.cshtml" />
     <Content Include="Views\ActionsCLAS\Edit.cshtml" />
     <Content Include="Views\GestionActions\Index.cshtml" />
+    <Content Include="Views\Annees\Details.cshtml" />
+    <Content Include="Views\Annees\Index.cshtml" />
+    <Content Include="Views\Colleges\Index.cshtml" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="App_Data\" />

+ 14 - 20
CD67.FicheCollege.MVC/Controllers/ActionsCLASController.cs

@@ -8,6 +8,7 @@ using System.Web;
 using System.Web.Mvc;
 using CD67.FicheCollege.Entity;
 using CD67.FicheCollege.Factory;
+using CD67.FicheCollege.MVC.Models;
 
 namespace CD67.FicheCollege.MVC.Controllers
 {
@@ -16,23 +17,25 @@ namespace CD67.FicheCollege.MVC.Controllers
         private Entities db = new Entities();
 
         // GET: ActionCLAS/Details/5
-        public ActionResult Details(string id)
+        public ActionResult Details(int? id)
         {
             if (id == null)
             {
                 return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
             }
             ActionCLASFactory actionClasFactory = new ActionCLASFactory(db);
-            Entity.ActionCLAS actionClas = actionClasFactory.getById(id);
+            ActionCLAS actionClas = actionClasFactory.getById(id);
             if (actionClas == null)
             {
                 return HttpNotFound();
             }
-            return View(GetViewModel(actionClas, Models.ModeAcces.Lecture));
+
+            ActionClasViewModel model = new ActionClasViewModel(actionClas);
+            return View(model);
         }
 
         // GET: ActionCLAS/Edit/5
-        public ActionResult Edit(string id)
+        public ActionResult Edit(int? id)
         {
             if (id == null)
             {
@@ -44,7 +47,8 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return HttpNotFound();
             }
-            return View(GetViewModel(actionClas, Models.ModeAcces.Modification));
+            ActionClasViewModel model = new ActionClasViewModel(actionClas, ModeAcces.Modification);
+            return View(model);
         }
 
         // POST: ActionCLAS/Edit/5
@@ -52,27 +56,17 @@ namespace CD67.FicheCollege.MVC.Controllers
         // plus de détails, voir  http://go.microsoft.com/fwlink/?LinkId=317598.
         [HttpPost]
         [ValidateAntiForgeryToken]
-        public ActionResult Edit(ActionCLAS Contenu)
+        public ActionResult Edit(ActionCLAS actionClas)
         {
             if (ModelState.IsValid)
             {
                 ActionCLASFactory actionClasFactory = new ActionCLASFactory(db);
-                actionClasFactory.update(ref Contenu);
-                return RedirectToAction("Index");
+                actionClasFactory.update(ref actionClas);
+                return RedirectToAction("Details", new { id = actionClas.College_Id });
             }
-            return View(GetViewModel(Contenu, Models.ModeAcces.Modification));
-        }
 
-        private Models.CollegeViewModel GetViewModel(Entity.ActionCLAS entity, Models.ModeAcces Acces)
-        {
-            return new Models.CollegeViewModel()
-            {
-                College_Id = entity.College.Id,
-                College_Libelle = entity.College.Libelle,
-                Contenu = entity,
-                Acces = Acces,
-                Listes = null
-            };
+            ActionClasViewModel model = new ActionClasViewModel(actionClas, ModeAcces.Modification);
+            return View(model);
         }
 
         protected override void Dispose(bool disposing)

+ 79 - 0
CD67.FicheCollege.MVC/Controllers/AnneesController.cs

@@ -0,0 +1,79 @@
+using System.Web.Mvc;
+using System.Net;
+using CD67.FicheCollege.Factory;
+using CD67.FicheCollege.Entity;
+using CD67.FicheCollege.MVC.Models;
+using System.Collections.Generic;
+
+namespace CD67.FicheCollege.MVC.Controllers
+{
+    public class AnneesController : Controller
+    {
+        private Entities db = new Entities();
+
+        // GET: Annees
+        public ActionResult Index()
+        {
+            AnneeFactory fact = new AnneeFactory(db);
+
+            AnneeIndexViewModel model = new AnneeIndexViewModel(fact.getAll());
+            return View(model);
+        }
+
+        // GET: Home
+        public ActionResult Details(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+
+            AnneeFactory anneeFactory = new AnneeFactory(db);
+            Entity.Annee annee = anneeFactory.getById(id);
+            if (annee == null)
+            {
+                return HttpNotFound();
+            }
+
+            AnneeViewModel model = new AnneeViewModel(annee);
+            return View(model);
+        }
+
+        public ActionResult Previous(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+
+            AnneeFactory anneeFactory = new AnneeFactory(db);
+            Entity.Annee annee = anneeFactory.getById(id);
+            if (annee == null)
+            {
+                return HttpNotFound();
+            }
+
+            AnneeViewModel model = new AnneeViewModel(annee);
+            return View(model);
+        }
+
+        public ActionResult Next(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+
+            AnneeFactory anneeFactory = new AnneeFactory(db);
+            Entity.Annee annee = anneeFactory.getById(id);
+            if (annee == null)
+            {
+                return HttpNotFound();
+            }
+
+            AnneeViewModel model = new AnneeViewModel(annee);
+            return View(model);
+        }
+
+    }
+}

+ 65 - 63
CD67.FicheCollege.MVC/Controllers/CollegesController.cs

@@ -1,13 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Data.Entity;
-using System.Linq;
-using System.Net;
-using System.Web;
+using System.Net;
 using System.Web.Mvc;
 using CD67.FicheCollege.Entity;
 using CD67.FicheCollege.Factory;
+using CD67.FicheCollege.MVC.Models;
+using CD67.FicheCollege.MVC.Internal;
 
 namespace CD67.FicheCollege.MVC.Controllers
 {
@@ -15,15 +11,21 @@ namespace CD67.FicheCollege.MVC.Controllers
     {
         private Entities db = new Entities();
 
-        // GET: College
-        public ActionResult Index()
+        // GET: Colleges
+        public ActionResult Index(int? annee_id)
         {
-            CollegeFactory collegeFactory = new CollegeFactory(db);
-            return View(collegeFactory.getAll());
+            if (annee_id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            AnneeFactory fact = new AnneeFactory(db);
+            Annee annee = fact.getById(annee_id);
+            AnneeViewModel model = new AnneeViewModel(annee, ModeAcces.Lecture);
+            return View(model);
         }
 
-        // GET: College/Details/5
-        public ActionResult Details(string id)
+        // GET: Colleges/Details/5
+        public ActionResult Details(int? id)
         {
             if (id == null)
             {
@@ -35,67 +37,84 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return HttpNotFound();
             }
-            return View(GetViewModel(college, Models.ModeAcces.Lecture));
+
+            CollegeViewModel model = new CollegeViewModel(college, db, ModeAcces.Lecture);
+
+            return View(model);
         }
 
-        // GET: College/Create
-        public ActionResult Create()
+        // GET: Colleges/Create
+        public ActionResult Create(int? annee_id)
         {
+            if (annee_id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
             Entity.College college = new Entity.College();
-            return View("Edit", GetViewModel(college, Models.ModeAcces.Creation));
+            college.Annee_Id = annee_id.Value;
+            AnneeFactory fact = new AnneeFactory(db);
+            college.Annee = fact.getById(annee_id);
+
+            CollegeViewModel model = new CollegeViewModel(college, db, ModeAcces.Creation);
+
+            return View("Edit", model);
         }
 
-        // POST: College/Create
+        // POST: Colleges/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, string commentaire)
+        public ActionResult Create(Entity.College college)
         {
             if (ModelState.IsValid)
             {
                 CollegeFactory collegeFactory = new CollegeFactory(db);
-                collegeFactory.add(ref Contenu);
-                return RedirectToAction("Index");
+                collegeFactory.add(ref college);
+                return RedirectToAction("Details", new { id = college.Id });
             }
 
-            return View("Edit", GetViewModel(Contenu, Models.ModeAcces.Creation));
+            CollegeViewModel model = new CollegeViewModel(college, db, ModeAcces.Creation);
+
+            return View("Edit", model);
         }
 
-        // GET: College/Edit/5
-        public ActionResult Edit(string id)
+        // GET: Colleges/Edit/5
+        public ActionResult Edit(int? 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));
+
+            CollegeViewModel model = new CollegeViewModel(college, db, ModeAcces.Modification);
+
+            return View(model);
         }
 
-        // POST: College/Edit/5
+        // POST: Colleges/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)
+        public ActionResult Edit(Entity.College college)
         {
             if (ModelState.IsValid)
             {
                 CollegeFactory collegeFactory = new CollegeFactory(db);
-                collegeFactory.update(ref Contenu);
-                return RedirectToAction("Details", new { Id = Contenu.Id });
+                collegeFactory.update(ref college);
+                return RedirectToAction("Details", new { Id = college.Id });
             }
-            return View(GetViewModel(Contenu, Models.ModeAcces.Modification));
+
+            CollegeViewModel model = new CollegeViewModel(college, db, ModeAcces.Modification);
+
+            return View(model);
         }
 
         // GET: College/Delete/5
-        public ActionResult Delete(string id)
+        public ActionResult Delete(int? id)
         {
             if (id == null)
             {
@@ -107,43 +126,26 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return HttpNotFound();
             }
-            return View("Details", GetViewModel(college, Models.ModeAcces.Suppression));
+
+            CollegeViewModel model = new CollegeViewModel(college, db, ModeAcces.Suppression);
+
+            return View("Details", model);
         }
 
         // POST: College/Delete/5
         [HttpPost, ActionName("Delete")]
         [ValidateAntiForgeryToken]
-        public ActionResult DeleteConfirmed(string id)
+        public ActionResult DeleteConfirmed(int? id)
         {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
             CollegeFactory collegeFactory = new CollegeFactory(db);
             Entity.College college = collegeFactory.getById(id);
+            int annee_id = college.Annee_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
-            };
+            return RedirectToAction("Index", new { annee_id = annee_id });
         }
 
         protected override void Dispose(bool disposing)

+ 11 - 3
CD67.FicheCollege.MVC/Controllers/HomeController.cs

@@ -1,13 +1,21 @@
-using System.Web.Mvc;
+using CD67.FicheCollege.Entity;
+using CD67.FicheCollege.Factory;
+using System;
+using System.Linq;
+using System.Net;
+using System.Web.Mvc;
 
 namespace CD67.FicheCollege.MVC.Controllers
 {
     public class HomeController : Controller
     {
+        private Entities db = new Entities();
+
         // GET: Home
         public ActionResult Index()
         {
-            return View();
+            AnneeFactory fact = new AnneeFactory(db);
+            return RedirectToAction("Details", "Annees", new { id = fact.get_current_year_id() });
         }
     }
-}
+}

+ 15 - 31
CD67.FicheCollege.MVC/Controllers/IdentitesController.cs

@@ -8,6 +8,7 @@ using System.Web;
 using System.Web.Mvc;
 using CD67.FicheCollege.Entity;
 using CD67.FicheCollege.Factory;
+using CD67.FicheCollege.MVC.Models;
 
 namespace CD67.FicheCollege.MVC.Controllers
 {
@@ -16,7 +17,7 @@ namespace CD67.FicheCollege.MVC.Controllers
         private Entities db = new Entities();
 
         // GET: Identite/Details/5
-        public ActionResult Details(string id)
+        public ActionResult Details(int? id)
         {
             if (id == null)
             {
@@ -28,11 +29,14 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return HttpNotFound();
             }
-            return View(GetViewModel(identite, Models.ModeAcces.Lecture));
+
+            IdentiteViewModel model = new IdentiteViewModel(identite);
+
+            return View(model);
         }
 
         // GET: Identite/Edit/5
-        public ActionResult Edit(string id)
+        public ActionResult Edit(int? id)
         {
             if (id == null)
             {
@@ -44,7 +48,9 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return HttpNotFound();
             }
-            return View(GetViewModel(identite, Models.ModeAcces.Modification));
+
+            IdentiteViewModel model = new IdentiteViewModel(identite, ModeAcces.Modification);
+            return View(model);
         }
 
         // POST: Identite/Edit/5
@@ -52,39 +58,17 @@ namespace CD67.FicheCollege.MVC.Controllers
         // plus de détails, voir  http://go.microsoft.com/fwlink/?LinkId=317598.
         [HttpPost]
         [ValidateAntiForgeryToken]
-        public ActionResult Edit(Entity.Identite Contenu)
+        public ActionResult Edit(Entity.Identite identite)
         {
             if (ModelState.IsValid)
             {
                 IdentiteFactory identiteFactory = new IdentiteFactory(db);
-                identiteFactory.update(ref Contenu);
-                return RedirectToAction("Details", new { Id = Contenu.College_Id });
+                identiteFactory.update(ref identite);
+                return RedirectToAction("Details", new { Id = identite.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
-            };
+            IdentiteViewModel model = new IdentiteViewModel(identite, ModeAcces.Modification);
+            return View(model);
         }
 
         protected override void Dispose(bool disposing)

+ 6 - 12
CD67.FicheCollege.MVC/Controllers/TerritoireController.cs

@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Data.Entity;
-using System.Linq;
-using System.Net;
-using System.Web;
+using System.Net;
 using System.Web.Mvc;
 using CD67.FicheCollege.Entity;
 using CD67.FicheCollege.Factory;
@@ -47,7 +41,7 @@ namespace CD67.FicheCollege.MVC.Controllers
         }
 
         // GET: Territoire/Edit/5
-        public ActionResult Edit(string id)
+        public ActionResult Edit(int? id)
         {
             if (id == null)
             {
@@ -79,7 +73,7 @@ namespace CD67.FicheCollege.MVC.Controllers
         }
 
         // GET: Territoire/Delete/5
-        public ActionResult Delete(string id)
+        public ActionResult Delete(int? id)
         {
             if (id == null)
             {
@@ -97,7 +91,7 @@ namespace CD67.FicheCollege.MVC.Controllers
         // POST: Territoire/Delete/5
         [HttpPost, ActionName("Delete")]
         [ValidateAntiForgeryToken]
-        public ActionResult DeleteConfirmed(string id)
+        public ActionResult DeleteConfirmed(int id)
         {
             TerritoireFactory territoireFactory = new TerritoireFactory(db);
             Entity.Territoire territoire = territoireFactory.getById(id);
@@ -105,7 +99,7 @@ namespace CD67.FicheCollege.MVC.Controllers
             return RedirectToAction("Index");
         }
 
-        public ActionResult Up(string id)
+        public ActionResult Up(int? id)
         {
             if (id == null)
             {
@@ -117,7 +111,7 @@ namespace CD67.FicheCollege.MVC.Controllers
             return RedirectToAction("Index");
         }
 
-        public ActionResult Down(string id)
+        public ActionResult Down(int? id)
         {
             if (id == null)
             {

+ 15 - 0
CD67.FicheCollege.MVC/Models/ActionClasViewModel.cs

@@ -0,0 +1,15 @@
+using CD67.FicheCollege.Entity;
+using System.Collections.Generic;
+
+namespace CD67.FicheCollege.MVC.Models
+{
+    public class ActionClasViewModel : BaseViewModel<ActionCLAS>
+    {
+
+        public ActionClasViewModel(ActionCLAS model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
+        {
+        }
+
+        public override string Annee_Lib { get { return Obj.College.Annee.Libelle; } }
+    }
+}

+ 24 - 0
CD67.FicheCollege.MVC/Models/AnneeViewModel.cs

@@ -0,0 +1,24 @@
+using CD67.FicheCollege.Entity;
+using System.Collections.Generic;
+
+namespace CD67.FicheCollege.MVC.Models
+{
+    public class AnneeViewModel : BaseViewModel<Annee>
+    {
+        public AnneeViewModel(Annee model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
+        {
+        }
+
+        public override string Annee_Lib { get { return Obj.Libelle; } }
+    }
+
+    public class AnneeIndexViewModel : BaseViewModel<IEnumerable<Annee>>
+    {
+        public AnneeIndexViewModel(IEnumerable<Annee> model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
+        {
+        }
+
+        public override string Annee_Lib { get { return ""; } }
+
+    }
+}

+ 63 - 0
CD67.FicheCollege.MVC/Models/BaseViewModel.cs

@@ -0,0 +1,63 @@
+using CD67.FicheCollege.Entity;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+
+namespace CD67.FicheCollege.MVC.Models
+{
+    public enum ModeAcces
+    {
+        [Display(Prompt = "Ajouter")]
+        Creation,
+        [Display(Prompt = "Lire")]
+        Lecture,
+        [Display(Prompt = "Modifier")]
+        Modification,
+        [Display(Prompt = "Supprimer")]
+        Suppression
+    }
+
+    // Wrapper du modele qui permet d'emmener des informations supplementaires avec celui-ci.
+    public abstract class BaseViewModel<T>
+    {
+        public T Obj;
+
+        public abstract string Annee_Lib { get; }
+
+        // (Facultatif) Mode d'accès à la page
+        // Defaut: Lecture
+        public ModeAcces Acces { get; set; }
+
+        // (Facultatif) Permet d'emporter d'éventuelles données complémentaires
+        // comme les listes qui serviront entre autre à peupler les listes déroulantes.
+        public Dictionary<string, object> Bag { get; set; } = new Dictionary<string, object>();
+
+        // Utilisateur courant
+        public UtilisateurConnecte User;
+
+        // ***************************
+        // Constructeurs de base
+        public BaseViewModel(T model,
+            ModeAcces acces = ModeAcces.Lecture,
+            Dictionary<string, object> bag = null)
+        {
+            Obj = model;
+            Acces = acces;
+            if (bag != null)
+                Bag = bag;
+            User = Internal.UtilisateurConnecteFactory.getUtilisateurConnecte();
+        }
+
+        public BaseViewModel(T model,
+            Entities dbContext,
+            ModeAcces acces = ModeAcces.Lecture,
+            Dictionary<string, object> bag = null)
+        {
+            Obj = model;
+            Acces = acces;
+            if (bag != null)
+                Bag = bag;
+            User = Internal.UtilisateurConnecteFactory.getUtilisateurConnecte();
+        }
+
+    }
+}

+ 19 - 9
CD67.FicheCollege.MVC/Models/CollegeViewModel.cs

@@ -1,17 +1,27 @@
-using System;
+using CD67.FicheCollege.Entity;
+using CD67.FicheCollege.Factory;
+using CD67.FicheCollege.MVC.Internal;
 using System.Collections.Generic;
-using System.Linq;
-using System.Web;
 using System.Web.Mvc;
 
 namespace CD67.FicheCollege.MVC.Models
 {
-    public class CollegeViewModel
+    public class CollegeViewModel : BaseViewModel<College>
     {
-        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; }
+        public SelectList Sel_TypesCollege;
+        public SelectList Sel_CodesPostaux;
+
+        public CollegeViewModel(College model, Entities dbContext, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
+        {
+            if (acces == ModeAcces.Creation | acces == ModeAcces.Modification)
+            {
+                TypeCollegeFactory fact = new TypeCollegeFactory(dbContext);
+                Sel_TypesCollege = new SelectList(fact.getAll(), "Id", "Libelle", Obj.TypeCollege_Id);
+                Sel_CodesPostaux = new SelectList(Referentiel.GetCodesPostaux(Obj.Commune_Insee), Obj.Code_Postal);
+            }
+        }
+
+        public override string Annee_Lib { get { return Obj.Annee.Libelle; } }
+
     }
 }

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

@@ -27,5 +27,6 @@ namespace CD67.FicheCollege.MVC.Models
             this.Tel = Tel;
             this.Structure = Structure;
         }
+
     }
 }

+ 25 - 0
CD67.FicheCollege.MVC/Models/IdentiteViewModel.cs

@@ -0,0 +1,25 @@
+using CD67.FicheCollege.Entity;
+using System.Collections.Generic;
+
+namespace CD67.FicheCollege.MVC.Models
+{
+    public class IdentiteViewModel : BaseViewModel<Identite>
+    {
+        public List<ContactViewModel> Contacts;
+
+        public IdentiteViewModel(Identite model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
+        {
+            Contacts = new List<ContactViewModel>();
+            if (Obj.Principal_SID != null)
+                Contacts.Add(new ContactViewModel("Principal", Obj.Principal_SID, Obj.Principal_Login, Obj.Principal_Nom, Obj.Principal_Prenom, Obj.Principal_Email, Obj.Principal_Tel, Obj.Principal_Structure));
+            if (Obj.Adjoint_SID != null)
+                Contacts.Add(new ContactViewModel("Principal adjoint", Obj.Adjoint_SID, Obj.Adjoint_Login, Obj.Adjoint_Nom, Obj.Adjoint_Prenom, Obj.Adjoint_Email, Obj.Adjoint_Tel, Obj.Adjoint_Structure));
+            if (Obj.Gestionnaire_SID != null)
+                Contacts.Add(new ContactViewModel("Gestionnaire", Obj.Gestionnaire_SID, Obj.Gestionnaire_Login, Obj.Gestionnaire_Nom, Obj.Gestionnaire_Prenom, Obj.Gestionnaire_Email, Obj.Gestionnaire_Tel, Obj.Gestionnaire_Structure));
+            if (Obj.Gestionnaire2_SID != null)
+                Contacts.Add(new ContactViewModel("Gestionnaire n°2", Obj.Gestionnaire2_SID, Obj.Gestionnaire2_Login, Obj.Gestionnaire2_Nom, Obj.Gestionnaire2_Prenom, Obj.Gestionnaire2_Email, Obj.Gestionnaire2_Tel, Obj.Gestionnaire2_Structure));
+        }
+
+        public override string Annee_Lib { get { return Obj.College.Annee.Libelle; } }
+    }
+}

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

@@ -1,20 +0,0 @@
-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
-    }
-}

+ 8 - 8
CD67.FicheCollege.MVC/Views/ActionsCLAS/Details.cshtml

@@ -1,15 +1,15 @@
 @using CD67.FicheCollege.MVC.Models
-@model CollegeViewModel
+@model ActionClasViewModel
 
 @{
     ViewBag.Title = "Details";
     Layout = "~/Views/Shared/_Layout.cshtml";
-    ActionCLAS contenu = Model.Contenu as ActionCLAS;
+    ActionCLAS actionClas = Model.Obj;
 }
 
 <h1>
     Actions éducatives, sportives et culturelles
-    <br /><span>du @Model.College_Libelle</span>
+    <br /><span>du @actionClas.College.Libelle</span>
 </h1>
 
 <fieldset>
@@ -18,24 +18,24 @@
         @if (Model.Acces == ModeAcces.Lecture)
         {
             <div class="pull-right">
-                @Html.ActionLink("Modifier", "Edit", "ActionsCLAS", new { Id = Model.College_Id }, new { @class = "btn btn-default" })
+                @Html.ActionLink("Modifier", "Edit", "ActionsCLAS", new { Id = actionClas.College_Id }, new { @class = "btn btn-default" })
             </div>
         }
     </legend>
 
     <dl class="dl-horizontal">
         <dt>
-            @Html.DisplayNameFor(model => contenu.Action)
+            @Html.DisplayNameFor(model => actionClas.Action)
         </dt>
 
         <dd>
-            @Html.DisplayFor(model => contenu.Action)
+            @Html.DisplayFor(model => actionClas.Action)
         </dd>
 
         <dt>
-            @Html.DisplayNameFor(model => contenu.Commentaire)
+            @Html.DisplayNameFor(model => actionClas.Commentaire)
         </dt>
 
-        <dd style="white-space: pre-line;">@Html.DisplayFor(model => contenu.Commentaire)</dd>
+        <dd style="white-space: pre-line;">@Html.DisplayFor(model => actionClas.Commentaire)</dd>
     </dl>
 </fieldset>

+ 11 - 11
CD67.FicheCollege.MVC/Views/ActionsCLAS/Edit.cshtml

@@ -1,13 +1,13 @@
 @using CD67.FicheCollege.MVC.Models
-@model CollegeViewModel
+@model ActionClasViewModel
 
 @{
     ViewBag.Title = "Edit";
     Layout = "~/Views/Shared/_Layout.cshtml";
-    ActionCLAS contenu = Model.Contenu as ActionCLAS;
+    ActionCLAS actionClas = Model.Obj;
 }
 
-<h1>@Model.College_Libelle</h1>
+<h1>@actionClas.College.Libelle</h1>
 
 @using (Html.BeginForm())
 {
@@ -19,30 +19,30 @@
         </legend>
         <div class="form-horizontal">
             @Html.ValidationSummary(true, "", new { @class = "text-danger" })
-            @Html.HiddenFor(model => contenu.College_Id)
+            @Html.HiddenFor(model => actionClas.College_Id)
 
             <div class="form-group">
-                @Html.LabelFor(model => contenu.Action, htmlAttributes: new { @class = "control-label col-md-2" })
+                @Html.LabelFor(model => actionClas.Action, htmlAttributes: new { @class = "control-label col-md-2" })
                 <div class="col-md-10">
                     <div class="checkbox">
-                        @Html.EditorFor(model => contenu.Action)
-                        @Html.ValidationMessageFor(model => contenu.Action, "", new { @class = "text-danger" })
+                        @Html.EditorFor(model => actionClas.Action)
+                        @Html.ValidationMessageFor(model => actionClas.Action, "", new { @class = "text-danger" })
                     </div>
                 </div>
             </div>
 
             <div class="form-group">
-                @Html.LabelFor(model => contenu.Commentaire, htmlAttributes: new { @class = "control-label col-md-2" })
+                @Html.LabelFor(model => actionClas.Commentaire, htmlAttributes: new { @class = "control-label col-md-2" })
                 <div class="col-md-10">
-                    @Html.EditorFor(model => contenu.Commentaire, new { htmlAttributes = new { @class = "form-control", @rows = 10 } })
-                    @Html.ValidationMessageFor(model => contenu.Commentaire, "", new { @class = "text-danger" })
+                    @Html.EditorFor(model => actionClas.Commentaire, new { htmlAttributes = new { @class = "form-control", @rows = 10 } })
+                    @Html.ValidationMessageFor(model => actionClas.Commentaire, "", 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" /> |
-                    @Html.ActionLink("Annuler", "Details", new { Id = Model.College_Id })
+                    @Html.ActionLink("Annuler", "Details", new { Id = actionClas.College_Id })
                 </div>
             </div>
         </div>

+ 15 - 0
CD67.FicheCollege.MVC/Views/Annees/Details.cshtml

@@ -0,0 +1,15 @@
+@using CD67.FicheCollege.MVC.Models
+@model AnneeViewModel
+
+<title>Fiches Collèges @Model.Annee_Lib</title>
+
+@{
+    ViewBag.Title = "Fiches Collèges " + @Model.Annee_Lib;
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h1>Accueil @(Model.Obj.Libelle)</h1>
+
+@Html.ActionLink("Les collèges", "Index", "Colleges", new { annee_id = Model.Obj.Id }, null)<br />
+@Html.ActionLink("Les actions éducatives, sportives et culturelles", "Index", "Colleges", new { annee_id = Model.Obj.Id }, null)<br />
+@Html.ActionLink("La page d'administration du site", "Index", "Admin")<br />

+ 17 - 0
CD67.FicheCollege.MVC/Views/Annees/Index.cshtml

@@ -0,0 +1,17 @@
+@using CD67.FicheCollege.MVC.Models
+@model AnneeIndexViewModel
+
+@{
+    ViewBag.Title = "Liste";
+}
+
+<h2>Années scolaires disponibles</h2>
+
+<ul>
+    @foreach (Annee annee in Model.Obj)
+    {
+        <li>
+            @Html.ActionLink(annee.Libelle, "Details", new { id = annee.Id })
+        </li>
+    }
+</ul>

+ 23 - 24
CD67.FicheCollege.MVC/Views/Colleges/Details.cshtml

@@ -4,12 +4,11 @@
 @{
     ViewBag.Title = "Details";
     Layout = "~/Views/Shared/_Layout.cshtml";
-    College contenu = Model.Contenu as College;
+    College college = Model.Obj;
 }
 
 <h1>
-    Informations générales
-    <br /><span>du @Model.College_Libelle</span>
+    Informations générales <br/><span>du @college.Libelle</span>
 </h1>
 
 @if(Model.Acces==ModeAcces.Suppression) {
@@ -25,58 +24,58 @@
         @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" })
+                @Html.ActionLink("Supprimer", "Delete", "Colleges", new { Id = college.Id }, new { @class = "btn btn-danger" })
+                @Html.ActionLink("Modifier", "Edit", "Colleges", new { Id = college.Id }, new { @class = "btn btn-default" })
             </div>
         }
     </legend>
     <dl class="dl-horizontal">
         <dt>
-            @Html.DisplayNameFor(model => contenu.TypeCollege.Libelle)
+            @Html.DisplayNameFor(model => college.TypeCollege.Libelle)
         </dt>
 
         <dd>
-            @Html.DisplayFor(model => contenu.TypeCollege.Libelle)
+            @Html.DisplayFor(model => college.TypeCollege.Libelle)
         </dd>
 
         <dt>
-            @Html.DisplayNameFor(model => contenu.Adresse)
+            @Html.DisplayNameFor(model => college.Adresse)
         </dt>
 
         <dd>
-            @Html.DisplayFor(model => contenu.AdresseComplete)
+            @Html.DisplayFor(model => college.AdresseComplete)
         </dd>
 
         <dt>
-            @Html.DisplayNameFor(model => contenu.Tel)
+            @Html.DisplayNameFor(model => college.Tel)
         </dt>
 
         <dd>
-            @Html.DisplayFor(model => contenu.Tel)
+            @Html.DisplayFor(model => college.Tel)
         </dd>
 
         <dt>
-            @Html.DisplayNameFor(model => contenu.Fax)
+            @Html.DisplayNameFor(model => college.Fax)
         </dt>
 
         <dd>
-            @Html.DisplayFor(model => contenu.Fax)
+            @Html.DisplayFor(model => college.Fax)
         </dd>
 
         <dt>
-            @Html.DisplayNameFor(model => contenu.Email)
+            @Html.DisplayNameFor(model => college.Email)
         </dt>
 
         <dd>
-            @Html.DisplayFor(model => contenu.Email)
+            @Html.DisplayFor(model => college.Email)
         </dd>
 
         <dt>
-            @Html.DisplayNameFor(model => contenu.Commune)
+            @Html.DisplayNameFor(model => college.Commune)
         </dt>
 
         <dd>
-            @if (contenu.Commune != null)
+            @if (college.Commune != null)
             {
                 <div class="col-sm-8 col-md-4">
                     <div class="panel panel-default">
@@ -87,10 +86,10 @@
                             </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 style="white-space: pre-line;"><b>@college.Commune</b>
+                                Canton : @college.Canton
+                                TAD : @college.TAD
+                                CDC : @college.CDC
                             </span>
                         </div>
                     </div>
@@ -99,11 +98,11 @@
         </dd>
 
         <dt>
-            @Html.DisplayNameFor(model => contenu.Code_Postal)
+            @Html.DisplayNameFor(model => college.Code_Postal)
         </dt>
 
         <dd>
-            @Html.DisplayFor(model => contenu.Code_Postal)
+            @Html.DisplayFor(model => college.Code_Postal)
         </dd>
     </dl>
 </fieldset>
@@ -116,7 +115,7 @@
 
         <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 })
+            @Html.ActionLink("Annuler", "Details", new { Id = college.Id })
         </div>
     }
 }

+ 58 - 49
CD67.FicheCollege.MVC/Views/Colleges/Edit.cshtml

@@ -4,79 +4,84 @@
 @{
     ViewBag.Title = Model.Acces.ToString();
     Layout = "~/Views/Shared/_Layout.cshtml";
-    College contenu = Model.Contenu as College;
+    College college = Model.Obj;
 }
 
-<h1>@Model.College_Libelle</h1>
+@if (Model.Acces == ModeAcces.Modification)
+{
+    <h1>@college.Libelle</h1>
+}
+else
+{
+    <h1>Nouveau collège</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)
+                @Html.HiddenFor(model => college.Id)
             }
+            @Html.HiddenFor(model => college.Annee_Id)
+
             <div class="form-group">
-                @Html.LabelFor(model => contenu.Id, htmlAttributes: new { @class = "control-label col-md-2" })
+                @Html.LabelFor(model => college.CodeRne, 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" })
+                    @Html.EditorFor(model => college.CodeRne, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => college.CodeRne, "", new { @class = "text-danger" })
                 </div>
             </div>
 
             <div class="form-group">
-                @Html.LabelFor(model => contenu.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
+                @Html.LabelFor(model => college.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" })
+                    @Html.EditorFor(model => college.Libelle, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => college.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" })
+                @Html.LabelFor(model => college.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" })
+                    @Html.DropDownListFor(model => college.TypeCollege_Id, Model.Sel_TypesCollege, htmlAttributes: new { @class = "form-control" })
+                    @Html.ValidationMessageFor(model => college.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" })
+                @Html.LabelFor(model => college.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" })
+                    @Html.EditorFor(model => college.Adresse, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => college.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" })
+            @Html.HiddenFor(model => college.Commune_Insee, new { data_picker = "commune.insee" })
+            @Html.HiddenFor(model => college.Commune, new { data_picker = "commune.nom" })
+            @Html.HiddenFor(model => college.Canton, new { data_picker = "commune.canton" })
+            @Html.HiddenFor(model => college.Territoire_Id, new { data_picker = "commune.code_tad" })
+            @Html.HiddenFor(model => college.TAD, new { data_picker = "commune.tad" })
+            @Html.HiddenFor(model => college.CDC, new { data_picker = "commune.cdc" })
             <div class="form-group">
-                @Html.LabelFor(model => contenu.Commune, htmlAttributes: new { @class = "control-label col-md-2 required" })
+                @Html.LabelFor(model => college.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 panel-default" id="Commune_Panel" name="Commune_Panel" style="@if (college.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>
@@ -88,48 +93,52 @@
                         </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 >
+                                <b><span data-picker="commune.nom">@college.Commune</span ></b >
+                                <br />Canton : <span data-picker="commune.canton">@college.Canton</span >
+                                <br />TAD : <span data-picker="commune.tad">@college.TAD</span >
+                                <br />CDC : <span data-picker="commune.cdc">@college.CDC</span >
                             </span>
                         </div>
                     </div>
-                    @Html.ValidationMessageFor(model => contenu.Commune, "", new { @class = "text-danger" })
+                    @Html.ValidationMessageFor(model => college.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" })
+                @Html.LabelFor(model => college.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" />
+                    Code(s) postal(aux) associé(s) à la commune 
+                    @if (Model.Sel_CodesPostaux.Count() > 1) {
+                        <span id="CP-warning" class="text-danger">(attention, plusieurs choix possibles)</span>
+                    }
+                     : <input id="code_postaux" data-picker="commune.code_postal" value="@String.Join(",", Model.Sel_CodesPostaux.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" })
+                    @Html.DropDownListFor(model => college.Code_Postal, Model.Sel_CodesPostaux, htmlAttributes: new { @class = "form-control" })
+                    @Html.ValidationMessageFor(model => college.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" })
+                @Html.LabelFor(model => college.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" })
+                    @Html.EditorFor(model => college.Tel, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => college.Tel, "", new { @class = "text-danger" })
                 </div>
             </div>
 
             <div class="form-group">
-                @Html.LabelFor(model => contenu.Fax, htmlAttributes: new { @class = "control-label col-md-2" })
+                @Html.LabelFor(model => college.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" })
+                    @Html.EditorFor(model => college.Fax, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => college.Fax, "", new { @class = "text-danger" })
                 </div>
             </div>
 
             <div class="form-group">
-                @Html.LabelFor(model => contenu.Email, htmlAttributes: new { @class = "control-label col-md-2" })
+                @Html.LabelFor(model => college.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" })
+                    @Html.EditorFor(model => college.Email, new { htmlAttributes = new { @class = "form-control" } })
+                    @Html.ValidationMessageFor(model => college.Email, "", new { @class = "text-danger" })
                 </div>
             </div>
 
@@ -139,7 +148,7 @@
                     @if (Model.Acces == ModeAcces.Creation)
                     { @Html.ActionLink("Annuler", "Index") }
                     else
-                    { @Html.ActionLink("Annuler", "Details", new { Id = Model.College_Id }) }
+                    { @Html.ActionLink("Annuler", "Details", new { Id = college.Id }) }
                 </div>
             </div>
         </div>

+ 23 - 21
CD67.FicheCollege.MVC/Views/Colleges/Index.cshtml

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

+ 6 - 6
CD67.FicheCollege.MVC/Views/Identites/Details.cshtml

@@ -1,15 +1,15 @@
 @using CD67.FicheCollege.MVC.Models
-@model CollegeViewModel
+@model IdentiteViewModel
 
 @{
     ViewBag.Title = "Details";
     Layout = "~/Views/Shared/_Layout.cshtml";
-    List<ContactViewModel> contenu = Model.Contenu as List<ContactViewModel>;
+    Identite identite = Model.Obj;
 }
 
 <h1>
     Indentité
-    <br /><span>du @Model.College_Libelle</span>
+    <br /><span>du @identite.College.Libelle</span>
 </h1>
 
 <fieldset>
@@ -18,19 +18,19 @@
         @if (Model.Acces == ModeAcces.Lecture)
         {
             <div class="pull-right">
-                @Html.ActionLink("Modifier", "Edit", "Identites", new { Id = Model.College_Id }, new { @class = "btn btn-default" })
+                @Html.ActionLink("Modifier", "Edit", "Identites", new { Id = identite.College.Id }, new { @class = "btn btn-default" })
             </div>
         }
     </legend>
 
-    @if (contenu.Count == 0)
+    @if (Model.Contacts.Count == 0)
     {
         <text>Aucun contact défini</text>
     }
     else
     {
         <div class="flex-list">
-            @foreach (var item in contenu)
+            @foreach (var item in Model.Contacts)
             {
                 <div style="width:400px !important">
                     <div class="panel panel-default" style="overflow: hidden;">

+ 53 - 53
CD67.FicheCollege.MVC/Views/Identites/Edit.cshtml

@@ -1,13 +1,13 @@
 @using CD67.FicheCollege.MVC.Models
-@model CollegeViewModel
+@model IdentiteViewModel
 
 @{
     ViewBag.Title = "Edit";
     Layout = "~/Views/Shared/_Layout.cshtml";
-    Identite contenu = Model.Contenu as Identite;
+    Identite identite = Model.Obj;
 }
 
-<h1>@Model.College_Libelle</h1>
+<h1>@identite.College.Libelle</h1>
 
 @using (Html.BeginForm())
 {
@@ -19,22 +19,22 @@
         </legend>
         <div class="form-horizontal">
             @Html.ValidationSummary(true, "", new { @class = "text-danger" })
-            @Html.HiddenFor(model => contenu.College_Id)
+            @Html.HiddenFor(model => identite.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" })
+                    @Html.HiddenFor(model => identite.Principal_SID, new { data_picker = "agent.id" })
+                    @Html.HiddenFor(model => identite.Principal_Login, new { data_picker = "agent.login" })
+                    @Html.HiddenFor(model => identite.Principal_Nom, new { data_picker = "agent.nom" })
+                    @Html.HiddenFor(model => identite.Principal_Prenom, new { data_picker = "agent.prenom" })
+                    @Html.HiddenFor(model => identite.Principal_Email, new { data_picker = "agent.mail" })
+                    @Html.HiddenFor(model => identite.Principal_Structure, new { data_picker = "agent.chemin" })
+                    @Html.HiddenFor(model => identite.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 panel-default" id="Principal_Panel" name="Principal_Panel" style="@if (identite.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>
@@ -45,25 +45,25 @@
                             </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>
+                            <b><span data-picker="agent.prenom">@identite.Principal_Prenom</span> <span data-picker="agent.nom">@identite.Principal_Nom</span></b>
+                            <br /><span data-picker="agent.chemin">@identite.Principal_Structure</span>
+                            <br /><span data-picker="agent.mail">@identite.Principal_Email</span>
+                            <br />Tel : <span data-picker="agent.telephone">@identite.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" })
+                    @Html.HiddenFor(model => identite.Adjoint_SID, new { data_picker = "agent.id" })
+                    @Html.HiddenFor(model => identite.Adjoint_Login, new { data_picker = "agent.login" })
+                    @Html.HiddenFor(model => identite.Adjoint_Nom, new { data_picker = "agent.nom" })
+                    @Html.HiddenFor(model => identite.Adjoint_Prenom, new { data_picker = "agent.prenom" })
+                    @Html.HiddenFor(model => identite.Adjoint_Email, new { data_picker = "agent.mail" })
+                    @Html.HiddenFor(model => identite.Adjoint_Structure, new { data_picker = "agent.chemin" })
+                    @Html.HiddenFor(model => identite.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 panel-default" id="Adjoint_Panel" name="Adjoint_Panel" style="@if (identite.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>
@@ -74,10 +74,10 @@
                             </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>
+                            <b><span data-picker="agent.prenom">@identite.Adjoint_Prenom</span> <span data-picker="agent.nom">@identite.Adjoint_Nom</span></b>
+                            <br /><span data-picker="agent.chemin">@identite.Adjoint_Structure</span>
+                            <br /><span data-picker="agent.mail">@identite.Adjoint_Email</span>
+                            <br />Tel : <span data-picker="agent.telephone">@identite.Adjoint_Tel</span>
                         </div>
                     </div>
                 </div>
@@ -87,16 +87,16 @@
                 @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" })
+                    @Html.HiddenFor(model => identite.Gestionnaire_SID, new { data_picker = "agent.id" })
+                    @Html.HiddenFor(model => identite.Gestionnaire_Login, new { data_picker = "agent.login" })
+                    @Html.HiddenFor(model => identite.Gestionnaire_Nom, new { data_picker = "agent.nom" })
+                    @Html.HiddenFor(model => identite.Gestionnaire_Prenom, new { data_picker = "agent.prenom" })
+                    @Html.HiddenFor(model => identite.Gestionnaire_Email, new { data_picker = "agent.mail" })
+                    @Html.HiddenFor(model => identite.Gestionnaire_Structure, new { data_picker = "agent.chemin" })
+                    @Html.HiddenFor(model => identite.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 panel-default" id="Gestionnaire_Panel" name="Gestionnaire_Panel" style="@if (identite.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>
@@ -107,25 +107,25 @@
                             </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>
+                            <b><span data-picker="agent.prenom">@identite.Gestionnaire_Prenom</span> <span data-picker="agent.nom">@identite.Gestionnaire_Nom</span></b>
+                            <br /><span data-picker="agent.chemin">@identite.Gestionnaire_Structure</span>
+                            <br /><span data-picker="agent.mail">@identite.Gestionnaire_Email</span>
+                            <br />Tel : <span data-picker="agent.telephone">@identite.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" })
+                    @Html.HiddenFor(model => identite.Gestionnaire2_SID, new { data_picker = "agent.id" })
+                    @Html.HiddenFor(model => identite.Gestionnaire2_Login, new { data_picker = "agent.login" })
+                    @Html.HiddenFor(model => identite.Gestionnaire2_Nom, new { data_picker = "agent.nom" })
+                    @Html.HiddenFor(model => identite.Gestionnaire2_Prenom, new { data_picker = "agent.prenom" })
+                    @Html.HiddenFor(model => identite.Gestionnaire2_Email, new { data_picker = "agent.mail" })
+                    @Html.HiddenFor(model => identite.Gestionnaire2_Structure, new { data_picker = "agent.chemin" })
+                    @Html.HiddenFor(model => identite.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 panel-default" id="Gestionnaire2_Panel" name="Gestionnaire2_Panel" style="@if (identite.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>
@@ -136,10 +136,10 @@
                             </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>
+                            <b><span data-picker="agent.prenom">@identite.Gestionnaire2_Prenom</span> <span data-picker="agent.nom">@identite.Gestionnaire2_Nom</span></b>
+                            <br /><span data-picker="agent.chemin">@identite.Gestionnaire2_Structure</span>
+                            <br /><span data-picker="agent.mail">@identite.Gestionnaire2_Email</span>
+                            <br />Tel : <span data-picker="agent.telephone">@identite.Gestionnaire2_Tel</span>
                         </div>
                     </div>
                 </div>
@@ -148,7 +148,7 @@
             <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 })
+                    @Html.ActionLink("Annuler", "Details", new { Id = identite.College.Id })
                 </div>
             </div>
         </div>

+ 13 - 21
CD67.FicheCollege.MVC/Views/Shared/_Layout.cshtml

@@ -1,22 +1,14 @@
 @using CD67.FicheCollege.MVC.Models
 
 @{
+    string url = Request.Url.ToString();
     var controllerName = ViewContext.RouteData.Values["controller"].ToString();
     var actionName = ViewContext.RouteData.Values["action"].ToString();
+
     //Récupération de l'utilisateur connecté
     UtilisateurConnecte utilisateurConnecte = CD67.FicheCollege.MVC.Internal.UtilisateurConnecteFactory.getUtilisateurConnecte();
-    string url = Request.Url.ToString();
-
-    bool editionCollege = false;
-    string college_Id = null;
-    string college_Libelle = null;
-    if (Model is CollegeViewModel && Model.College_Id != null)
-    {
-        editionCollege = true;
-        college_Id = (Model as CollegeViewModel).College_Id;
-        college_Libelle = (Model as CollegeViewModel).College_Libelle;
-    }
 }
+
 <!DOCTYPE html>
 <html lang="fr">
 <head>
@@ -51,7 +43,12 @@
             <div id="topbar" class="navbar navbar-inner">
                 <div id="open-button" class="menu-button"><span>Menu invisible</span></div>
                 <ul id="titre" class="nav navbar ">
-                    <li><h1 id="app-title">Fiches collège</h1></li>
+                    <li>
+                        <h1 id="app-title">Fiches collège @Model.Annee_Lib</h1>
+                    </li>
+                    <li>
+                        <a href="/Annees">Changer d'année scolaire</a>
+                    </li>
                 </ul>
                 <ul class="nav navbar-nav navbar-right">
                     <li class="search">
@@ -131,23 +128,18 @@
                 <li><a href="/">Accueil</a><span class="divider"></span></li>
                 <li><a>&gt;</a><span class="divider"></span></li>
                 <li>@Html.ActionLink("Collèges", "Index", "Colleges")</li>
-                @if (editionCollege)
-                {
-                    <li><a>&gt;</a><span class="divider"></span></li>
-                    <li>@Html.ActionLink(String.Format("{0} {1}", college_Id, college_Libelle), "Details", "Colleges", new { Id = college_Id })</li>
-                }
             </ul>
             @*@Html.MvcSiteMap().SiteMapPath()*@
         </div>
 
         <!-- Menu de niveau 2 -->
-        @if (editionCollege)
+        @if (Model.Obj is College | Model.Obj is Identite | Model.Obj is ActionCLAS)
         {
             <div>
                 <ul id="menu-l2">
-                    <li><a id="" class="@(controllerName == "Colleges" ? "active":"") btn-sm menu-color-@controllerName" href="@Url.Action("Details", "Colleges", new { Id = Model.College_Id })">Général</a></li>
-                    <li><a id="" class="@(controllerName == "Identites" ? "active":"") btn-sm menu-color-@controllerName" href="@Url.Action("Details", "Identites", new { Id = Model.College_Id })/">Identité</a></li>
-                    <li><a id="" class="@(controllerName == "ActionsCLAS" ? "active":"") btn-sm menu-color-@controllerName" href="@Url.Action("Details", "ActionsCLAS", new { Id = Model.College_Id })/">Actions</a></li>
+                    <li><a id="" class="@(controllerName == "Colleges" ? "active":"") btn-sm menu-color-@controllerName" href="@Url.Action("Details", "Colleges", new { id = Model.Obj.Id })">Général</a></li>
+                    <li><a id="" class="@(controllerName == "Identites" ? "active":"") btn-sm menu-color-@controllerName" href="@Url.Action("Details", "Identites", new { id = Model.Obj.Id })/">Identité</a></li>
+                    <li><a id="" class="@(controllerName == "ActionsCLAS" ? "active":"") btn-sm menu-color-@controllerName" href="@Url.Action("Details", "ActionsCLAS", new { id = Model.Obj.Id })/">Actions</a></li>
                 </ul>
             </div>
         }