Browse Source

FIX Corrections MCD

olivier.massot 7 years ago
parent
commit
f55a21f82a

+ 9 - 9
CD67.FicheCollege.BDD/dbo/Tables/ActionsEduColleges.sql

@@ -1,27 +1,27 @@
 CREATE TABLE [dbo].[ActionsEduColleges] (
     [Id]                     INT            IDENTITY (1, 1) NOT NULL,
     [CommentaireInterne]     NVARCHAR (MAX) NOT NULL,
-    [CommentaoirePublic]     NVARCHAR (MAX) NOT NULL,
-    [NbEleves]               NVARCHAR (MAX) NOT NULL,
-    [Montant]                NVARCHAR (MAX) NOT NULL,
+    [CommentairePublic]      NVARCHAR (MAX) NOT NULL,
+    [NbEleves]               BIGINT         NOT NULL,
+    [Montant]                BIGINT         NOT NULL,
     [TiersAstre_Code]        NVARCHAR (MAX) NOT NULL,
     [TiersAstre_Nom]         NVARCHAR (MAX) NOT NULL,
     [TiersAstre_CodeFamille] NVARCHAR (MAX) NOT NULL,
     [TiersAstre_Description] NVARCHAR (MAX) NOT NULL,
-    [College_Id]             INT            NOT NULL,
-    [ActionEdu_Id]           INT            NOT NULL,
+    [CollegeId]              INT            NOT NULL,
+    [ActionEduId]            INT            NOT NULL,
     CONSTRAINT [PK_ActionsEduColleges] PRIMARY KEY CLUSTERED ([Id] ASC),
-    CONSTRAINT [FK_ActionEduCollegeActionEdu] FOREIGN KEY ([ActionEdu_Id]) REFERENCES [dbo].[ActionsEdu] ([Id]),
-    CONSTRAINT [FK_ActionEduCollegeCollege] FOREIGN KEY ([College_Id]) REFERENCES [dbo].[Colleges] ([Id])
+    CONSTRAINT [FK_ActionEduCollegeActionEdu] FOREIGN KEY ([ActionEduId]) REFERENCES [dbo].[ActionsEdu] ([Id]),
+    CONSTRAINT [FK_ActionEduCollegeCollege] FOREIGN KEY ([CollegeId]) REFERENCES [dbo].[Colleges] ([Id])
 );
 
 
 GO
 CREATE NONCLUSTERED INDEX [IX_FK_ActionEduCollegeCollege]
-    ON [dbo].[ActionsEduColleges]([College_Id] ASC);
+    ON [dbo].[ActionsEduColleges]([CollegeId] ASC);
 
 
 GO
 CREATE NONCLUSTERED INDEX [IX_FK_ActionEduCollegeActionEdu]
-    ON [dbo].[ActionsEduColleges]([ActionEdu_Id] ASC);
+    ON [dbo].[ActionsEduColleges]([ActionEduId] ASC);
 

+ 7 - 3
CD67.FicheCollege.Entity/ActionEduCollege.cs

@@ -17,18 +17,22 @@ namespace CD67.FicheCollege.Entity
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         public ActionEduCollege()
         {
+            this.NbEleves = 0;
+            this.Montant = 0;
             this.ActionEduMissions = new HashSet<ActionEduMission>();
         }
     
         public int Id { get; set; }
         public string CommentaireInterne { get; set; }
-        public string CommentaoirePublic { get; set; }
-        public string NbEleves { get; set; }
-        public string Montant { get; set; }
+        public string CommentairePublic { get; set; }
+        public long NbEleves { get; set; }
+        public long Montant { get; set; }
         public string TiersAstre_Code { get; set; }
         public string TiersAstre_Nom { get; set; }
         public string TiersAstre_CodeFamille { get; set; }
         public string TiersAstre_Description { get; set; }
+        public int CollegeId { get; set; }
+        public int ActionEduId { get; set; }
     
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
         public virtual ICollection<ActionEduMission> ActionEduMissions { get; set; }

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

@@ -95,6 +95,7 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>EntityModel.edmx</DependentUpon>
     </Compile>
+    <Compile Include="Extend\ActionEduCollege.cs" />
     <Compile Include="Extend\Annee.cs" />
     <Compile Include="Extend\College.cs" />
     <Compile Include="Extend\Territoire.cs" />

