Esempio n. 1
0
        public Medecin SupprimerPatient(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));
            }
            Medecin medecin = medecinDAO.VoirMedecin(IDMedecin);
            Patient patient = patientDAO.VoirPatient(IDpatient);

            if (patient.MesMedecin.SingleOrDefault(elt => elt.IDMedecin == IDMedecin) == null) //S'il n'y a pas de médecin pour patient
            {
                medecin.Erreur = "Le patient " + patient.Nom + " " + patient.Prenom + " " + patient.Identifiant + " vous est déjà attribué";
                throw new PatientNonPresentException("Impossible de supprimer le patient du Médecin car attribution pas présente", medecin);
            }
            else
            {
                patientDAO.SupprMedecinDuPatient(patient, medecin);
            }

            return(medecinDAO.VoirMedecin(medecin.IDMedecin));
        }
Esempio n. 2
0
        public Medecin AttributionPatient(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 Medecin", medecinDAO.VoirMedecin(IDMedecin));
            }
            Medecin medecin = medecinDAO.VoirMedecin(IDMedecin);
            Patient patient = patientDAO.VoirPatient(IDpatient);

            if (patient.MesMedecin.SingleOrDefault(elt => elt.IDMedecin == IDMedecin) != null)
            {
                medecin.Erreur = "Le patient " + patient.Nom + " " + patient.Prenom + " " + patient.Identifiant + " vous est déjà attribué";
                throw new DejaMedecinAttribueException("Il y a déjà un médecin attribué à ce Patient", medecin);
            }

            patientDAO.AttributionMedecin(patient, medecinDAO.VoirMedecinSimple(IDMedecin));
            return(medecinDAO.VoirMedecin(IDMedecin));
        }
        public UtilisateurWeb TelephoneLogin(string Token)
        {
            UtilisateurWeb utilisateurWeb = ServiceSecurite.GetTelephoneSecurite(Token); //teste du compte et du token basic. Si incorrecte passage en catch

            PatientDAO _PatientDAO = new PatientDAO();
            MedecinDAO _MedecinDAO = new MedecinDAO();

            if (_PatientDAO.IsPatient(utilisateurWeb.Identifiant))
            {
                return(Conversion(_PatientDAO.LoginTelephone(utilisateurWeb.Identifiant, utilisateurWeb.MotDePass, utilisateurWeb.TelephonePortable)));
            }
            else if (_MedecinDAO.IsMedecin(utilisateurWeb.Identifiant))
            {
                throw new TypeCompteException(utilisateurWeb, "Ce compte n'est pas celui d'un patient");
            }
            else
            {
                return(null);
            }
        }
        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);
            }
        }
Esempio n. 6
0
        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));
        }