From d00d9798f22d77ed090058d10b4c0784b433e5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Wed, 19 Aug 2020 17:08:29 +0200 Subject: [PATCH] Ajout de nouvelles tables autour des formations et des demandes de formations --- Context/EpContext.cs | 41 +++++++++++++++++++-- EPAServeur.csproj | 1 + EPAServeur.sln | 5 ++- Models/Formation/DemandeFormation.cs | 1 + Models/Formation/Formation.cs | 5 ++- Models/Formation/ModeFormation.cs | 14 +++++++ Models/Formation/OrigineDemandeFormation.cs | 14 +++++++ Models/Formation/OrigineFormation.cs | 14 +++++++ Models/Formation/Theme.cs | 2 +- Models/Formation/TypeFormation.cs | 14 +++++++ 10 files changed, 105 insertions(+), 6 deletions(-) create mode 100644 Models/Formation/ModeFormation.cs create mode 100644 Models/Formation/OrigineDemandeFormation.cs create mode 100644 Models/Formation/OrigineFormation.cs create mode 100644 Models/Formation/TypeFormation.cs diff --git a/Context/EpContext.cs b/Context/EpContext.cs index 42ba59c..669715a 100644 --- a/Context/EpContext.cs +++ b/Context/EpContext.cs @@ -19,17 +19,21 @@ namespace EPAServeur.Context public DbSet Document { get; set; } public DbSet Engagement { get; set; } public DbSet Ep { get; set; } - public DbSet Objectifs { get; set; } - public DbSet ObjectifPrecedents { get; set; } - public DbSet RdvEntretiens { get; set; } + public DbSet Objectif { get; set; } + public DbSet ObjectifPrecedent { get; set; } + public DbSet RdvEntretien { get; set; } public DbSet TypeEntretien { get; set; } //Formation public DbSet DemandeFormation { get; set; } public DbSet Formation { get; set; } + public DbSet ModeFormation { get; set; } + public DbSet OrigineDemandeFormation { get; set; } + public DbSet OrigineFormation { get; set; } public DbSet ParticipationFormation { get; set; } public DbSet StatutFormation { get; set; } public DbSet Theme { get; set; } + public DbSet TypeFormation { get; set; } //Note public DbSet Note { get; set; } @@ -110,6 +114,7 @@ namespace EPAServeur.Context modelBuilder.Entity(entity => { entity.HasKey(e => e.Id); + entity.HasIndex(e => e.Libelle).IsUnique(); }); //Formation @@ -125,6 +130,27 @@ namespace EPAServeur.Context entity.Property(e => e.Id).ValueGeneratedOnAdd(); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasIndex(e => e.Libelle).IsUnique(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasIndex(e => e.Libelle).IsUnique(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasIndex(e => e.Libelle).IsUnique(); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.Id); @@ -135,12 +161,21 @@ namespace EPAServeur.Context { entity.HasKey(e => e.Id); entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasIndex(e => e.Libelle).IsUnique(); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id); entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasIndex(e => e.Libelle).IsUnique(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasIndex(e => e.Libelle).IsUnique(); }); //Notes diff --git a/EPAServeur.csproj b/EPAServeur.csproj index 0a72423..7fd1abc 100644 --- a/EPAServeur.csproj +++ b/EPAServeur.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 + Debug;Release;InitDB diff --git a/EPAServeur.sln b/EPAServeur.sln index 3a09612..ef971de 100644 --- a/EPAServeur.sln +++ b/EPAServeur.sln @@ -3,16 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30128.74 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EPAServeur", "EPAServeur.csproj", "{D19F441B-010F-481F-8A59-C5FA928B5077}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EPAServeur", "EPAServeur.csproj", "{D19F441B-010F-481F-8A59-C5FA928B5077}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + InitDB|Any CPU = InitDB|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {D19F441B-010F-481F-8A59-C5FA928B5077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D19F441B-010F-481F-8A59-C5FA928B5077}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D19F441B-010F-481F-8A59-C5FA928B5077}.InitDB|Any CPU.ActiveCfg = InitDB|Any CPU + {D19F441B-010F-481F-8A59-C5FA928B5077}.InitDB|Any CPU.Build.0 = InitDB|Any CPU {D19F441B-010F-481F-8A59-C5FA928B5077}.Release|Any CPU.ActiveCfg = Release|Any CPU {D19F441B-010F-481F-8A59-C5FA928B5077}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection diff --git a/Models/Formation/DemandeFormation.cs b/Models/Formation/DemandeFormation.cs index eba6ca4..eda51f7 100644 --- a/Models/Formation/DemandeFormation.cs +++ b/Models/Formation/DemandeFormation.cs @@ -17,5 +17,6 @@ namespace EPAServeur.Models.Formation public DateTime DateDerniereReponse { get; set; } public Ep Ep { get; set; } public ParticipationFormation ParticipationFormation { get; set; } + public OrigineFormation OrigineFormation { get; set; } } } diff --git a/Models/Formation/Formation.cs b/Models/Formation/Formation.cs index 9bb556a..17ef8e8 100644 --- a/Models/Formation/Formation.cs +++ b/Models/Formation/Formation.cs @@ -9,7 +9,7 @@ namespace EPAServeur.Models.Formation { public int Id { get; set; } public string Intitule { get; set; } - public string Origine { get; set; } + public DateTime DateDebut { get; set; } public DateTime DateFin { get; set; } public int Jour { get; set; } @@ -17,5 +17,8 @@ namespace EPAServeur.Models.Formation public string Organisme { get; set; } public bool EstCertifiee { get; set; } public StatutFormation Statut { get; set; } + public OrigineFormation Origine { get; set; } + public ModeFormation ModeFormation { get; set; } + public TypeFormation TypeFormation { get; set; } } } diff --git a/Models/Formation/ModeFormation.cs b/Models/Formation/ModeFormation.cs new file mode 100644 index 0000000..8b05493 --- /dev/null +++ b/Models/Formation/ModeFormation.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + public class ModeFormation + { + public int Id { get; set; } + public string Libelle { get; set; } + public List Formations { get; set; } + } +} diff --git a/Models/Formation/OrigineDemandeFormation.cs b/Models/Formation/OrigineDemandeFormation.cs new file mode 100644 index 0000000..e3fc102 --- /dev/null +++ b/Models/Formation/OrigineDemandeFormation.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + public class OrigineDemandeFormation + { + public int Id { get; set; } + public string Libelle { get; set; } + public List DemandeFormations { get; set; } + } +} diff --git a/Models/Formation/OrigineFormation.cs b/Models/Formation/OrigineFormation.cs new file mode 100644 index 0000000..07b87b8 --- /dev/null +++ b/Models/Formation/OrigineFormation.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + public class OrigineFormation + { + public int Id { get; set; } + public string Libelle { get; set; } + public List Formations { get; set; } + } +} diff --git a/Models/Formation/Theme.cs b/Models/Formation/Theme.cs index e28a05d..27a60fe 100644 --- a/Models/Formation/Theme.cs +++ b/Models/Formation/Theme.cs @@ -8,6 +8,6 @@ namespace EPAServeur.Models.Formation public class Theme { public int Id { get; set; } - public string Nom { get; set; } + public string Libelle { get; set; } } } diff --git a/Models/Formation/TypeFormation.cs b/Models/Formation/TypeFormation.cs new file mode 100644 index 0000000..0164ee3 --- /dev/null +++ b/Models/Formation/TypeFormation.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + public class TypeFormation + { + public int Id { get; set; } + public string Libelle { get; set; } + public List Formations { get; set; } + } +}