|
|
|
|
using EPAServeur.Context;
|
|
|
|
|
using EPAServeur.Exceptions;
|
|
|
|
|
using EPAServeur.IServices;
|
|
|
|
|
using EPAServeur.Models.EP;
|
|
|
|
|
using IO.Swagger.ApiCollaborateur;
|
|
|
|
|
using IO.Swagger.DTO;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace EPAServeur.Services
|
|
|
|
|
{
|
|
|
|
|
public class EpDetailsService : IEpDetailsService
|
|
|
|
|
{
|
|
|
|
|
private EpContext context;
|
|
|
|
|
private ITransformDTO transformDTO;
|
|
|
|
|
private ICollaborateurService collaborateurService;
|
|
|
|
|
|
|
|
|
|
public EpDetailsService(EpContext context, ITransformDTO transformDTO, ICollaborateurService collaborateurService)
|
|
|
|
|
{
|
|
|
|
|
this.context = context;
|
|
|
|
|
this.transformDTO = transformDTO;
|
|
|
|
|
this.collaborateurService = collaborateurService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<EpDTO> GetEp(long id)
|
|
|
|
|
{
|
|
|
|
|
Ep ep = await context.Ep.Include(ep => ep.Engagements).FirstOrDefaultAsync(ep => ep.IdEP.Equals(id));
|
|
|
|
|
if (ep == null)
|
|
|
|
|
throw new EpNotFoundException();
|
|
|
|
|
|
|
|
|
|
//ajouter tous les guids liés à l'EP et aux attributs de l'EP
|
|
|
|
|
List<Guid?> guids = new List<Guid?>();
|
|
|
|
|
guids.Add(ep.IdCollaborateur);
|
|
|
|
|
if (ep.IdReferent.HasValue)
|
|
|
|
|
guids.Add(ep.IdCollaborateur);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurDTOs = await collaborateurService.GetCollaborateurDTOsAsync(guids);
|
|
|
|
|
|
|
|
|
|
EpDTO epDTO = transformDTO.EpToEpDetails(ep, collaborateurDTOs);
|
|
|
|
|
|
|
|
|
|
return epDTO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RappelSignature(long idEp)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<EpDTO> SaisirEPCollaborateur(Guid? idCollaborateur)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<EpDTO> SaisirEPReferent(long idEp)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SupprimerDonneesEPCollaborateur(Guid? idCollaborateur)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SupprimerEP(long idEp)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<EpDTO> UpdateEP(long idEp, EpDTO ep)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<EpDTO> UpdateSaisie(long idEp, EpDTO ep)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|