|
|
|
@ -1,28 +1,42 @@ |
|
|
|
|
using EPAServeur.Context; |
|
|
|
|
using EPAServeur.IServices; |
|
|
|
|
using EPAServeur.Models.Formation; |
|
|
|
|
using IO.Swagger.ApiCollaborateur; |
|
|
|
|
using IO.Swagger.DTO; |
|
|
|
|
using IO.Swagger.ModelCollaborateur; |
|
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
using Microsoft.EntityFrameworkCore.ChangeTracking; |
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Runtime.InteropServices.ComTypes; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
|
|
namespace EPAServeur.Services |
|
|
|
|
{ |
|
|
|
|
public class FormationService : IFormationService |
|
|
|
|
{ |
|
|
|
|
#region Variables |
|
|
|
|
|
|
|
|
|
private readonly EpContext epContext; |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region Contructeurs |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Constructeur de la classe FormationService |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="_epContext"></param> |
|
|
|
|
public FormationService(EpContext _epContext) |
|
|
|
|
{ |
|
|
|
|
epContext = _epContext; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region Méthodes Service |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupérer une formation par son id |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public FormationDTO GetFormationById(decimal? id) |
|
|
|
|
{ |
|
|
|
|
int idFormation = 0; |
|
|
|
@ -33,7 +47,7 @@ namespace EPAServeur.Services |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
return null; |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Formation formation = epContext.Formation.Include(formation => formation.Statut) |
|
|
|
@ -48,6 +62,16 @@ namespace EPAServeur.Services |
|
|
|
|
return GetFormationDTO(formation); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupérer la liste des formations |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="asc">Préciser si les données sont dans l'ordre (true) ou dans l'ordre inverse (false)</param> |
|
|
|
|
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param> |
|
|
|
|
/// <param name="parPAge">Nombre d'éléments affiché sur chaque page du tableau</param> |
|
|
|
|
/// <param name="idAgence">id de l'agence à laquelle sont rattachées les données à récupérer</param> |
|
|
|
|
/// <param name="texte">Texte permettant d'identifier l'objet rechercher</param> |
|
|
|
|
/// <param name="tri">Colonne du tableau sur lequel le tri s'effectue</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public IEnumerable<FormationDTO> GetFormations(bool? asc, int? numPage, int? parPAge, int? idAgence, string texte, string tri) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<Formation> formations; |
|
|
|
@ -62,16 +86,35 @@ namespace EPAServeur.Services |
|
|
|
|
int take = parPAge.Value; |
|
|
|
|
|
|
|
|
|
if (idAgence != null) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence) |
|
|
|
|
.Include(formation => formation.Statut) |
|
|
|
|
.Include(formation => formation.ModeFormation) |
|
|
|
|
.Include(formation => formation.Origine) |
|
|
|
|
.Include(formation => formation.TypeFormation); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
formations = epContext.Formation.Include(formation => formation.Statut) |
|
|
|
|
.Include(formation => formation.ModeFormation) |
|
|
|
|
.Include(formation => formation.Origine) |
|
|
|
|
.Include(formation => formation.TypeFormation); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (formations == null) |
|
|
|
|
return new List<FormationDTO>(); |
|
|
|
@ -81,7 +124,16 @@ namespace EPAServeur.Services |
|
|
|
|
return formationDTOs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupérer les formations annulées |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="asc">Préciser si les données sont dans l'ordre (true) ou dans l'ordre inverse (false)</param> |
|
|
|
|
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param> |
|
|
|
|
/// <param name="parPAge">Nombre d'éléments affiché sur chaque page du tableau</param> |
|
|
|
|
/// <param name="idAgence">id de l'agence à laquelle sont rattachées les données à récupérer</param> |
|
|
|
|
/// <param name="texte">Texte permettant d'identifier l'objet rechercher</param> |
|
|
|
|
/// <param name="tri">Colonne du tableau sur lequel le tri s'effectue</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public IEnumerable<FormationDTO> GetFormationAnnulees(bool? asc, int? numPage, int? parPAge, int? idAgence, string texte, string tri) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<Formation> formations; |
|
|
|
@ -116,6 +168,16 @@ namespace EPAServeur.Services |
|
|
|
|
return formationDTOs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupérer les formations réalisées |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="asc">Préciser si les données sont dans l'ordre (true) ou dans l'ordre inverse (false)</param> |
|
|
|
|
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param> |
|
|
|
|
/// <param name="parPAge">Nombre d'éléments affiché sur chaque page du tableau</param> |
|
|
|
|
/// <param name="idAgence">id de l'agence à laquelle sont rattachées les données à récupérer</param> |
|
|
|
|
/// <param name="texte">Texte permettant d'identifier l'objet rechercher</param> |
|
|
|
|
/// <param name="tri">Colonne du tableau sur lequel le tri s'effectue</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public IEnumerable<FormationDTO> GetFormationRealisee(bool? asc, int? numPage, int? parPAge, int? idAgence, string texte, string tri) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<Formation> formations; |
|
|
|
@ -130,17 +192,37 @@ namespace EPAServeur.Services |
|
|
|
|
int take = parPAge.Value; |
|
|
|
|
|
|
|
|
|
if (idAgence != null) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.Id == 3) |
|
|
|
|
.Include(formation => formation.Statut) |
|
|
|
|
.Include(formation => formation.ModeFormation) |
|
|
|
|
.Include(formation => formation.Origine) |
|
|
|
|
.Include(formation => formation.TypeFormation); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
formations = epContext.Formation.Where(formation => formation.Statut.Id == 3) |
|
|
|
|
.Include(formation => formation.Statut) |
|
|
|
|
.Include(formation => formation.ModeFormation) |
|
|
|
|
.Include(formation => formation.Origine) |
|
|
|
|
.Include(formation => formation.TypeFormation); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (formations == null) |
|
|
|
|
return new List<FormationDTO>(); |
|
|
|
@ -150,6 +232,16 @@ namespace EPAServeur.Services |
|
|
|
|
return formationDTOs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupérer les formations plannifiées et replannifiées |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="asc">Préciser si les données sont dans l'ordre (true) ou dans l'ordre inverse (false)</param> |
|
|
|
|
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param> |
|
|
|
|
/// <param name="parPAge">Nombre d'éléments affiché sur chaque page du tableau</param> |
|
|
|
|
/// <param name="idAgence">id de l'agence à laquelle sont rattachées les données à récupérer</param> |
|
|
|
|
/// <param name="texte">Texte permettant d'identifier l'objet rechercher</param> |
|
|
|
|
/// <param name="tri">Colonne du tableau sur lequel le tri s'effectue</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public IEnumerable<FormationDTO> GetProchainesFormation(bool? asc, int? numPage, int? parPAge, int? idAgence, string texte, string tri) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<Formation> formations; |
|
|
|
@ -164,17 +256,27 @@ namespace EPAServeur.Services |
|
|
|
|
int take = parPAge.Value; |
|
|
|
|
|
|
|
|
|
if (idAgence != null) |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && (formation.Statut.Id == 1 || formation.Statut.Id == 2)) |
|
|
|
|
.Include(formation => formation.Statut) |
|
|
|
|
.Include(formation => formation.ModeFormation) |
|
|
|
|
.Include(formation => formation.Origine) |
|
|
|
|
.Include(formation => formation.TypeFormation); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
formations = epContext.Formation.Where(formation => (formation.Statut.Id == 1 || formation.Statut.Id == 2)) |
|
|
|
|
.Include(formation => formation.Statut) |
|
|
|
|
.Include(formation => formation.ModeFormation) |
|
|
|
|
.Include(formation => formation.Origine) |
|
|
|
|
.Include(formation => formation.TypeFormation); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (formations == null) |
|
|
|
|
return new List<FormationDTO>(); |
|
|
|
@ -184,38 +286,103 @@ namespace EPAServeur.Services |
|
|
|
|
return formationDTOs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupérer les modes de formation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public IEnumerable<ModeFormationDTO> GetModesFormation() |
|
|
|
|
{ |
|
|
|
|
IEnumerable<ModeFormation> modeFormations = epContext.ModeFormation; |
|
|
|
|
IEnumerable<ModeFormationDTO> modeFormationDTOs = modeFormations.Select(modeFormation => GetModeFormationDTO(modeFormation)); |
|
|
|
|
IEnumerable<ModeFormation> modeFormations; |
|
|
|
|
IEnumerable<ModeFormationDTO> modeFormationDTOs; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
modeFormations = epContext.ModeFormation; |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
modeFormationDTOs = modeFormations.Select(modeFormation => GetModeFormationDTO(modeFormation)); |
|
|
|
|
|
|
|
|
|
return modeFormationDTOs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupérer les origines de formation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public IEnumerable<OrigineFormationDTO> GetOriginesFormation() |
|
|
|
|
{ |
|
|
|
|
IEnumerable<OrigineFormation> origineFormations = epContext.OrigineFormation; |
|
|
|
|
IEnumerable<OrigineFormationDTO> origineFormationDTOs = origineFormations.Select(origineFormation => GetOrigineFormationDTO(origineFormation)); |
|
|
|
|
IEnumerable<OrigineFormation> origineFormations; |
|
|
|
|
IEnumerable<OrigineFormationDTO> origineFormationDTOs; |
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
origineFormations = epContext.OrigineFormation; |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
origineFormationDTOs = origineFormations.Select(origineFormation => GetOrigineFormationDTO(origineFormation)); |
|
|
|
|
|
|
|
|
|
return origineFormationDTOs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupérer les statuts de formation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public IEnumerable<StatutFormationDTO> GetStatutsFormation() |
|
|
|
|
{ |
|
|
|
|
IEnumerable<StatutFormation> statutFormations = epContext.StatutFormation; |
|
|
|
|
IEnumerable<StatutFormationDTO> statutFormationDTOs = statutFormations.Select(statutFormation => GetStatutFormationDTO(statutFormation)); |
|
|
|
|
IEnumerable<StatutFormation> statutFormations; |
|
|
|
|
IEnumerable<StatutFormationDTO> statutFormationDTOs; |
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
statutFormations = epContext.StatutFormation; |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
statutFormationDTOs = statutFormations.Select(statutFormation => GetStatutFormationDTO(statutFormation)); |
|
|
|
|
|
|
|
|
|
return statutFormationDTOs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupérer les types de formation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public IEnumerable<TypeFormationDTO> GetTypesFormation() |
|
|
|
|
{ |
|
|
|
|
IEnumerable<TypeFormation> typeFormations = epContext.TypeFormation; |
|
|
|
|
IEnumerable<TypeFormationDTO> typeFormationDTOs = typeFormations.Select(typeFormation => GetTypeFormationDTO(typeFormation)); |
|
|
|
|
IEnumerable<TypeFormation> typeFormations; |
|
|
|
|
IEnumerable<TypeFormationDTO> typeFormationDTOs; |
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
typeFormations = epContext.TypeFormation; |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
typeFormationDTOs = typeFormations.Select(typeFormation => GetTypeFormationDTO(typeFormation)); |
|
|
|
|
|
|
|
|
|
return typeFormationDTOs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Ajouter une formation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="formationDTO"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public FormationDTO AddFormation(FormationDTO formationDTO) |
|
|
|
|
{ |
|
|
|
|
Formation formation = new Formation(); |
|
|
|
@ -235,14 +402,19 @@ namespace EPAServeur.Services |
|
|
|
|
{ |
|
|
|
|
epContext.SaveChanges(); |
|
|
|
|
} |
|
|
|
|
catch (Exception) |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
return null; |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return GetFormationDTO(formation); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Modifier une formation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="formationDTO"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public FormationDTO UpdateFormation(FormationDTO formationDTO) |
|
|
|
|
{ |
|
|
|
|
Formation formation = epContext.Formation.FirstOrDefault(formation => formation.Id == formationDTO.Id); |
|
|
|
@ -253,11 +425,23 @@ namespace EPAServeur.Services |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
formation = SetFormation(formation, formationDTO); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
epContext.SaveChanges(); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return GetFormationDTO(formation); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Supprimer une formation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public bool DeleteFormationById(decimal? id) |
|
|
|
|
{ |
|
|
|
|
int idFormation = 0; |
|
|
|
@ -276,13 +460,30 @@ namespace EPAServeur.Services |
|
|
|
|
if (formation == null) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
epContext.Remove(formation); |
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
epContext.SaveChanges(); |
|
|
|
|
} |
|
|
|
|
catch (Exception) |
|
|
|
|
{ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region Méthodes Privée |
|
|
|
|
|
|
|
|
|
#region Object to DTO |
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupère un objet FormationDTO en fonction d'un objet Formation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="formation"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private FormationDTO GetFormationDTO(Formation formation) |
|
|
|
|
{ |
|
|
|
|
FormationDTO formationDTO = new FormationDTO() |
|
|
|
@ -302,21 +503,14 @@ namespace EPAServeur.Services |
|
|
|
|
Type = GetTypeFormationDTO(formation.TypeFormation) |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//List<ParticipationFormationDTO> participationFormationDTOs = epContext.ParticipationFormation.Where(participationFormation => participationFormation.Formation.Id == formation.Id) |
|
|
|
|
// .Select(participationFormation => new ParticipationFormationDTO() |
|
|
|
|
// { |
|
|
|
|
// Id = participationFormation.Id, |
|
|
|
|
// DateCreation = participationFormation.DateCreation, |
|
|
|
|
// Formation = participationFormation.Formation.Intitule, |
|
|
|
|
// Date = participationFormation.Formation.DateDebut, |
|
|
|
|
// Statut = participationFormation.Formation.Statut.Libelle, |
|
|
|
|
// EstEvaluee = participationFormation.EstEvaluee, |
|
|
|
|
// }).ToList(); |
|
|
|
|
|
|
|
|
|
//formationDTO.ParticipantsFormation = participationFormationDTOs; |
|
|
|
|
return formationDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupère un objet OrigineFormationDTO en fonction d'un objet OrigineFormation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="origineFormation"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private OrigineFormationDTO GetOrigineFormationDTO(OrigineFormation origineFormation) |
|
|
|
|
{ |
|
|
|
|
if (origineFormation == null) |
|
|
|
@ -329,6 +523,11 @@ namespace EPAServeur.Services |
|
|
|
|
return origineFormationDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupère un objet StatutFormationDTO en fonction d'un objet StatutFormation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="statutFormation"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private StatutFormationDTO GetStatutFormationDTO(StatutFormation statutFormation) |
|
|
|
|
{ |
|
|
|
|
if (statutFormation == null) |
|
|
|
@ -341,6 +540,11 @@ namespace EPAServeur.Services |
|
|
|
|
return statutFormationDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupère un objet ModeFormationDTO en fonction d'un objet ModeFormation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="modeFormation"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private ModeFormationDTO GetModeFormationDTO(ModeFormation modeFormation) |
|
|
|
|
{ |
|
|
|
|
if (modeFormation == null) |
|
|
|
@ -352,6 +556,11 @@ namespace EPAServeur.Services |
|
|
|
|
}; |
|
|
|
|
return modeFormationDTO; |
|
|
|
|
} |
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupère un objet TypeFormationDTO en fonction d'un objet TypeFormation |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="typeFormation"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private TypeFormationDTO GetTypeFormationDTO(TypeFormation typeFormation) |
|
|
|
|
{ |
|
|
|
|
if (typeFormation == null) |
|
|
|
@ -367,6 +576,13 @@ namespace EPAServeur.Services |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region DTO to Object |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Modifie un objet Formation en fonction d'un objet FormationDTO |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="formation"></param> |
|
|
|
|
/// <param name="formationDTO"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private Formation SetFormation(Formation formation, FormationDTO formationDTO) |
|
|
|
|
{ |
|
|
|
|
formation.Intitule = formationDTO.Intitule; |
|
|
|
@ -382,23 +598,14 @@ namespace EPAServeur.Services |
|
|
|
|
formation.ModeFormation = GetModeFormation(formationDTO.Mode); |
|
|
|
|
formation.TypeFormation = GetTypeFormation(formationDTO.Type); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//List<ParticipationFormationDTO> participationFormationDTOs = epContext.ParticipationFormation.Where(participationFormation => participationFormation.Formation.Id == formation.Id) |
|
|
|
|
// .Select(participationFormation => new ParticipationFormationDTO() |
|
|
|
|
// { |
|
|
|
|
// Id = participationFormation.Id, |
|
|
|
|
// DateCreation = participationFormation.DateCreation, |
|
|
|
|
// Formation = participationFormation.Formation.Intitule, |
|
|
|
|
// Date = participationFormation.Formation.DateDebut, |
|
|
|
|
// Statut = participationFormation.Formation.Statut.Libelle, |
|
|
|
|
// EstEvaluee = participationFormation.EstEvaluee, |
|
|
|
|
// }).ToList(); |
|
|
|
|
|
|
|
|
|
//formationDTO.ParticipantsFormation = participationFormationDTOs; |
|
|
|
|
return formation; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupère un objet OrigineFormation en fonction d'un objet OrigineFormationDTO |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="origineFormationDTO"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private OrigineFormation GetOrigineFormation(OrigineFormationDTO origineFormationDTO) |
|
|
|
|
{ |
|
|
|
|
if (origineFormationDTO == null) |
|
|
|
@ -411,6 +618,11 @@ namespace EPAServeur.Services |
|
|
|
|
return origineFormation; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupère un objet StatutFormation en fonction d'un objet StatutFormationDTO |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="statutFormationDTO"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private StatutFormation GetStatutFormation(StatutFormationDTO statutFormationDTO) |
|
|
|
|
{ |
|
|
|
|
if (statutFormationDTO == null) |
|
|
|
@ -423,6 +635,11 @@ namespace EPAServeur.Services |
|
|
|
|
return statutFormation; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupère un objet ModeFormation en fonction d'un objet ModeFormationDTO |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="modeFormationDTO"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private ModeFormation GetModeFormation(ModeFormationDTO modeFormationDTO) |
|
|
|
|
{ |
|
|
|
|
if (modeFormationDTO == null) |
|
|
|
@ -434,6 +651,12 @@ namespace EPAServeur.Services |
|
|
|
|
}; |
|
|
|
|
return modeFormation; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Récupère un objet TypeFormation en fonction d'un objet TypeFormationDTO |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="typeFormationDTO"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private TypeFormation GetTypeFormation(TypeFormationDTO typeFormationDTO) |
|
|
|
|
{ |
|
|
|
|
if (typeFormationDTO == null) |
|
|
|
@ -448,5 +671,7 @@ namespace EPAServeur.Services |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|