public UtilisateurWeb Login(string Token) { Compte compte = ServiceSecurite.GetCompteSecurite(Token); //teste du compte et du token basic. Si incorrecte passage en catch PatientDAO _PatientDAO = new PatientDAO(); MedecinDAO _MedecinDAO = new MedecinDAO(); if (_PatientDAO.IsPatient(compte.Identifiant)) { return(Conversion(_PatientDAO.Login(compte.Identifiant, compte.MotDePass))); } else if (_MedecinDAO.IsMedecin(compte.Identifiant)) { return(Conversion(_MedecinDAO.Login(compte.Identifiant, compte.MotDePass))); } else { return(null); } }
public UtilisateurWeb TelephoneLoginToken(string Token) { UtilisateurWeb utilisateurWeb = ServiceSecurite.VerificationToken(Token); PatientDAO _PatientDAO = new PatientDAO(); MedecinDAO _MedecinDAO = new MedecinDAO(); if (_PatientDAO.IsPatient(utilisateurWeb.Identifiant)) { return(Conversion(_PatientDAO.LoginTelephoneToken(utilisateurWeb.Identifiant))); } else if (_MedecinDAO.IsMedecin(utilisateurWeb.Identifiant)) { throw new TypeCompteException(utilisateurWeb, "Ce compte n'est pas celui d'un patient"); } else { return(null); } }
public Patient AttributionMedecin(int IDpatient, int IDMedecin) { PatientDAO patientDAO = new PatientDAO(); MedecinDAO medecinDAO = new MedecinDAO(); if (!patientDAO.IsPatient(IDpatient)) { throw new PatientIncorrecteException("Ce compte n'est pas un compte Patient", medecinDAO.VoirMedecin(IDMedecin)); } if (!medecinDAO.IsMedecin(IDMedecin)) { throw new MedecinIncorrecteException("Ce compte n'est pas un compte Medcin", medecinDAO.VoirMedecin(IDMedecin)); } Patient patient = patientDAO.VoirPatient(IDpatient); if (patient.MesMedecin != null) { var resultat = patient.MesMedecin.FirstOrDefault(elt => elt.IDMedecin == IDMedecin); if (resultat != null) { throw new DejaMedecinAttribueException("Il y a déjà un médecin attribué à ce Patient", patient); } //foreach (Medecin element in patient.MesMedecin) //{ // if (element.IDMedecin == IDMedecin) // { // patient.Erreur = "Le Médecin " + element.Nom + " " + element.Prenom + " fait déjà partit de vos médecin de référence"; // throw new DejaMedecinAttribueException("Il y a déjà un médecin attribué à ce Patient", element); // } //} //return patient; } Medecin medecin = medecinDAO.VoirMedecinSimple(IDMedecin); return(patientDAO.AttributionMedecin(patient, medecin)); }