+ 31 - 27
CD67.FicheCollege.Entity/EntityModel.edmx

@@ -179,15 +179,15 @@
     </Key>
     <Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
     <Property Name="CommentaireInterne" Type="nvarchar(max)" Nullable="false" />
-    <Property Name="CommentaoirePublic" Type="nvarchar(max)" Nullable="false" />
-    <Property Name="NbEleves" Type="nvarchar(max)" Nullable="false" />
-    <Property Name="Montant" Type="nvarchar(max)" Nullable="false" />
+    <Property Name="CommentairePublic" Type="nvarchar(max)" Nullable="false" />
+    <Property Name="NbEleves" Type="bigint" Nullable="false" DefaultValue="0" />
+    <Property Name="Montant" Type="bigint" Nullable="false" DefaultValue="0" />
     <Property Name="TiersAstre_Code" Type="nvarchar(max)" Nullable="false" />
     <Property Name="TiersAstre_Nom" Type="nvarchar(max)" Nullable="false" />
     <Property Name="TiersAstre_CodeFamille" Type="nvarchar(max)" Nullable="false" />
     <Property Name="TiersAstre_Description" Type="nvarchar(max)" Nullable="false" />
-    <Property Name="College_Id" Type="int" Nullable="false" />
-    <Property Name="ActionEdu_Id" Type="int" Nullable="false" />
+    <Property Name="CollegeId" Type="int" Nullable="false" />
+    <Property Name="ActionEduId" Type="int" Nullable="false" />
   </EntityType>
   <EntityType Name="ActionEduMissions">
     <Key>
@@ -303,7 +303,7 @@
         <PropertyRef Name="Id" />
       </Principal>
       <Dependent Role="ActionEduCollege">
-        <PropertyRef Name="College_Id" />
+        <PropertyRef Name="CollegeId" />
       </Dependent>
     </ReferentialConstraint>
   </Association>
@@ -315,7 +315,7 @@
         <PropertyRef Name="Id" />
       </Principal>
       <Dependent Role="ActionEduCollege">
-        <PropertyRef Name="ActionEdu_Id" />
+        <PropertyRef Name="ActionEduId" />
       </Dependent>
     </ReferentialConstraint>
   </Association>
@@ -597,16 +597,18 @@
           </Key>
           <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="CommentaireInterne" Type="String" Nullable="false" />
-          <Property Name="CommentaoirePublic" Type="String" Nullable="false" />
-          <Property Name="NbEleves" Type="String" Nullable="false" />
-          <Property Name="Montant" Type="String" Nullable="false" />
+          <Property Name="CommentairePublic" Type="String" Nullable="false" />
+          <Property Name="NbEleves" Type="Int64" Nullable="false" DefaultValue="0" />
+          <Property Name="Montant" Type="Int64" Nullable="false" DefaultValue="0" />
           <Property Name="TiersAstre_Code" Type="String" Nullable="false" />
           <Property Name="TiersAstre_Nom" Type="String" Nullable="false" />
           <Property Name="TiersAstre_CodeFamille" Type="String" Nullable="false" />
           <Property Name="TiersAstre_Description" Type="String" Nullable="false" />
           <NavigationProperty Name="ActionEduMissions" Relationship="CD67.FicheCollege.ActionEduCollegeActionEduMission" FromRole="ActionEduCollege" ToRole="ActionEduMission" />
           <NavigationProperty Name="College" Relationship="CD67.FicheCollege.ActionEduCollegeCollege" FromRole="ActionEduCollege" ToRole="College" />
+          <Property Name="CollegeId" Type="Int32" Nullable="false" />
           <NavigationProperty Name="ActionEdu" Relationship="CD67.FicheCollege.ActionEduCollegeActionEdu" FromRole="ActionEduCollege" ToRole="ActionEdu" />
+          <Property Name="ActionEduId" Type="Int32" Nullable="false" />
         </EntityType>
         <EntityType Name="ActionEduMission">
           <Key>
@@ -634,10 +636,26 @@
         <Association Name="ActionEduCollegeCollege">
           <End Type="CD67.FicheCollege.ActionEduCollege" Role="ActionEduCollege" Multiplicity="*" />
           <End Type="CD67.FicheCollege.College" Role="College" Multiplicity="1" />
