|
|
@ -34,24 +34,8 @@ namespace EPAServeur.Services |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).AsEnumerable().Where(ep => EstEpEnCours(ep.Statut)); |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).AsEnumerable().Where(ep => EstEpEnCours(ep.Statut)); |
|
|
|
eps = TriDate(eps, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Guid?> guids = eps.SelectMany(ep => new Guid?[] { ep.IdReferent, ep.IdCollaborateur }).Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurDTOs = await collaborateurService.GetCollaborateurDTOsAsync(guids); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<EpInformationDTO> epDTOs = eps.Select(ep => EpToEpDTO(ep, collaborateurDTOs)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (texte != null && texte.Length > 0) |
|
|
|
|
|
|
|
epDTOs = epDTOs.Where(e => TriTexte(e, texte)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
epDTOs = TriColonne(epDTOs, tri); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (asc != null && asc.HasValue && !asc.Value) |
|
|
|
|
|
|
|
epDTOs = epDTOs.Reverse(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return SkipAndTake(epDTOs, numPage, parPage); |
|
|
|
return await GetEpInformationDTOs(eps, asc, numPage, parPage, texte, tri, dateDebut, dateFin); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,19 +43,8 @@ namespace EPAServeur.Services |
|
|
|
public async Task<int> GetEPEnCoursCount(List<long?> idBUs, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task<int> GetEPEnCoursCount(List<long?> idBUs, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).AsEnumerable().Where(ep => EstEpEnCours(ep.Statut)); |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).AsEnumerable().Where(ep => EstEpEnCours(ep.Statut)); |
|
|
|
eps = TriDate(eps, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return await GetEpInformationDTOsCount(eps, texte, dateDebut, dateFin); |
|
|
|
List<Guid?> guids = eps.SelectMany(ep => new Guid?[] { ep.IdReferent, ep.IdCollaborateur }).Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurDTOs = await collaborateurService.GetCollaborateurDTOsAsync(guids); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<EpInformationDTO> epDTOs = eps.Select(ep => EpToEpDTO(ep, collaborateurDTOs)); |
|
|
|
|
|
|
|
if( texte != null && texte.Length > 0) |
|
|
|
|
|
|
|
epDTOs = epDTOs.Where(e => TriTexte(e, texte)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return epDTOs.Count(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPEnCoursCollaborateurParticipant(Guid? idCollaborateur) |
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPEnCoursCollaborateurParticipant(Guid? idCollaborateur) |
|
|
@ -81,34 +54,23 @@ namespace EPAServeur.Services |
|
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPEnCoursReferent(Guid? idReferent, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPEnCoursReferent(Guid? idReferent, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => ep.IdReferent.Equals(idReferent)).AsEnumerable().Where(ep => EstEpEnCours(ep.Statut)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return await GetEpInformationDTOs(eps, asc, numPage, parPage, texte, tri, dateDebut, dateFin); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<int> GetEPEnCoursReferentCount(Guid? idReferent, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task<int> GetEPEnCoursReferentCount(Guid? idReferent, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => ep.IdReferent.Equals(idReferent)).AsEnumerable().Where(ep => EstEpEnCours(ep.Statut)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return await GetEpInformationDTOsCount(eps, texte, dateDebut, dateFin); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPSignes(List<long?> idBUs, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPSignes(List<long?> idBUs, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).Where(ep => ep.Statut == StatutEp.Signe); |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).Where(ep => ep.Statut == StatutEp.Signe); |
|
|
|
eps = TriDate(eps, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Guid?> guids = eps.SelectMany(ep => new Guid?[] { ep.IdReferent, ep.IdCollaborateur }).Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurDTOs = await collaborateurService.GetCollaborateurDTOsAsync(guids); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<EpInformationDTO> epDTOs = eps.Select(ep => EpToEpDTO(ep, collaborateurDTOs)); |
|
|
|
return await GetEpInformationDTOs(eps, asc, numPage, parPage, texte, tri, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
|
|
if (texte != null && texte.Length > 0) |
|
|
|
|
|
|
|
epDTOs = epDTOs.Where(e => TriTexte(e, texte)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
epDTOs = TriColonne(epDTOs, tri); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (asc != null && asc.HasValue && !asc.Value) |
|
|
|
|
|
|
|
epDTOs = epDTOs.Reverse(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return SkipAndTake(epDTOs, numPage, parPage); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPSignesCollaborateur(Guid? idCollaborateur) |
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPSignesCollaborateur(Guid? idCollaborateur) |
|
|
@ -119,28 +81,20 @@ namespace EPAServeur.Services |
|
|
|
public async Task<int> GetEPSignesCount(List<long?> idBUs, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task<int> GetEPSignesCount(List<long?> idBUs, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).Where(ep => ep.Statut == StatutEp.Signe); |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).Where(ep => ep.Statut == StatutEp.Signe); |
|
|
|
eps = TriDate(eps, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Guid?> guids = eps.SelectMany(ep => new Guid?[] { ep.IdReferent, ep.IdCollaborateur }).Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurDTOs = await collaborateurService.GetCollaborateurDTOsAsync(guids); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<EpInformationDTO> epDTOs = eps.Select(ep => EpToEpDTO(ep, collaborateurDTOs)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (texte != null && texte.Length > 0) |
|
|
|
return await GetEpInformationDTOsCount(eps, texte, dateDebut, dateFin); |
|
|
|
epDTOs = epDTOs.Where(e => TriTexte(e, texte)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return epDTOs.Count(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPSignesReferent(Guid? idReferent, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task<IEnumerable<EpInformationDTO>> GetEPSignesReferent(Guid? idReferent, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => ep.IdReferent.Equals(idReferent)).Where(ep => ep.Statut.Equals(StatutEp.Signe)); |
|
|
|
|
|
|
|
return await GetEpInformationDTOs(eps, asc, numPage, parPage, texte, tri, dateDebut, dateFin); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<int> GetEPSignesReferentCount(Guid? idReferent, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
public async Task<int> GetEPSignesReferentCount(Guid? idReferent, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
IEnumerable<Ep> eps = context.Ep.Where(ep => ep.IdReferent.Equals(idReferent)).Where(ep => ep.Statut.Equals(StatutEp.Signe)); |
|
|
|
|
|
|
|
return await GetEpInformationDTOsCount(eps, texte, dateDebut, dateFin); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<EpInformationDTO> GetProchainEPCollaborateur(Guid? idCollaborateur) |
|
|
|
public async Task<EpInformationDTO> GetProchainEPCollaborateur(Guid? idCollaborateur) |
|
|
@ -150,6 +104,39 @@ namespace EPAServeur.Services |
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
#region méthodes privées |
|
|
|
#region méthodes privées |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<IEnumerable<EpInformationDTO>> GetEpInformationDTOs(IEnumerable<Ep> eps, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
eps = TriDate(eps, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurDTOs = await GetCollaborateurDTOs(eps); |
|
|
|
|
|
|
|
IEnumerable<EpInformationDTO> epDTOs = eps.Select(ep => EpToEpDTO(ep, collaborateurDTOs)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(texte)) |
|
|
|
|
|
|
|
epDTOs = epDTOs.Where(e => TriTexte(e, texte)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
epDTOs = TriColonne(epDTOs, tri); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (asc != null && asc.HasValue && !asc.Value) |
|
|
|
|
|
|
|
epDTOs = epDTOs.Reverse(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return SkipAndTake(epDTOs, numPage, parPage); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<int> GetEpInformationDTOsCount(IEnumerable<Ep> eps, string texte, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
eps = TriDate(eps, dateDebut, dateFin); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurDTOs = await GetCollaborateurDTOs(eps); |
|
|
|
|
|
|
|
IEnumerable<EpInformationDTO> epDTOs = eps.Select(ep => EpToEpDTO(ep, collaborateurDTOs)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(texte)) |
|
|
|
|
|
|
|
epDTOs = epDTOs.Where(e => TriTexte(e, texte)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return epDTOs.Count(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private IEnumerable<Ep> TriDate(IEnumerable<Ep> eps, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
private IEnumerable<Ep> TriDate(IEnumerable<Ep> eps, DateTime? dateDebut, DateTime? dateFin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (dateDebut.HasValue && dateDebut.Value != null) |
|
|
|
if (dateDebut.HasValue && dateDebut.Value != null) |
|
|
@ -229,6 +216,12 @@ namespace EPAServeur.Services |
|
|
|
return (epDTOs.Collaborateur.Nom + " " + epDTOs.Collaborateur.Prenom).ToLower().Contains(texte.ToLower()) || (epDTOs.Collaborateur.Prenom + " " + epDTOs.Collaborateur.Nom).ToLower().Contains(texte.ToLower()); |
|
|
|
return (epDTOs.Collaborateur.Nom + " " + epDTOs.Collaborateur.Prenom).ToLower().Contains(texte.ToLower()) || (epDTOs.Collaborateur.Prenom + " " + epDTOs.Collaborateur.Nom).ToLower().Contains(texte.ToLower()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<IEnumerable<CollaborateurDTO>> GetCollaborateurDTOs(IEnumerable<Ep> eps) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
List<Guid?> guids = eps.SelectMany(ep => new Guid?[] { ep.IdReferent, ep.IdCollaborateur }).Distinct().ToList(); |
|
|
|
|
|
|
|
return await collaborateurService.GetCollaborateurDTOsAsync(guids); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|