|
|
@ -0,0 +1,370 @@ |
|
|
|
|
|
|
|
using EPAServeur.Context; |
|
|
|
|
|
|
|
using EPAServeur.Exceptions; |
|
|
|
|
|
|
|
using EPAServeur.IServices; |
|
|
|
|
|
|
|
using EPAServeur.Models.EP; |
|
|
|
|
|
|
|
using EPAServeur.Models.Formation; |
|
|
|
|
|
|
|
using EPAServeur.Models.SaisieChamp; |
|
|
|
|
|
|
|
using IO.Swagger.DTO; |
|
|
|
|
|
|
|
using IO.Swagger.Enum; |
|
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
|
|
|
using System; |
|
|
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace EPAServeur.Services |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
public class ParticipationFormationService : IParticipationFormationService |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#region Variables |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Accès et gestion de la base de données |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
private readonly EpContext epContext; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Accès et service collaborateur |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
private readonly ICollaborateurService collaborateurService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Contructeurs |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Constructeur de la classe FormationService |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="_epContext"></param> |
|
|
|
|
|
|
|
public ParticipationFormationService(EpContext _epContext, ICollaborateurService _collaborateurService) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
epContext = _epContext; |
|
|
|
|
|
|
|
collaborateurService = _collaborateurService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Méthodes Service |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récupérer une évaluation faite par un collaborateur. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="idParticipationFormation">Id d'une participation formation</param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
public async Task<EvaluationDTO> GetEvaluationCollaborateurAsync(long idParticipationFormation) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ParticipationFormation participationFormation; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
participationFormation = await epContext.ParticipationFormation |
|
|
|
|
|
|
|
.Include(participationFormation => participationFormation.Evaluation) |
|
|
|
|
|
|
|
.Include(participationFormation => participationFormation.Formation) |
|
|
|
|
|
|
|
.FirstOrDefaultAsync(participationFormation => participationFormation.IdParticipationFormation == idParticipationFormation); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (participationFormation == null) |
|
|
|
|
|
|
|
throw new ParticipationFormationNotFoundException(string.Format("Aucune participation formation trouvée avec l'id suivant: {0}.", idParticipationFormation)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return GetEvaluationDTO(participationFormation); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récupérer la liste des participations de formation d’un collaborateur. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="idCollaborateur">Id du collaborateur</param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
public async Task<IEnumerable<ParticipationFormationDTO>> GetParticipationByCollaborateurAsync(Guid idCollaborateur) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IQueryable<ParticipationFormation> query; |
|
|
|
|
|
|
|
IEnumerable<ParticipationFormation> participationFormations; |
|
|
|
|
|
|
|
IEnumerable<ParticipationFormationDTO> participationFormationDTOs; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
query = epContext.ParticipationFormation |
|
|
|
|
|
|
|
.Include(participationFormation => participationFormation.Evaluation) |
|
|
|
|
|
|
|
.Include(participationFormation => participationFormation.Formation) |
|
|
|
|
|
|
|
.ThenInclude(formation => formation.Statut) |
|
|
|
|
|
|
|
.Include(participationFormation => participationFormation.DemandeFormation) |
|
|
|
|
|
|
|
.ThenInclude(demandeFormation => demandeFormation.Ep) |
|
|
|
|
|
|
|
.Where(participationFormation => participationFormation.DemandeFormation.Ep.IdCollaborateur == idCollaborateur && participationFormation.DemandeFormation.Etat == EtatDemande.Validee); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
participationFormations = await query.ToListAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurDTOs = await GetCollaborateurDTOs(participationFormations); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
participationFormationDTOs = participationFormations.Select(participationFormation => GetParticipationFormationDTO(participationFormation, collaborateurDTOs)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return participationFormationDTOs; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Evaluer une formation. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="idParticipationFormation">Id d'une participation formation</param> |
|
|
|
|
|
|
|
/// <param name="evaluationDTO">Evaluation d'une formation</param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
public async Task<EvaluationDTO> EvaluerFormationAsync(long idParticipationFormation, EvaluationDTO evaluationDTO) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ParticipationFormation participationFormation; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!evaluationDTO.Id.HasValue || evaluationDTO.Id.Value != idParticipationFormation) |
|
|
|
|
|
|
|
throw new ParticipationFormationIncompatibleIdException("L'id de la participation formation a mettre à jour et la participation formation a mettre à jour sont incompatble."); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IsEvaluationValide(evaluationDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
participationFormation = await epContext.ParticipationFormation.Include(p => p.Evaluation) |
|
|
|
|
|
|
|
.FirstOrDefaultAsync(p => p.IdParticipationFormation == idParticipationFormation); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (participationFormation == null) |
|
|
|
|
|
|
|
throw new ParticipationFormationNotFoundException(string.Format("Aucune participation formation trouvée avec l'id suivant: {0}.", idParticipationFormation)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
participationFormation.Evaluation = evaluationDTO.Saisies.Select(s => GetSaisie(s)).ToList(); |
|
|
|
|
|
|
|
participationFormation.EstEvaluee = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await epContext.SaveChangesAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return GetEvaluationDTO(participationFormation); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Méthodes Privée |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Vérifier si un objet EvaluationDTO est valide pour une mise à jour |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <remarks> |
|
|
|
|
|
|
|
/// Un objet EvaluationDTO est valide si l'objet n'est pas null, si l'intitulé, la date de début et la valeur permettant de dire si la formation est certifiée ou non ne sont pas null, |
|
|
|
|
|
|
|
/// si l'évaluation possède au moins une saisie et si la saisie a une note |
|
|
|
|
|
|
|
/// </remarks> |
|
|
|
|
|
|
|
/// <param name="evaluation"></param> |
|
|
|
|
|
|
|
/// <returns>true si l'objet est valide, false sinon</returns> |
|
|
|
|
|
|
|
private void IsEvaluationValide(EvaluationDTO evaluation) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Vérifier que l'évaluation n'est pas null |
|
|
|
|
|
|
|
if (evaluation == null) |
|
|
|
|
|
|
|
throw new ParticipationFormationInvalidException("Aucune évaluation n'a été reçue."); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Vérifier que la formation a bien un intitulé |
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(evaluation.Intitule)) |
|
|
|
|
|
|
|
throw new ParticipationFormationInvalidException("L'intitulé de la formation doit contenir au moins 1 caractère."); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Vérifier que la formation a bien une valeur permettant de dire si la formation est certifiée ou non |
|
|
|
|
|
|
|
if (!evaluation.EstCertifie.HasValue) |
|
|
|
|
|
|
|
throw new ParticipationFormationInvalidException("Impossible d'évaluer une formation sans savoir si la formation est certfiée ou non."); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Vérifier que la formation a bien une date de début |
|
|
|
|
|
|
|
if (!evaluation.DateDebut.HasValue) |
|
|
|
|
|
|
|
throw new ParticipationFormationInvalidException("Impossible d'évaluer une formation sans date de début de formation."); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Vérifier que l'évaluation possède au moins une saisie |
|
|
|
|
|
|
|
if (evaluation.Saisies == null || evaluation.Saisies.Count == 0) |
|
|
|
|
|
|
|
throw new ParticipationFormationInvalidException("Impossible d'évaluer une formation sans saisie."); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Vérifier que l'évaluation possède une note pour chaque saisie |
|
|
|
|
|
|
|
if (evaluation.Saisies.Any(s => !s.Note.HasValue)) |
|
|
|
|
|
|
|
throw new ParticipationFormationInvalidException("Toutes les saisies doivent posséder une note."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Object to DTO |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récuperer un objet ParticipationFormationDTO en fonction d'un objet ParticipationFormation et d'une liste de CollaborateurDTO |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="participationFormation"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private ParticipationFormationDTO GetParticipationFormationDTO(ParticipationFormation participationFormation, IEnumerable<CollaborateurDTO> collaborateurDTOs) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ParticipationFormationDTO participationFormationDTO = new ParticipationFormationDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = participationFormation.IdParticipationFormation, |
|
|
|
|
|
|
|
DateCreation = participationFormation.DateCreation, |
|
|
|
|
|
|
|
Intitule = participationFormation.Formation.Intitule, |
|
|
|
|
|
|
|
DateDebut = participationFormation.Formation.DateDebut, |
|
|
|
|
|
|
|
Statut = GetStatutFormationDTO(participationFormation.Formation.Statut), |
|
|
|
|
|
|
|
Collaborateur = GetCollaborateurDTO(participationFormation, collaborateurDTOs), |
|
|
|
|
|
|
|
Ep = GetEpInformationDTO(participationFormation.DemandeFormation.Ep, collaborateurDTOs) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return participationFormationDTO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récuperer un objet EvaluationDTO en fonction d'un objet ParticipationFormation |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="participationFormation"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private EvaluationDTO GetEvaluationDTO(ParticipationFormation participationFormation) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
EvaluationDTO evaluationDTO = new EvaluationDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = participationFormation.IdParticipationFormation, |
|
|
|
|
|
|
|
Intitule = participationFormation.Formation.Intitule, |
|
|
|
|
|
|
|
DateDebut = participationFormation.Formation.DateDebut, |
|
|
|
|
|
|
|
EstCertifie = participationFormation.Formation.EstCertifiee, |
|
|
|
|
|
|
|
Saisies = participationFormation.Evaluation.Select(s => GetSaisieDTO(s)).ToList() |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return evaluationDTO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récuperer un objet SaisieDTO en fonction d'un objet Saisie |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="saisie"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private SaisieDTO GetSaisieDTO(Saisie saisie) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (saisie == null) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SaisieDTO saisieDTO = new SaisieDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = saisie.IdSaisie, |
|
|
|
|
|
|
|
Note = saisie.Note, |
|
|
|
|
|
|
|
Texte = saisie.Texte, |
|
|
|
|
|
|
|
Champ = GetChampDTO(saisie.Champ), |
|
|
|
|
|
|
|
TypeSaisie = saisie.TypeSaisie |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return saisieDTO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récuperer un objet ChampDTO en fonction d'un objet Champ |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="champ"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private ChampDTO GetChampDTO(Champ champ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (champ == null) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChampDTO champDTO = new ChampDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = champ.IdChamp, |
|
|
|
|
|
|
|
Texte = champ.Texte, |
|
|
|
|
|
|
|
Section = champ.Section, |
|
|
|
|
|
|
|
Soussection = champ.SousSection, |
|
|
|
|
|
|
|
Ordre = champ.Ordre, |
|
|
|
|
|
|
|
TypeChamp = champ.TypeChamp, |
|
|
|
|
|
|
|
TypeSaisie = champ.TypeSaisie |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return champDTO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récuperer un objet StatutFormationDTO en fonction d'un objet StatutFormation |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="statutFormation"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private StatutFormationDTO GetStatutFormationDTO(StatutFormation statutFormation) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (statutFormation == null) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
StatutFormationDTO statutFormationDTO = new StatutFormationDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = statutFormation.IdStatutFormation, |
|
|
|
|
|
|
|
Libelle = statutFormation.Libelle |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return statutFormationDTO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récuperer une liste de CollaborateurDTO contenant les collaborateurs et les référents. Retourne null s'il n'y a aucune participation. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="participationsFormation"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private async Task<IEnumerable<CollaborateurDTO>> GetCollaborateurDTOs(IEnumerable<ParticipationFormation> participationsFormation) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!participationsFormation.Any()) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Guid?> guids = participationsFormation.SelectMany(participationFormation => new[] { (Guid?)participationFormation.DemandeFormation.Ep.IdCollaborateur, participationFormation.DemandeFormation.Ep.IdReferent }).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return await collaborateurService.GetCollaborateurDTOsAsync(guids); ; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récupère un objet CollaborateurDTO en fonction d'un objet ParticipationFormation et d'une liste de CollaborateurDTO |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="participationFormation"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private CollaborateurDTO GetCollaborateurDTO(ParticipationFormation participationFormation, IEnumerable<CollaborateurDTO> collaborateurDTOs) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return collaborateurDTOs.FirstOrDefault(collaborateurDTO => collaborateurDTO.Id == participationFormation.DemandeFormation.Ep.IdCollaborateur); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récupère un objet EpInformationDTO en fonction d'un objet Ep et d'une liste de CollaborateurDTO |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="ep"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private EpInformationDTO GetEpInformationDTO(Ep ep, IEnumerable<CollaborateurDTO> collaborateurDTOs) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CollaborateurDTO collaborateur; |
|
|
|
|
|
|
|
CollaborateurDTO referent; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
collaborateur = collaborateurDTOs.FirstOrDefault(collaborateurDTO => collaborateurDTO.Id == ep.IdCollaborateur); |
|
|
|
|
|
|
|
referent = collaborateurDTOs.FirstOrDefault(collaborateurDTO => collaborateurDTO.Id == ep.IdReferent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EpInformationDTO epInformationDTO = new EpInformationDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = ep.IdEP, |
|
|
|
|
|
|
|
Type = ep.TypeEP, |
|
|
|
|
|
|
|
Statut = ep.Statut, |
|
|
|
|
|
|
|
DateDisponibilite = ep.DateDisponibilite, |
|
|
|
|
|
|
|
DatePrevisionnelle = ep.DatePrevisionnelle, |
|
|
|
|
|
|
|
Obligatoire = ep.Obligatoire, |
|
|
|
|
|
|
|
Collaborateur = collaborateur, |
|
|
|
|
|
|
|
Referent = referent, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return epInformationDTO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region DTO to Object |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récuperer un objet Saisie en fonction d'un objet SaisieDTO |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="saisieDTO"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private Saisie GetSaisie(SaisieDTO saisieDTO) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Saisie saisie = new Saisie() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IdSaisie = saisieDTO.Id.Value, |
|
|
|
|
|
|
|
Note = saisieDTO.Note, |
|
|
|
|
|
|
|
Texte = saisieDTO.Texte, |
|
|
|
|
|
|
|
Champ = GetChamp(saisieDTO.Champ), |
|
|
|
|
|
|
|
TypeSaisie = saisieDTO.TypeSaisie |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return saisie; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Récuperer un objet Champ en fonction d'un objet ChampDTO |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="champDTO"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
private Champ GetChamp(ChampDTO champDTO) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Champ champ = new Champ() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IdChamp = champDTO.Id.Value, |
|
|
|
|
|
|
|
Texte = champDTO.Texte, |
|
|
|
|
|
|
|
Section = champDTO.Section, |
|
|
|
|
|
|
|
SousSection = champDTO.Soussection, |
|
|
|
|
|
|
|
Ordre = champDTO.Ordre.Value, |
|
|
|
|
|
|
|
TypeChamp = champDTO.TypeChamp, |
|
|
|
|
|
|
|
TypeSaisie = champDTO.TypeSaisie |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return champ; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |