public static ProspectDTO Charger(int idProspect) { using (ProspectDAO prospectDAO = new ProspectDAO()) { ProspectDTO prospect = prospectDAO.Charger(idProspect); if (prospect == null) throw new ExceptionMetier("Le prospect n'existe pas dans la base de données."); return prospect; } }
internal AgendaDTO Mapper(IDataReader rd, AgendaDTO agenda) { agenda.Date = rd.GetDateTime("DATEENTREE"); agenda.Description = rd.GetString("DESCRIPTION"); agenda.Titre = rd.GetString("TITRE"); if (rd.GetNullableInt("PROSPECTPERSONNEID") != null) { ProspectDAO prospect = new ProspectDAO(); agenda.Prospect = prospect.Charger(rd.GetInt("PROSPECTPERSONNEID")); } if (rd.GetNullableInt("AGENTPERSONNEID") != null) { AgentDAO agent = new AgentDAO(); agenda.Agent = agent.Charger(rd.GetInt("AGENTPERSONNEID")); } if (rd.GetNullableInt("ANNONCEID") != null) { AnnonceDAO annonce = new AnnonceDAO(); agenda.Annonce = annonce.Charger(rd.GetInt("ANNONCEID")); } agenda.IdAgenda = rd.GetInt("ID"); return agenda; }