|
|
@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore.ChangeTracking; |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
using System.Runtime.InteropServices.ComTypes; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
|
|
|
|
namespace EPAServeur.Services |
|
|
|
namespace EPAServeur.Services |
|
|
@ -20,64 +21,81 @@ namespace EPAServeur.Services |
|
|
|
collaborateurApi = _collaborateurApi; |
|
|
|
collaborateurApi = _collaborateurApi; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public CollaborateurDTO GetCollaborateurById(Guid? id) |
|
|
|
// |
|
|
|
|
|
|
|
public AgenceDTO GetAgenceDTO(Agence agence) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabId(id); |
|
|
|
if (agence == null) |
|
|
|
if (collaborateur == null) |
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
CollaborateurDTO collaborateurDTO = new CollaborateurDTO() |
|
|
|
AgenceDTO agenceDTO = new AgenceDTO() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Id = collaborateur.Id, |
|
|
|
Id = agence.Id, |
|
|
|
Prenom = collaborateur.Prenom, |
|
|
|
Nom = agence.Nom, |
|
|
|
Nom = collaborateur.Nom, |
|
|
|
Bu = new List<BusinessUnitDTO>() |
|
|
|
MailApside = collaborateur.MailApside, |
|
|
|
|
|
|
|
DateArrivee = collaborateur.DateArrivee, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
collaborateurDTO.BusinessUnit = new BusinessUnitDTO() |
|
|
|
foreach(BU bu in agence.Bus) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Id = collaborateur.BusinessUnit.Id, |
|
|
|
agenceDTO.Bu.Add(new BusinessUnitDTO() |
|
|
|
Nom = collaborateur.BusinessUnit.Nom, |
|
|
|
|
|
|
|
Agence = new AgenceDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
Id = collaborateur.BusinessUnit.Agence.Id, |
|
|
|
Id = bu.Id, |
|
|
|
Nom = collaborateur.BusinessUnit.Agence.Nom |
|
|
|
Nom = bu.Nom |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
} |
|
|
|
collaborateurDTO.Referent = new ReferentDTO() |
|
|
|
return agenceDTO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BusinessUnitDTO GetBusinessUnitDTO(BU businessUnit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (businessUnit == null) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
BusinessUnitDTO businessUnitDTO = new BusinessUnitDTO() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Id = collaborateur.Referent.Id, |
|
|
|
Id = businessUnit.Id, |
|
|
|
Prenom = collaborateur.Referent.Prenom, |
|
|
|
Nom = businessUnit.Nom, |
|
|
|
Nom = collaborateur.Referent.Nom, |
|
|
|
Agence = GetAgenceDTO(businessUnit.Agence) |
|
|
|
MailApside = collaborateur.Referent.MailApside |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
return collaborateurDTO; |
|
|
|
return businessUnitDTO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CollaborateurDTO GetCollaborateurById(Guid? id) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabId(id); |
|
|
|
|
|
|
|
if (collaborateur == null) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
return GetCollaborateurDTO(collaborateur); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public CollaborateurDTO GetCollaborateurByMail(string mail) |
|
|
|
public CollaborateurDTO GetCollaborateurByMail(string mail) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabMail(mail); |
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabMail(mail); |
|
|
|
|
|
|
|
if (collaborateur == null) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
return GetCollaborateurDTO(collaborateur); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CollaborateurDTO GetCollaborateurDTO(Collaborateur collaborateur) |
|
|
|
|
|
|
|
{ |
|
|
|
CollaborateurDTO collaborateurDTO = new CollaborateurDTO() |
|
|
|
CollaborateurDTO collaborateurDTO = new CollaborateurDTO() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Id = collaborateur.Id, |
|
|
|
Id = collaborateur.Id, |
|
|
|
Prenom = collaborateur.Prenom, |
|
|
|
Prenom = collaborateur.Prenom, |
|
|
|
Nom = collaborateur.Nom, |
|
|
|
Nom = collaborateur.Nom, |
|
|
|
MailApside = collaborateur.MailApside, |
|
|
|
MailApside = collaborateur.MailApside, |
|
|
|
DateArrivee = collaborateur.DateArrivee |
|
|
|
DateArrivee = collaborateur.DateArrivee, |
|
|
|
}; |
|
|
|
|
|
|
|
collaborateurDTO.Referent = new ReferentDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = collaborateur.Referent.Id, |
|
|
|
|
|
|
|
Prenom = collaborateur.Referent.Prenom, |
|
|
|
|
|
|
|
Nom = collaborateur.Referent.Nom, |
|
|
|
|
|
|
|
MailApside = collaborateur.Referent.MailApside |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
collaborateurDTO.BusinessUnit = GetBusinessUnitDTO(collaborateur.BusinessUnit); |
|
|
|
|
|
|
|
collaborateurDTO.Referent = GetReferentDTO(collaborateur.Referent); |
|
|
|
return collaborateurDTO; |
|
|
|
return collaborateurDTO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<CollaborateurDTO> GetCollaborateurs() |
|
|
|
public List<CollaborateurDTO> GetCollaborateurs() |
|
|
|
{ |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
List<Collaborateur> collaborateurs = collaborateurApi.ChercherCollab(); |
|
|
|
|
|
|
|
List<CollaborateurDTO> collaborateursDTO = (from c in collaborateurs |
|
|
|
|
|
|
|
select GetCollaborateurDTO(c)).ToList(); |
|
|
|
|
|
|
|
//List<CollaborateurDTO> collaborateursDTO = collaborateurs.Select(c => GetCollaborateurDTO(c)).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return collaborateursDTO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<CollaborateurDTO> GetCollaborateursByReferent(Guid? idReferent) |
|
|
|
public List<CollaborateurDTO> GetCollaborateursByReferent(Guid? idReferent) |
|
|
@ -108,5 +126,19 @@ namespace EPAServeur.Services |
|
|
|
{ |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ReferentDTO GetReferentDTO(Collaborateur referent) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (referent == null) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
ReferentDTO referentDTO = new ReferentDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = referent.Id, |
|
|
|
|
|
|
|
Prenom = referent.Prenom, |
|
|
|
|
|
|
|
Nom = referent.Nom, |
|
|
|
|
|
|
|
MailApside = referent.MailApside |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return referentDTO; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|