+          <ReferentialConstraint>
+            <Principal Role="College">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="ActionEduCollege">
+              <PropertyRef Name="CollegeId" />
+            </Dependent>
+          </ReferentialConstraint>
         </Association>
         <Association Name="ActionEduCollegeActionEdu">
           <End Type="CD67.FicheCollege.ActionEduCollege" Role="ActionEduCollege" Multiplicity="*" />
           <End Type="CD67.FicheCollege.ActionEdu" Role="ActionEdu" Multiplicity="1" />
+          <ReferentialConstraint>
+            <Principal Role="ActionEdu">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="ActionEduCollege">
+              <PropertyRef Name="ActionEduId" />
+            </Dependent>
+          </ReferentialConstraint>
         </Association>
         </Schema>
     </edmx:ConceptualModels>
@@ -774,13 +792,15 @@
         <MappingFragment StoreEntitySet="ActionsEduColleges">
           <ScalarProperty Name="Id" ColumnName="Id" />
           <ScalarProperty Name="CommentaireInterne" ColumnName="CommentaireInterne" />
-          <ScalarProperty Name="CommentaoirePublic" ColumnName="CommentaoirePublic" />
+          <ScalarProperty Name="CommentairePublic" ColumnName="CommentairePublic" />
           <ScalarProperty Name="NbEleves" ColumnName="NbEleves" />
           <ScalarProperty Name="Montant" ColumnName="Montant" />
           <ScalarProperty Name="TiersAstre_Code" ColumnName="TiersAstre_Code" />
           <ScalarProperty Name="TiersAstre_Nom" ColumnName="TiersAstre_Nom" />
           <ScalarProperty Name="TiersAstre_CodeFamille" ColumnName="TiersAstre_CodeFamille" />
           <ScalarProperty Name="TiersAstre_Description" ColumnName="TiersAstre_Description" />
+          <ScalarProperty Name="CollegeId" ColumnName="CollegeId" />
+          <ScalarProperty Name="ActionEduId" ColumnName="ActionEduId" />
         </MappingFragment>
       </EntityTypeMapping>
     </EntitySetMapping>
@@ -795,22 +815,6 @@
         </MappingFragment>
       </EntityTypeMapping>
     </EntitySetMapping>
-    <AssociationSetMapping Name="ActionEduCollegeCollege" TypeName="CD67.FicheCollege.ActionEduCollegeCollege" StoreEntitySet="ActionsEduColleges">
-      <EndProperty Name="College">
-        <ScalarProperty Name="Id" ColumnName="College_Id" />
-      </EndProperty>
-      <EndProperty Name="ActionEduCollege">
-        <ScalarProperty Name="Id" ColumnName="Id" />
-      </EndProperty>
-    </AssociationSetMapping>
-    <AssociationSetMapping Name="ActionEduCollegeActionEdu" TypeName="CD67.FicheCollege.ActionEduCollegeActionEdu" StoreEntitySet="ActionsEduColleges">
-      <EndProperty Name="ActionEdu">
-        <ScalarProperty Name="Id" ColumnName="ActionEdu_Id" />
-      </EndProperty>
-      <EndProperty Name="ActionEduCollege">
-        <ScalarProperty Name="Id" ColumnName="Id" />
-      </EndProperty>
-    </AssociationSetMapping>
   </EntityContainerMapping>
 </Mapping></edmx:Mappings>
   </edmx:Runtime>

+ 1 - 1
CD67.FicheCollege.Entity/EntityModel.edmx.diagram

@@ -21,7 +21,7 @@
         <AssociationConnector Association="CD67.FicheCollege.ActionEduThematiqueActionEdu" />
         <AssociationConnector Association="CD67.FicheCollege.ActionEduAnnee" />
         <EntityTypeShape EntityType="CD67.FicheCollege.ActionEduCollege" Width="2.125" PointX="5.25" PointY="3" />
-        <EntityTypeShape EntityType="CD67.FicheCollege.ActionEduMission" Width="1.5" PointX="6" PointY="6.875" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.ActionEduMission" Width="2.25" PointX="6" PointY="7.375" />
         <AssociationConnector Association="CD67.FicheCollege.ActionEduCollegeActionEduMission" />
         <AssociationConnector Association="CD67.FicheCollege.ActionEduCollegeCollege" />
         <AssociationConnector Association="CD67.FicheCollege.ActionEduCollegeActionEdu" />

