MAJ du modèle pour la partie Formation

develop
jboinembalome 4 years ago
parent c10dfd5069
commit 6438227068
  1. 196
      EPAServeur.Tests/Services/FormationServiceTests.cs
  2. 44
      EPAServeur/Context/EpContext.cs
  3. 58
      EPAServeur/Models/Formation/DemandeFormation.cs
  4. 62
      EPAServeur/Models/Formation/Formation.cs
  5. 16
      EPAServeur/Models/Formation/ModeFormation.cs
  6. 28
      EPAServeur/Models/Formation/OrigineDemande.cs
  7. 14
      EPAServeur/Models/Formation/OrigineDemandeFormation.cs
  8. 16
      EPAServeur/Models/Formation/OrigineFormation.cs
  9. 34
      EPAServeur/Models/Formation/ParticipationFormation.cs
  10. 16
      EPAServeur/Models/Formation/StatutFormation.cs
  11. 13
      EPAServeur/Models/Formation/Theme.cs
  12. 16
      EPAServeur/Models/Formation/TypeFormation.cs
  13. 70
      EPAServeur/Services/FormationService.cs

@ -544,14 +544,14 @@ namespace EPAServeur.Tests.Services
public void AddFormation_AjouteUneFormationValide_FormationAjouteeAvecSucces(int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) public void AddFormation_AjouteUneFormationValide_FormationAjouteeAvecSucces(int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationDTO formation = new FormationDTO FormationDTO formation = new FormationDTO
{ {
@ -597,14 +597,14 @@ namespace EPAServeur.Tests.Services
public async Task AddFormationAsync_AjouteUneFormationValide_FormationAjouteeAvecSucces(int? idMode, int? idStatut, int? idType, long? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) public async Task AddFormationAsync_AjouteUneFormationValide_FormationAjouteeAvecSucces(int? idMode, int? idStatut, int? idType, long? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationDTO formation = new FormationDTO FormationDTO formation = new FormationDTO
{ {
@ -693,14 +693,14 @@ namespace EPAServeur.Tests.Services
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationDTO formation = new FormationDTO FormationDTO formation = new FormationDTO
{ {
@ -742,14 +742,14 @@ namespace EPAServeur.Tests.Services
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationDTO formation = new FormationDTO FormationDTO formation = new FormationDTO
{ {
@ -876,14 +876,14 @@ namespace EPAServeur.Tests.Services
public void UpdateFormation_ModifieUneFormationValide_FormationModifieeAvecSucces(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) public void UpdateFormation_ModifieUneFormationValide_FormationModifieeAvecSucces(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -927,14 +927,14 @@ namespace EPAServeur.Tests.Services
public async Task UpdateFormationAsync_ModifieUneFormationValide_FormationModifieeAvecSucces(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) public async Task UpdateFormationAsync_ModifieUneFormationValide_FormationModifieeAvecSucces(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -991,14 +991,14 @@ namespace EPAServeur.Tests.Services
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -1041,14 +1041,14 @@ namespace EPAServeur.Tests.Services
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -1079,14 +1079,14 @@ namespace EPAServeur.Tests.Services
public void UpdateFormation_ModifieUneFormationAvecUnIdIncorrecte_LeveUneFormationIncompatibleIdException(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) public void UpdateFormation_ModifieUneFormationAvecUnIdIncorrecte_LeveUneFormationIncompatibleIdException(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -1118,14 +1118,14 @@ namespace EPAServeur.Tests.Services
public async Task UpdateFormationAsync_ModifieUneFormationAvecUnIdIncorrecte_LeveUneFormationIncompatibleIdException(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) public async Task UpdateFormationAsync_ModifieUneFormationAvecUnIdIncorrecte_LeveUneFormationIncompatibleIdException(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -1156,14 +1156,14 @@ namespace EPAServeur.Tests.Services
public void UpdateFormation_ModifieUneFormationAvecUnIdInexistant_RetourneUnObjetNull(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) public void UpdateFormation_ModifieUneFormationAvecUnIdInexistant_RetourneUnObjetNull(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -1195,14 +1195,14 @@ namespace EPAServeur.Tests.Services
public async Task UpdateFormationAsync_ModifieUneFormationAvecUnIdInexistant_RetourneUnObjetNull(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) public async Task UpdateFormationAsync_ModifieUneFormationAvecUnIdInexistant_RetourneUnObjetNull(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{ {
// Arrange // Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext); FormationService formationService = new FormationService(epContext);
@ -1246,7 +1246,7 @@ namespace EPAServeur.Tests.Services
// Act // Act
FormationDTO formationSupprime = formationService.DeleteFormationById(idFormation); FormationDTO formationSupprime = formationService.DeleteFormationById(idFormation);
existFormation = epContext.Formation.Any(formation => formation.Id == formationSupprime.Id.Value); existFormation = epContext.Formation.Any(formation => formation.IdFormation == formationSupprime.Id.Value);
// Assert // Assert
Assert.IsFalse(existFormation); Assert.IsFalse(existFormation);
@ -1263,7 +1263,7 @@ namespace EPAServeur.Tests.Services
// Act // Act
FormationDTO formationSupprime = await formationService.DeleteFormationByIdAsync(idFormation); FormationDTO formationSupprime = await formationService.DeleteFormationByIdAsync(idFormation);
existFormation = await epContext.Formation.AnyAsync(formation => formation.Id == formationSupprime.Id.Value); existFormation = await epContext.Formation.AnyAsync(formation => formation.IdFormation == formationSupprime.Id.Value);
// Assert // Assert
Assert.IsFalse(existFormation); Assert.IsFalse(existFormation);

@ -33,11 +33,10 @@ namespace EPAServeur.Context
public DbSet<DemandeFormation> DemandeFormation { get; set; } public DbSet<DemandeFormation> DemandeFormation { get; set; }
public DbSet<Formation> Formation { get; set; } public DbSet<Formation> Formation { get; set; }
public DbSet<ModeFormation> ModeFormation { get; set; } public DbSet<ModeFormation> ModeFormation { get; set; }
public DbSet<OrigineDemandeFormation> OrigineDemandeFormation { get; set; } public DbSet<OrigineDemande> OrigineDemandeFormation { get; set; }
public DbSet<OrigineFormation> OrigineFormation { get; set; } public DbSet<OrigineFormation> OrigineFormation { get; set; }
public DbSet<ParticipationFormation> ParticipationFormation { get; set; } public DbSet<ParticipationFormation> ParticipationFormation { get; set; }
public DbSet<StatutFormation> StatutFormation { get; set; } public DbSet<StatutFormation> StatutFormation { get; set; }
public DbSet<Theme> Theme { get; set; }
public DbSet<TypeFormation> TypeFormation { get; set; } public DbSet<TypeFormation> TypeFormation { get; set; }
//Note //Note
@ -129,62 +128,55 @@ namespace EPAServeur.Context
//Formation //Formation
modelBuilder.Entity<DemandeFormation>(entity => modelBuilder.Entity<DemandeFormation>(entity =>
{ {
entity.HasKey(e => e.Id); entity.HasKey(e => e.IdDemandeFormation);
entity.Property(e => e.Id).ValueGeneratedOnAdd(); entity.Property(e => e.IdDemandeFormation).ValueGeneratedOnAdd();
}); });
modelBuilder.Entity<Formation>(entity => modelBuilder.Entity<Formation>(entity =>
{ {
entity.HasKey(e => e.Id); entity.HasKey(e => e.IdFormation);
entity.Property(e => e.Id).ValueGeneratedOnAdd(); entity.Property(e => e.IdFormation).ValueGeneratedOnAdd();
}); });
modelBuilder.Entity<ModeFormation>(entity => modelBuilder.Entity<ModeFormation>(entity =>
{ {
entity.HasKey(e => e.Id); entity.HasKey(e => e.IdModeFormation);
entity.Property(e => e.Id).ValueGeneratedOnAdd(); entity.Property(e => e.IdModeFormation).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique(); entity.HasIndex(e => e.Libelle).IsUnique();
}); });
modelBuilder.Entity<OrigineDemandeFormation>(entity => modelBuilder.Entity<OrigineDemande>(entity =>
{ {
entity.HasKey(e => e.Id); entity.HasKey(e => e.IdOrigineDemande);
entity.Property(e => e.Id).ValueGeneratedOnAdd(); entity.Property(e => e.IdOrigineDemande).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique(); entity.HasIndex(e => e.Libelle).IsUnique();
}); });
modelBuilder.Entity<OrigineFormation>(entity => modelBuilder.Entity<OrigineFormation>(entity =>
{ {
entity.HasKey(e => e.Id); entity.HasKey(e => e.IdOrigineFormation);
entity.Property(e => e.Id).ValueGeneratedOnAdd(); entity.Property(e => e.IdOrigineFormation).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique(); entity.HasIndex(e => e.Libelle).IsUnique();
}); });
modelBuilder.Entity<ParticipationFormation>(entity => modelBuilder.Entity<ParticipationFormation>(entity =>
{ {
entity.HasKey(e => e.Id); entity.HasKey(e => e.IdParticipationFormation);
entity.Property(e => e.Id).ValueGeneratedOnAdd(); entity.Property(e => e.IdParticipationFormation).ValueGeneratedOnAdd();
entity.HasMany<Saisie>(e => e.Evaluation).WithOne(e => e.ParticipationFormation); entity.HasMany<Saisie>(e => e.Evaluation).WithOne(e => e.ParticipationFormation);
}); });
modelBuilder.Entity<StatutFormation>(entity => modelBuilder.Entity<StatutFormation>(entity =>
{ {
entity.HasKey(e => e.Id); entity.HasKey(e => e.IdStatutFormation);
entity.Property(e => e.Id).ValueGeneratedOnAdd(); entity.Property(e => e.IdStatutFormation).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<Theme>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique(); entity.HasIndex(e => e.Libelle).IsUnique();
}); });
modelBuilder.Entity<TypeFormation>(entity => modelBuilder.Entity<TypeFormation>(entity =>
{ {
entity.HasKey(e => e.Id); entity.HasKey(e => e.IdTypeFormation);
entity.Property(e => e.Id).ValueGeneratedOnAdd(); entity.Property(e => e.IdTypeFormation).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique(); entity.HasIndex(e => e.Libelle).IsUnique();
}); });

@ -1,4 +1,5 @@
using EPAServeur.Models.EP; using EPAServeur.Models.EP;
using IO.Swagger.Enum;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -6,17 +7,66 @@ using System.Threading.Tasks;
namespace EPAServeur.Models.Formation namespace EPAServeur.Models.Formation
{ {
/// <summary>
/// Demande de formation effectuées par le référent à la suite de l’EP.
/// </summary>
public class DemandeFormation public class DemandeFormation
{ {
public long Id { get; set; } /// <summary>
/// Id de la demande de formation
/// </summary>
public long IdDemandeFormation { get; set; }
/// <summary>
/// Libellé de la demande de formation
/// </summary>
public string Libelle { get; set; }
/// <summary>
/// Description détaillée de la demande de formation
/// </summary>
public string Description { get; set; } public string Description { get; set; }
public DateTime DateDemande { get; set; }
/// <summary>
/// Indique s’il s’agit d’une demande de formation créée par une RH ou non
/// </summary>
public bool DemandeRH { get; set; } public bool DemandeRH { get; set; }
public bool? Reponse { get; set; }
/// <summary>
/// Date à laquelle la demande a été effectuée
/// </summary>
public DateTime DateDemande { get; set; }
/// <summary>
/// Etat de la demande de formation
/// </summary>
public EtatDemande Etat { get; set; }
/// <summary>
/// Commentaire expliquant la raison pour laquelle la demande de formation a été refusée
/// </summary>
public string CommentaireRefus { get; set; } public string CommentaireRefus { get; set; }
public DateTime DateDerniereReponse { get; set; }
/// <summary>
/// Date à laquelle la demande de formation a reçu une réponse pour la dernière fois
/// </summary>
public DateTime? DateDerniereReponse { get; set; }
/// <summary>
/// Ep qui est lié à la demande de formation
/// </summary>
public Ep Ep { get; set; } public Ep Ep { get; set; }
/// <summary>
/// Participation d’un collaborateur à une formation qui est liée à la demande de formation
/// </summary>
public ParticipationFormation ParticipationFormation { get; set; } public ParticipationFormation ParticipationFormation { get; set; }
/// <summary>
/// Origine de formation qui est liée à la demande de formation
/// </summary>
public OrigineFormation OrigineFormation { get; set; } public OrigineFormation OrigineFormation { get; set; }
} }
} }

@ -5,20 +5,80 @@ using System.Threading.Tasks;
namespace EPAServeur.Models.Formation namespace EPAServeur.Models.Formation
{ {
/// <summary>
/// Formation pour les collaborateurs.
/// </summary>
public class Formation public class Formation
{ {
public long Id { get; set; } /// <summary>
/// Id de la formation
/// </summary>
public long IdFormation { get; set; }
/// <summary>
/// Intitulé de la formation
/// </summary>
public string Intitule { get; set; } public string Intitule { get; set; }
/// <summary>
/// Id de l’agence de la RH qui a créé la formation
/// </summary>
public long IdAgence { get; set; } public long IdAgence { get; set; }
/// <summary>
///
/// </summary>
public DateTime DateDebut { get; set; } public DateTime DateDebut { get; set; }
/// <summary>
///
/// </summary>
public DateTime DateFin { get; set; } public DateTime DateFin { get; set; }
/// <summary>
/// Nombre de jours total de formation
/// </summary>
public int Jour { get; set; } public int Jour { get; set; }
/// <summary>
/// Nombre d’heure total de formation
/// </summary>
public int Heure { get; set; } public int Heure { get; set; }
/// <summary>
/// Organisme en charge d’effectuer la formation
/// </summary>
public string Organisme { get; set; } public string Organisme { get; set; }
/// <summary>
/// Indique qu’il s’agit d’une formation certifiée ou non
/// </summary>
public bool EstCertifiee { get; set; } public bool EstCertifiee { get; set; }
/// <summary>
/// Indique que la formation a bien été effectuée ou non
/// </summary>
public bool EstRealisee { get; set; }
/// <summary>
/// Statut de formation qui est lié à la formation
/// </summary>
public StatutFormation Statut { get; set; } public StatutFormation Statut { get; set; }
/// <summary>
/// Origine de formation qui est liée à la formation
/// </summary>
public OrigineFormation Origine { get; set; } public OrigineFormation Origine { get; set; }
/// <summary>
/// Mode de formation qui est lié à la formation
/// </summary>
public ModeFormation ModeFormation { get; set; } public ModeFormation ModeFormation { get; set; }
/// <summary>
/// Type de formation qui est lié à la formation
/// </summary>
public TypeFormation TypeFormation { get; set; } public TypeFormation TypeFormation { get; set; }
} }
} }

@ -5,10 +5,24 @@ using System.Threading.Tasks;
namespace EPAServeur.Models.Formation namespace EPAServeur.Models.Formation
{ {
/// <summary>
/// Mode d’une formation.
/// </summary>
public class ModeFormation public class ModeFormation
{ {
public int Id { get; set; } /// <summary>
/// Id du mode de la formation
/// </summary>
public int IdModeFormation { get; set; }
/// <summary>
/// Libellé du mode de la formation
/// </summary>
public string Libelle { get; set; } public string Libelle { get; set; }
/// <summary>
/// Formations qui sont liées au mode
/// </summary>
public List<Formation> Formations { get; set; } public List<Formation> Formations { get; set; }
} }
} }

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EPAServeur.Models.Formation
{
/// <summary>
/// Raison pour laquelle la demande de formation a été faite.
/// </summary>
public class OrigineDemande
{
/// <summary>
/// Id de l’origine de la demande de formation
/// </summary>
public int IdOrigineDemande { get; set; }
/// <summary>
/// Libellé de l’origine de la demande de formation
/// </summary>
public string Libelle { get; set; }
/// <summary>
/// Liste des demandes de formation qui sont liées à l'origine de formation
/// </summary>
public List<DemandeFormation> DemandeFormations { get; set; }
}
}

@ -1,14 +0,0 @@
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<DemandeFormation> DemandeFormations { get; set; }
}
}

@ -5,10 +5,24 @@ using System.Threading.Tasks;
namespace EPAServeur.Models.Formation namespace EPAServeur.Models.Formation
{ {
/// <summary>
/// Origine d’une formation.
/// </summary>
public class OrigineFormation public class OrigineFormation
{ {
public int Id { get; set; } /// <summary>
/// Id de l’origine de la formation
/// </summary>
public int IdOrigineFormation { get; set; }
/// <summary>
/// Libellé de l’origine de la formation
/// </summary>
public string Libelle { get; set; } public string Libelle { get; set; }
/// <summary>
/// Formations qui sont liées à l'origine
/// </summary>
public List<Formation> Formations { get; set; } public List<Formation> Formations { get; set; }
} }
} }

@ -6,14 +6,44 @@ using System.Threading.Tasks;
namespace EPAServeur.Models.Formation namespace EPAServeur.Models.Formation
{ {
/// <summary>
/// Représentation de la participation d’un collaborateur à une formation.
/// </summary>
public class ParticipationFormation public class ParticipationFormation
{ {
public long Id { get; set; } /// <summary>
/// Id de la participation à la formation
/// </summary>
public long IdParticipationFormation { get; set; }
/// <summary>
/// Date à laquelle la participation a été créée
/// </summary>
public DateTime DateCreation { get; set; } public DateTime DateCreation { get; set; }
/// <summary>
/// Indique si le collaborateur a effectué l’évaluation de la formation
/// </summary>
public bool EstEvaluee { get; set; } public bool EstEvaluee { get; set; }
public long DemandeFormationId { get; set; }
/// <summary>
/// Id de la demande de formation
/// </summary>
public long IdDemandeFormation { get; set; }
/// <summary>
/// Demande de formation qui est lié à la participation d’un collaborateur à une formation
/// </summary>
public DemandeFormation DemandeFormation { get; set; } public DemandeFormation DemandeFormation { get; set; }
/// <summary>
/// Formation qui est lié à la participation d’un collaborateur à une formation
/// </summary>
public Formation Formation { get; set; } public Formation Formation { get; set; }
/// <summary>
/// Liste des évaluations qui sont liées à la participation d’un collaborateur à une formation
/// </summary>
public List<Saisie> Evaluation { get; set; } public List<Saisie> Evaluation { get; set; }
} }
} }

@ -5,10 +5,24 @@ using System.Threading.Tasks;
namespace EPAServeur.Models.Formation namespace EPAServeur.Models.Formation
{ {
/// <summary>
/// Statut d'une formation
/// </summary>
public class StatutFormation public class StatutFormation
{ {
public int Id { get; set; } /// <summary>
/// Id du statut de la formation
/// </summary>
public int IdStatutFormation { get; set; }
/// <summary>
/// Libellé du statut de la formation
/// </summary>
public string Libelle { get; set; } public string Libelle { get; set; }
/// <summary>
/// Formations qui sont liées au statut
/// </summary>
public List<Formation> Formations { get; set; } public List<Formation> Formations { get; set; }
} }
} }

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EPAServeur.Models.Formation
{
public class Theme
{
public int Id { get; set; }
public string Libelle { get; set; }
}
}

@ -5,10 +5,24 @@ using System.Threading.Tasks;
namespace EPAServeur.Models.Formation namespace EPAServeur.Models.Formation
{ {
/// <summary>
/// Type d’une formation.
/// </summary>
public class TypeFormation public class TypeFormation
{ {
public int Id { get; set; } /// <summary>
/// Id du type de la formation
/// </summary>
public int IdTypeFormation { get; set; }
/// <summary>
/// Libellé du type de la formation
/// </summary>
public string Libelle { get; set; } public string Libelle { get; set; }
/// <summary>
/// Formations qui sont liées au type
/// </summary>
public List<Formation> Formations { get; set; } public List<Formation> Formations { get; set; }
} }
} }

@ -45,7 +45,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.FirstOrDefault(formation => formation.Id == idFormation); .FirstOrDefault(formation => formation.IdFormation == idFormation);
if (formation == null) if (formation == null)
throw new FormationNotFoundException(); throw new FormationNotFoundException();
@ -64,7 +64,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.FirstOrDefaultAsync(formation => formation.Id == idFormation); .FirstOrDefaultAsync(formation => formation.IdFormation == idFormation);
if (formation == null) if (formation == null)
throw new FormationNotFoundException(); throw new FormationNotFoundException();
@ -102,7 +102,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.Where(formation => formation.Statut.Id == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take); .Where(formation => formation.Statut.IdStatutFormation == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take);
} }
else if (statutFormation != null && idAgence == null) else if (statutFormation != null && idAgence == null)
{ {
@ -111,7 +111,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.Where(formation => formation.Statut.Id == statutFormation).Skip(skip).Take(take); .Where(formation => formation.Statut.IdStatutFormation == statutFormation).Skip(skip).Take(take);
} }
else if (idAgence != null) else if (idAgence != null)
{ {
@ -164,7 +164,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.Where(formation => formation.Statut.Id == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take).ToListAsync(); .Where(formation => formation.Statut.IdStatutFormation == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take).ToListAsync();
} }
else if (statutFormation != null && idAgence == null) else if (statutFormation != null && idAgence == null)
{ {
@ -173,7 +173,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.Where(formation => formation.Statut.Id == statutFormation).Skip(skip).Take(take).ToListAsync(); .Where(formation => formation.Statut.IdStatutFormation == statutFormation).Skip(skip).Take(take).ToListAsync();
} }
else if (idAgence != null) else if (idAgence != null)
{ {
@ -224,13 +224,13 @@ namespace EPAServeur.Services
int take = parPAge.Value; int take = parPAge.Value;
if (idAgence != null) if (idAgence != null)
formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.Id == 4) formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.IdStatutFormation == 4)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).Skip(skip).Take(take); .Include(formation => formation.TypeFormation).Skip(skip).Take(take);
else else
formations = epContext.Formation.Where(formation => formation.Statut.Id == 4) formations = epContext.Formation.Where(formation => formation.Statut.IdStatutFormation == 4)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -265,13 +265,13 @@ namespace EPAServeur.Services
int take = parPAge.Value; int take = parPAge.Value;
if (idAgence != null) if (idAgence != null)
formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.Id == 4) formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.IdStatutFormation == 4)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync(); .Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync();
else else
formations = await epContext.Formation.Where(formation => formation.Statut.Id == 4) formations = await epContext.Formation.Where(formation => formation.Statut.IdStatutFormation == 4)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -308,7 +308,7 @@ namespace EPAServeur.Services
if (idAgence != null) if (idAgence != null)
{ {
formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.Id == 3) formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.IdStatutFormation == 3)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -318,7 +318,7 @@ namespace EPAServeur.Services
else else
{ {
formations = epContext.Formation.Where(formation => formation.Statut.Id == 3) formations = epContext.Formation.Where(formation => formation.Statut.IdStatutFormation == 3)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -357,7 +357,7 @@ namespace EPAServeur.Services
if (idAgence != null) if (idAgence != null)
{ {
formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.Id == 3) formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.IdStatutFormation == 3)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -367,7 +367,7 @@ namespace EPAServeur.Services
else else
{ {
formations = await epContext.Formation.Where(formation => formation.Statut.Id == 3) formations = await epContext.Formation.Where(formation => formation.Statut.IdStatutFormation == 3)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -404,7 +404,7 @@ namespace EPAServeur.Services
if (idAgence != null) if (idAgence != null)
{ {
formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && (formation.Statut.Id == 1 || formation.Statut.Id == 2)) formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && (formation.Statut.IdStatutFormation == 1 || formation.Statut.IdStatutFormation == 2))
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -413,7 +413,7 @@ namespace EPAServeur.Services
} }
else else
{ {
formations = epContext.Formation.Where(formation => (formation.Statut.Id == 1 || formation.Statut.Id == 2)) formations = epContext.Formation.Where(formation => (formation.Statut.IdStatutFormation == 1 || formation.Statut.IdStatutFormation == 2))
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -450,7 +450,7 @@ namespace EPAServeur.Services
if (idAgence != null) if (idAgence != null)
{ {
formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && (formation.Statut.Id == 1 || formation.Statut.Id == 2)) formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && (formation.Statut.IdStatutFormation == 1 || formation.Statut.IdStatutFormation == 2))
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -460,7 +460,7 @@ namespace EPAServeur.Services
else else
{ {
formations = await epContext.Formation.Where(formation => (formation.Statut.Id == 1 || formation.Statut.Id == 2)) formations = await epContext.Formation.Where(formation => (formation.Statut.IdStatutFormation == 1 || formation.Statut.IdStatutFormation == 2))
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
@ -758,10 +758,10 @@ namespace EPAServeur.Services
|| string.IsNullOrWhiteSpace(formation.Intitule) || string.IsNullOrWhiteSpace(formation.Organisme) || string.IsNullOrWhiteSpace(formation.Intitule) || string.IsNullOrWhiteSpace(formation.Organisme)
|| !formation.DateDebut.HasValue || !formation.DateFin.HasValue || formation.DateDebut.Value > formation.DateFin.Value || !formation.DateDebut.HasValue || !formation.DateFin.HasValue || formation.DateDebut.Value > formation.DateFin.Value
|| !formation.Statut.Id.HasValue || !formation.Mode.Id.HasValue || !formation.Origine.Id.HasValue || !formation.Type.Id.HasValue || !formation.Statut.Id.HasValue || !formation.Mode.Id.HasValue || !formation.Origine.Id.HasValue || !formation.Type.Id.HasValue
|| !epContext.StatutFormation.Any(statut => statut.Id == formation.Statut.Id.Value && statut.Libelle == formation.Statut.Libelle) || !epContext.StatutFormation.Any(statut => statut.IdStatutFormation == formation.Statut.Id.Value && statut.Libelle == formation.Statut.Libelle)
|| !epContext.ModeFormation.Any(mode => mode.Id == formation.Mode.Id.Value && mode.Libelle == formation.Mode.Libelle) || !epContext.ModeFormation.Any(mode => mode.IdModeFormation == formation.Mode.Id.Value && mode.Libelle == formation.Mode.Libelle)
|| !epContext.OrigineFormation.Any(origine => origine.Id == formation.Origine.Id.Value && origine.Libelle == formation.Origine.Libelle) || !epContext.OrigineFormation.Any(origine => origine.IdOrigineFormation == formation.Origine.Id.Value && origine.Libelle == formation.Origine.Libelle)
|| !epContext.TypeFormation.Any(type => type.Id == formation.Type.Id.Value && type.Libelle == formation.Type.Libelle)); || !epContext.TypeFormation.Any(type => type.IdTypeFormation == formation.Type.Id.Value && type.Libelle == formation.Type.Libelle));
} }
/// <summary> /// <summary>
@ -777,10 +777,10 @@ namespace EPAServeur.Services
|| string.IsNullOrWhiteSpace(formation.Intitule) || string.IsNullOrWhiteSpace(formation.Organisme) || string.IsNullOrWhiteSpace(formation.Intitule) || string.IsNullOrWhiteSpace(formation.Organisme)
|| !formation.DateDebut.HasValue || !formation.DateFin.HasValue || formation.DateDebut.Value > formation.DateFin.Value || !formation.DateDebut.HasValue || !formation.DateFin.HasValue || formation.DateDebut.Value > formation.DateFin.Value
|| !formation.Statut.Id.HasValue || !formation.Mode.Id.HasValue || !formation.Origine.Id.HasValue || !formation.Type.Id.HasValue || !formation.Statut.Id.HasValue || !formation.Mode.Id.HasValue || !formation.Origine.Id.HasValue || !formation.Type.Id.HasValue
|| ! await epContext.StatutFormation.AnyAsync(statut => statut.Id == formation.Statut.Id.Value && statut.Libelle == formation.Statut.Libelle) || ! await epContext.StatutFormation.AnyAsync(statut => statut.IdStatutFormation == formation.Statut.Id.Value && statut.Libelle == formation.Statut.Libelle)
|| ! await epContext.ModeFormation.AnyAsync(mode => mode.Id == formation.Mode.Id.Value && mode.Libelle == formation.Mode.Libelle) || ! await epContext.ModeFormation.AnyAsync(mode => mode.IdModeFormation == formation.Mode.Id.Value && mode.Libelle == formation.Mode.Libelle)
|| ! await epContext.OrigineFormation.AnyAsync(origine => origine.Id == formation.Origine.Id.Value && origine.Libelle == formation.Origine.Libelle) || ! await epContext.OrigineFormation.AnyAsync(origine => origine.IdOrigineFormation == formation.Origine.Id.Value && origine.Libelle == formation.Origine.Libelle)
|| ! await epContext.TypeFormation.AnyAsync(type => type.Id == formation.Type.Id.Value && type.Libelle == formation.Type.Libelle)); || ! await epContext.TypeFormation.AnyAsync(type => type.IdTypeFormation == formation.Type.Id.Value && type.Libelle == formation.Type.Libelle));
} }
#region Object to DTO #region Object to DTO
/// <summary> /// <summary>
@ -792,7 +792,7 @@ namespace EPAServeur.Services
{ {
FormationDTO formationDTO = new FormationDTO() FormationDTO formationDTO = new FormationDTO()
{ {
Id = formation.Id, Id = formation.IdFormation,
Intitule = formation.Intitule, Intitule = formation.Intitule,
IdAgence = formation.IdAgence, IdAgence = formation.IdAgence,
DateDebut = formation.DateDebut, DateDebut = formation.DateDebut,
@ -821,7 +821,7 @@ namespace EPAServeur.Services
return null; return null;
OrigineFormationDTO origineFormationDTO = new OrigineFormationDTO() OrigineFormationDTO origineFormationDTO = new OrigineFormationDTO()
{ {
Id = origineFormation.Id, Id = origineFormation.IdOrigineFormation,
Libelle = origineFormation.Libelle Libelle = origineFormation.Libelle
}; };
return origineFormationDTO; return origineFormationDTO;
@ -838,7 +838,7 @@ namespace EPAServeur.Services
return null; return null;
StatutFormationDTO statutFormationDTO = new StatutFormationDTO() StatutFormationDTO statutFormationDTO = new StatutFormationDTO()
{ {
Id = statutFormation.Id, Id = statutFormation.IdStatutFormation,
Libelle = statutFormation.Libelle Libelle = statutFormation.Libelle
}; };
return statutFormationDTO; return statutFormationDTO;
@ -855,7 +855,7 @@ namespace EPAServeur.Services
return null; return null;
ModeFormationDTO modeFormationDTO = new ModeFormationDTO() ModeFormationDTO modeFormationDTO = new ModeFormationDTO()
{ {
Id = modeFormation.Id, Id = modeFormation.IdModeFormation,
Libelle = modeFormation.Libelle Libelle = modeFormation.Libelle
}; };
return modeFormationDTO; return modeFormationDTO;
@ -871,7 +871,7 @@ namespace EPAServeur.Services
return null; return null;
TypeFormationDTO typeFormationDTO = new TypeFormationDTO() TypeFormationDTO typeFormationDTO = new TypeFormationDTO()
{ {
Id = typeFormation.Id, Id = typeFormation.IdTypeFormation,
Libelle = typeFormation.Libelle Libelle = typeFormation.Libelle
}; };
return typeFormationDTO; return typeFormationDTO;
@ -914,7 +914,7 @@ namespace EPAServeur.Services
{ {
OrigineFormation origineFormation = new OrigineFormation() OrigineFormation origineFormation = new OrigineFormation()
{ {
Id = origineFormationDTO.Id.Value, IdOrigineFormation = origineFormationDTO.Id.Value,
Libelle = origineFormationDTO.Libelle Libelle = origineFormationDTO.Libelle
}; };
return origineFormation; return origineFormation;
@ -929,7 +929,7 @@ namespace EPAServeur.Services
{ {
StatutFormation statutFormation = new StatutFormation() StatutFormation statutFormation = new StatutFormation()
{ {
Id = statutFormationDTO.Id.Value, IdStatutFormation = statutFormationDTO.Id.Value,
Libelle = statutFormationDTO.Libelle Libelle = statutFormationDTO.Libelle
}; };
return statutFormation; return statutFormation;
@ -944,7 +944,7 @@ namespace EPAServeur.Services
{ {
ModeFormation modeFormation = new ModeFormation() ModeFormation modeFormation = new ModeFormation()
{ {
Id = modeFormationDTO.Id.Value, IdModeFormation = modeFormationDTO.Id.Value,
Libelle = modeFormationDTO.Libelle Libelle = modeFormationDTO.Libelle
}; };
return modeFormation; return modeFormation;
@ -959,7 +959,7 @@ namespace EPAServeur.Services
{ {
TypeFormation typeFormation = new TypeFormation() TypeFormation typeFormation = new TypeFormation()
{ {
Id = typeFormationDTO.Id.Value, IdTypeFormation = typeFormationDTO.Id.Value,
Libelle = typeFormationDTO.Libelle Libelle = typeFormationDTO.Libelle
}; };
return typeFormation; return typeFormation;

Loading…
Cancel
Save