|
|
|
@ -21,40 +21,6 @@ namespace EPAServeur.Services |
|
|
|
|
collaborateurApi = _collaborateurApi; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
public AgenceDTO GetAgenceDTO(Agence agence) |
|
|
|
|
{ |
|
|
|
|
if (agence == null) |
|
|
|
|
return null; |
|
|
|
|
AgenceDTO agenceDTO = new AgenceDTO() |
|
|
|
|
{ |
|
|
|
|
Id = agence.Id, |
|
|
|
|
Nom = agence.Nom, |
|
|
|
|
Bu = new List<BusinessUnitDTO>() |
|
|
|
|
}; |
|
|
|
|
foreach(BU bu in agence.Bus) |
|
|
|
|
{ |
|
|
|
|
agenceDTO.Bu.Add(new BusinessUnitDTO() |
|
|
|
|
{ |
|
|
|
|
Id = bu.Id, |
|
|
|
|
Nom = bu.Nom |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
return agenceDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public BusinessUnitDTO GetBusinessUnitDTO(BU businessUnit) |
|
|
|
|
{ |
|
|
|
|
if (businessUnit == null) |
|
|
|
|
return null; |
|
|
|
|
BusinessUnitDTO businessUnitDTO = new BusinessUnitDTO() |
|
|
|
|
{ |
|
|
|
|
Id = businessUnit.Id, |
|
|
|
|
Nom = businessUnit.Nom, |
|
|
|
|
Agence = GetAgenceDTO(businessUnit.Agence) |
|
|
|
|
}; |
|
|
|
|
return businessUnitDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public CollaborateurDTO GetCollaborateurById(Guid? id) |
|
|
|
|
{ |
|
|
|
@ -72,21 +38,6 @@ namespace EPAServeur.Services |
|
|
|
|
return GetCollaborateurDTO(collaborateur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public CollaborateurDTO GetCollaborateurDTO(Collaborateur collaborateur) |
|
|
|
|
{ |
|
|
|
|
CollaborateurDTO collaborateurDTO = new CollaborateurDTO() |
|
|
|
|
{ |
|
|
|
|
Id = collaborateur.Id, |
|
|
|
|
Prenom = collaborateur.Prenom, |
|
|
|
|
Nom = collaborateur.Nom, |
|
|
|
|
MailApside = collaborateur.MailApside, |
|
|
|
|
DateArrivee = collaborateur.DateArrivee, |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
collaborateurDTO.BusinessUnit = GetBusinessUnitDTO(collaborateur.BusinessUnit); |
|
|
|
|
collaborateurDTO.Referent = GetReferentDTO(collaborateur.Referent); |
|
|
|
|
return collaborateurDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<CollaborateurDTO> GetCollaborateurs() |
|
|
|
|
{ |
|
|
|
@ -100,34 +51,85 @@ namespace EPAServeur.Services |
|
|
|
|
|
|
|
|
|
public List<CollaborateurDTO> GetCollaborateursByReferent(Guid? idReferent) |
|
|
|
|
{ |
|
|
|
|
/* |
|
|
|
|
Collaborateur collaborateur = collaborateurApi.ChercherCollabRef(idReferent); |
|
|
|
|
CollaborateurDTO collaborateurDTO = new CollaborateurDTO() |
|
|
|
|
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, |
|
|
|
|
Prenom = collaborateur.Prenom, |
|
|
|
|
Nom = collaborateur.Nom, |
|
|
|
|
//Id = collaborateur.Id, |
|
|
|
|
DateArrivee = collaborateur.DateArrivee, |
|
|
|
|
MailApside = collaborateur.MailApside, |
|
|
|
|
DateArrivee = collaborateur.DateArrivee |
|
|
|
|
Nom = collaborateur.Nom, |
|
|
|
|
Prenom = collaborateur.Prenom, |
|
|
|
|
BusinessUnit = GetBusinessUnitDTO(collaborateur.BusinessUnit) |
|
|
|
|
}; |
|
|
|
|
collaborateurDTO.Referent = new ReferentDTO() |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Object to DTO |
|
|
|
|
private AgenceDTO GetAgenceDTO(Agence agence) |
|
|
|
|
{ |
|
|
|
|
if (agence == null) |
|
|
|
|
return null; |
|
|
|
|
AgenceDTO agenceDTO = new AgenceDTO() |
|
|
|
|
{ |
|
|
|
|
Id = collaborateur.Referent.Id, |
|
|
|
|
Prenom = collaborateur.Referent.Prenom, |
|
|
|
|
Nom = collaborateur.Referent.Nom, |
|
|
|
|
MailApside = collaborateur.Referent.MailApside |
|
|
|
|
Id = agence.Id, |
|
|
|
|
Nom = agence.Nom, |
|
|
|
|
Bu = new List<BusinessUnitDTO>() |
|
|
|
|
}; |
|
|
|
|
return collaborateurDTO; |
|
|
|
|
*/ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
agenceDTO.Bu = agence.Bus.Select(bu => new BusinessUnitDTO() |
|
|
|
|
{ |
|
|
|
|
Id = bu.Id, |
|
|
|
|
Nom = bu.Nom |
|
|
|
|
}).ToList(); |
|
|
|
|
return agenceDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ProfilDTO GetProfilByMail(string mail) |
|
|
|
|
private BusinessUnitDTO GetBusinessUnitDTO(BU businessUnit) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
if (businessUnit == null) |
|
|
|
|
return null; |
|
|
|
|
BusinessUnitDTO businessUnitDTO = new BusinessUnitDTO() |
|
|
|
|
{ |
|
|
|
|
Id = businessUnit.Id, |
|
|
|
|
Nom = businessUnit.Nom, |
|
|
|
|
Agence = GetAgenceDTO(businessUnit.Agence) |
|
|
|
|
}; |
|
|
|
|
return businessUnitDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private CollaborateurDTO GetCollaborateurDTO(Collaborateur collaborateur) |
|
|
|
|
{ |
|
|
|
|
CollaborateurDTO collaborateurDTO = new CollaborateurDTO() |
|
|
|
|
{ |
|
|
|
|
Id = collaborateur.Id, |
|
|
|
|
Prenom = collaborateur.Prenom, |
|
|
|
|
Nom = collaborateur.Nom, |
|
|
|
|
MailApside = collaborateur.MailApside, |
|
|
|
|
DateArrivee = collaborateur.DateArrivee, |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
collaborateurDTO.BusinessUnit = GetBusinessUnitDTO(collaborateur.BusinessUnit); |
|
|
|
|
collaborateurDTO.Referent = GetReferentDTO(collaborateur.Referent); |
|
|
|
|
return collaborateurDTO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ReferentDTO GetReferentDTO(Collaborateur referent) |
|
|
|
|
private ReferentDTO GetReferentDTO(Collaborateur referent) |
|
|
|
|
{ |
|
|
|
|
if (referent == null) |
|
|
|
|
return null; |
|
|
|
|