+ 27 - 12
CD67.FicheCollege.Entity/EntityModel.edmx.sql

@@ -2,7 +2,7 @@
 -- --------------------------------------------------
 -- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
 -- --------------------------------------------------
--- Date Created: 03/01/2018 16:53:49
+-- Date Created: 03/01/2018 17:07:11
 -- Generated from EDMX file: C:\dev\dotnet\FicheCollege\CD67.FicheCollege.Entity\EntityModel.edmx
 -- --------------------------------------------------
 
@@ -38,6 +38,15 @@ GO
 IF OBJECT_ID(N'[dbo].[FK_ActionEduAnnee]', 'F') IS NOT NULL
     ALTER TABLE [dbo].[ActionsEdu] DROP CONSTRAINT [FK_ActionEduAnnee];
 GO
+IF OBJECT_ID(N'[dbo].[FK_ActionEduCollegeActionEduMission]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[ActionEduMissions] DROP CONSTRAINT [FK_ActionEduCollegeActionEduMission];
+GO
+IF OBJECT_ID(N'[dbo].[FK_ActionEduCollegeCollege]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[ActionsEduColleges] DROP CONSTRAINT [FK_ActionEduCollegeCollege];
+GO
+IF OBJECT_ID(N'[dbo].[FK_ActionEduCollegeActionEdu]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[ActionsEduColleges] DROP CONSTRAINT [FK_ActionEduCollegeActionEdu];
+GO
 
 -- --------------------------------------------------
 -- Dropping existing tables
@@ -67,6 +76,12 @@ GO
 IF OBJECT_ID(N'[dbo].[ActionsEdu]', 'U') IS NOT NULL
     DROP TABLE [dbo].[ActionsEdu];
 GO
+IF OBJECT_ID(N'[dbo].[ActionsEduColleges]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[ActionsEduColleges];
+GO
+IF OBJECT_ID(N'[dbo].[ActionEduMissions]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[ActionEduMissions];
+GO
 
 -- --------------------------------------------------
 -- Creating all tables
@@ -192,15 +207,15 @@ GO
 CREATE TABLE [dbo].[ActionsEduColleges] (
     [Id] int IDENTITY(1,1) NOT NULL,
     [CommentaireInterne] nvarchar(max)  NOT NULL,
-    [CommentaoirePublic] nvarchar(max)  NOT NULL,
-    [NbEleves] nvarchar(max)  NOT NULL,
-    [Montant] nvarchar(max)  NOT NULL,
+    [CommentairePublic] nvarchar(max)  NOT NULL,
+    [NbEleves] bigint  NOT NULL,
+    [Montant] bigint  NOT NULL,
     [TiersAstre_Code] nvarchar(max)  NOT NULL,
     [TiersAstre_Nom] nvarchar(max)  NOT NULL,
     [TiersAstre_CodeFamille] nvarchar(max)  NOT NULL,
     [TiersAstre_Description] nvarchar(max)  NOT NULL,
-    [College_Id] int  NOT NULL,
-    [ActionEdu_Id] int  NOT NULL
+    [CollegeId] int  NOT NULL,
+    [ActionEduId] int  NOT NULL
 );
 GO
 
@@ -396,10 +411,10 @@ ON [dbo].[ActionEduMissions]
     ([ActionEduCollegeId]);
 GO
 
--- Creating foreign key on [College_Id] in table 'ActionsEduColleges'
+-- Creating foreign key on [CollegeId] in table 'ActionsEduColleges'
 ALTER TABLE [dbo].[ActionsEduColleges]
 ADD CONSTRAINT [FK_ActionEduCollegeCollege]
-    FOREIGN KEY ([College_Id])
+    FOREIGN KEY ([CollegeId])
     REFERENCES [dbo].[Colleges]
         ([Id])
     ON DELETE NO ACTION ON UPDATE NO ACTION;
@@ -408,13 +423,13 @@ GO
 -- Creating non-clustered index for FOREIGN KEY 'FK_ActionEduCollegeCollege'
 CREATE INDEX [IX_FK_ActionEduCollegeCollege]
 ON [dbo].[ActionsEduColleges]
-    ([College_Id]);
+    ([CollegeId]);
 GO
 
--- Creating foreign key on [ActionEdu_Id] in table 'ActionsEduColleges'
+-- Creating foreign key on [ActionEduId] in table 'ActionsEduColleges'
 ALTER TABLE [dbo].[ActionsEduColleges]
 ADD CONSTRAINT [FK_ActionEduCollegeActionEdu]
-    FOREIGN KEY ([ActionEdu_Id])
+    FOREIGN KEY ([ActionEduId])
     REFERENCES [dbo].[ActionsEdu]
         ([Id])
     ON DELETE NO ACTION ON UPDATE NO ACTION;
@@ -423,7 +438,7 @@ GO
 -- Creating non-clustered index for FOREIGN KEY 'FK_ActionEduCollegeActionEdu'
 CREATE INDEX [IX_FK_ActionEduCollegeActionEdu]
 ON [dbo].[ActionsEduColleges]
-    ([ActionEdu_Id]);
+    ([ActionEduId]);
 GO
 
 -- --------------------------------------------------

+ 50 - 0
CD67.FicheCollege.Entity/Extend/ActionEduCollege.cs

@@ -0,0 +1,50 @@
+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(ActionEdu_Metadata))]
+    public partial class ActionEdu
+    {
+    }
+
+    /// <summary>
+    /// Classe contenant les DataAnnotations pour chaque champ
+    /// </summary>
+    public class ActionEdu_Metadata
+    {
+        [Required]
+        public int Id { get; set; }
+
+        [Required]
+        [Display(Name = "Année")]
+        public int AnneeId { get; set; }
+
+        [Required]
+        [Display(Name = "Numéro")]
+        public int Numero { get; set; }
+
+        [Required]
+        [Display(Name = "Thématique")]
+        public int ActionEduThematiqueId { get; set; }
+
+        [Required]
+        [Display(Name = "Action")]
+        public string Nom { get; set; }
+
+        [Display(Name = "Description")]
+        public string Description { get; set; }
+
+        [Display(Name = "Neutralisé (oui/non)")]
+        public bool Neutralise { get; set; }
+
+        public int Ordre { get; set; }
+    }
+}

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

@@ -175,6 +175,8 @@
     <Compile Include="Internal\MvcHtmlHelpers.cs" />
     <Compile Include="Internal\Navigation.cs" />
     <Compile Include="Internal\UtilisateurConnecteFactory.cs" />
+    <Compile Include="Models\ActionEduMissionViewModel.cs" />
+    <Compile Include="Models\ActionEduCollegeViewModel.cs" />
     <Compile Include="Models\ActionEduAxeViewModel.cs" />
     <Compile Include="Models\ActionEduThematiqueViewModel.cs" />
     <Compile Include="Models\TerritoireViewModel.cs" />

+ 18 - 0
CD67.FicheCollege.MVC/Models/ActionEduCollegeViewModel.cs

@@ -0,0 +1,18 @@
+using CD67.FicheCollege.Entity;
+using CD67.FicheCollege.Factory;
+using CD67.FicheCollege.MVC.Internal;
+using System.Collections.Generic;
+using System.Web.Mvc;
+
+namespace CD67.FicheCollege.MVC.Models
+{
+    public class ActionEduCollegeViewModel : BaseViewModel<ActionEduCollege>
+    {
+        public ActionEduCollegeViewModel(ActionEduCollege model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
+        {
+        }
+
+        public override string Annee_Lib { get { return Obj.ActionEdu.Annee.Libelle; } }
+    }
+
+}

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

@@ -0,0 +1,17 @@
+using CD67.FicheCollege.Entity;
+using CD67.FicheCollege.Factory;
+using CD67.FicheCollege.MVC.Internal;
+using System.Collections.Generic;
+using System.Web.Mvc;
+
+namespace CD67.FicheCollege.MVC.Models
+{
+    public class ActionEduMissionViewModel : BaseViewModel<ActionEduMission>
+    {
+        public ActionEduMissionViewModel(ActionEduMission model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
+        {
+        }
+
+        public override string Annee_Lib { get { return Obj.ActionEduCollege.ActionEdu.Annee.Libelle; } }
+    }
+}