|
|
|
@ -21,8 +21,68 @@ namespace EPAServeur.Services |
|
|
|
|
collaborateurApi = _collaborateurApi; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
public AgenceDTO GetAgenceDTO(Agence agence) |
|
|
|
|
|
|
|
|
|
public CollaborateurDTO GetCollaborateurById(Guid? id) |
|
|
|
|
{ |
|
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabId(id); |
|
|
|
|
if (collaborateur == null) |
|
|
|
|
return null; |
|
|
|
|
return GetCollaborateurDTO(collaborateur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public CollaborateurDTO GetCollaborateurByMail(string mail) |
|
|
|
|
{ |
|
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabMail(mail); |
|
|
|
|
if (collaborateur == null) |
|
|
|
|
return null; |
|
|
|
|
return GetCollaborateurDTO(collaborateur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<CollaborateurDTO> GetCollaborateurs() |
|
|
|
|
{ |
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
List<Collaborateur> collaborateurs = collaborateurApi.ChercherCollabRef(idReferent); |
|
|
|
|
List<CollaborateurDTO> collaborateursDTO = (from c in collaborateurs |
|
|
|
|
select GetCollaborateurDTO(c)).ToList(); |
|
|
|
|
//List<CollaborateurDTO> collaborateursDTO = collaborateurs.Select(c => GetCollaborateurDTO(c)).ToList(); |
|
|
|
|
|
|
|
|
|
return collaborateursDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ProfilDTO GetProfilByMail(string mail) |
|
|
|
|
{ |
|
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabMail(mail); |
|
|
|
|
if (collaborateur == null) |
|
|
|
|
return null; |
|
|
|
|
return GetProfilDTO(collaborateur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private ProfilDTO GetProfilDTO(Collaborateur collaborateur) |
|
|
|
|
{ |
|
|
|
|
ProfilDTO profilDTO = new ProfilDTO() |
|
|
|
|
{ |
|
|
|
|
//Id = collaborateur.Id, |
|
|
|
|
DateArrivee = collaborateur.DateArrivee, |
|
|
|
|
MailApside = collaborateur.MailApside, |
|
|
|
|
Nom = collaborateur.Nom, |
|
|
|
|
Prenom = collaborateur.Prenom, |
|
|
|
|
BusinessUnit = GetBusinessUnitDTO(collaborateur.BusinessUnit) |
|
|
|
|
}; |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Object to DTO |
|
|
|
|
private AgenceDTO GetAgenceDTO(Agence agence) |
|
|
|
|
{ |
|
|
|
|
if (agence == null) |
|
|
|
|
return null; |
|
|
|
@ -32,18 +92,15 @@ namespace EPAServeur.Services |
|
|
|
|
Nom = agence.Nom, |
|
|
|
|
Bu = new List<BusinessUnitDTO>() |
|
|
|
|
}; |
|
|
|
|
foreach(BU bu in agence.Bus) |
|
|
|
|
{ |
|
|
|
|
agenceDTO.Bu.Add(new BusinessUnitDTO() |
|
|
|
|
agenceDTO.Bu = agence.Bus.Select(bu => new BusinessUnitDTO() |
|
|
|
|
{ |
|
|
|
|
Id = bu.Id, |
|
|
|
|
Nom = bu.Nom |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}).ToList(); |
|
|
|
|
return agenceDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public BusinessUnitDTO GetBusinessUnitDTO(BU businessUnit) |
|
|
|
|
private BusinessUnitDTO GetBusinessUnitDTO(BU businessUnit) |
|
|
|
|
{ |
|
|
|
|
if (businessUnit == null) |
|
|
|
|
return null; |
|
|
|
@ -56,23 +113,7 @@ namespace EPAServeur.Services |
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabMail(mail); |
|
|
|
|
if (collaborateur == null) |
|
|
|
|
return null; |
|
|
|
|
return GetCollaborateurDTO(collaborateur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public CollaborateurDTO GetCollaborateurDTO(Collaborateur collaborateur) |
|
|
|
|
private CollaborateurDTO GetCollaborateurDTO(Collaborateur collaborateur) |
|
|
|
|
{ |
|
|
|
|
CollaborateurDTO collaborateurDTO = new CollaborateurDTO() |
|
|
|
|
{ |
|
|
|
@ -88,46 +129,7 @@ namespace EPAServeur.Services |
|
|
|
|
return collaborateurDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<CollaborateurDTO> GetCollaborateurs() |
|
|
|
|
{ |
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
/* |
|
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabRef(idReferent); |
|
|
|
|
CollaborateurDTO collaborateurDTO = new CollaborateurDTO() |
|
|
|
|
{ |
|
|
|
|
Id = collaborateur.Id, |
|
|
|
|
Prenom = collaborateur.Prenom, |
|
|
|
|
Nom = collaborateur.Nom, |
|
|
|
|
MailApside = collaborateur.MailApside, |
|
|
|
|
DateArrivee = collaborateur.DateArrivee |
|
|
|
|
}; |
|
|
|
|
collaborateurDTO.Referent = new ReferentDTO() |
|
|
|
|
{ |
|
|
|
|
Id = collaborateur.Referent.Id, |
|
|
|
|
Prenom = collaborateur.Referent.Prenom, |
|
|
|
|
Nom = collaborateur.Referent.Nom, |
|
|
|
|
MailApside = collaborateur.Referent.MailApside |
|
|
|
|
}; |
|
|
|
|
return collaborateurDTO; |
|
|
|
|
*/ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ProfilDTO GetProfilByMail(string mail) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ReferentDTO GetReferentDTO(Collaborateur referent) |
|
|
|
|
private ReferentDTO GetReferentDTO(Collaborateur referent) |
|
|
|
|
{ |
|
|
|
|
if (referent == null) |
|
|
|
|
return null; |
|
|
|
|