Exemple #1
0
        public int AutentificationTel(string Identifiant, string MotDePasse, string TelephonePortable)
        {
            using (DataClasses1DataContext entity = new DataClasses1DataContext())
            {
                var retour = entity.T_COMPTE.Join(entity.T_PATIENT,
                                                  C => C.ID,
                                                  P => P.IdCompte,
                                                  (C, P) => new { ID = C.ID, Identifiant = C.Identifiant, MotDePass = C.MotDePass, TelephonePortable = P.TelephonePortable }).FirstOrDefault(elt => elt.Identifiant == Identifiant);;

                if (retour == null)
                {
                    throw new AutentificationIncorrecteException(Identifiant, "Identifiant incorrecte");
                }
                if (retour.MotDePass != MotDePasse)
                {
                    throw new AutentificationIncorrecteException(Identifiant, "Mot de passe incorrecte");
                }
                if (retour.TelephonePortable != TelephonePortable)
                {
                    throw new AutentificationIncorrecteException(Identifiant, "Téléphone incorrecte");
                }
                CompteDAO.AjoutToken(retour.ID);
                return(retour.ID);
            }
        }
Exemple #2
0
        /// <summary>
        /// retour une information vrais ou faux en fonction du login et du mot de passe envoyé
        /// </summary>
        /// <param name="Login"></param>
        /// <param name="Pass"></param>
        /// <returns></returns>
        public Medecin Login(string Identifiant, string Pass)
        {
            int IdCompte = new CompteDAO().Autentification(Identifiant, Pass); //teste de l'identifiant et du mot de passe pour rejet si non présent dans la base
                                                                               //Rafraichir();

            Medecin retourMedecin = VoirMedecin(Identifiant);

            //Medecin retourMedecin = _ListMedecin.SingleOrDefault(medecin => medecin.ID == IdCompte); //on récupère le médecin a partir de l'id du compte
            //try { retourMedecin.Adresse = new AdresseDAO().LectureAdresse(retourMedecin.ID); }//lecture de l'adresse a partir de l'IdCompte
            //catch (Exception) { retourMedecin.Adresse = null; }

            //try { retourMedecin.HoraireOuverture = new HoraireDAO().LectureHoraire(retourMedecin.IDMedecin); } //on récupère la table des horaires en fonctiond de l'id du médecin
            //catch (Exception) { retourMedecin.HoraireOuverture = null; }


            //foreach (Medecin Element in _ListMedecin)
            //{
            //    if (Element.Identifiant == Identifiant & Element.MotDePass == Pass)
            //    {
            //        Element.Adresse = new AdresseDAO().LectureAdresse(Element);
            //        return Element;
            //    }
            //}
            return(retourMedecin);
        }
Exemple #3
0
        /// <summary>
        /// retour une information vrais ou faux en fonction du login et du mot de passe envoyé. Nous ne stoquons pas , ainsi le mot de passe en mémoire
        /// </summary>
        /// <param name="Login"></param>
        /// <param name="Pass"></param>
        /// <returns></returns>
        public Patient Login(string Identifiant, string Pass)
        {
            int IdCompte = new CompteDAO().Autentification(Identifiant, Pass); //teste de l'identifiant et du mot de passe pour rejet si non présent dans la base
            //Rafraichir();
            Patient retourPatient = VoirPatientDuCompte(IdCompte);             //on récupère le patient à partir de l'id du compte

            try { retourPatient.Adresse = new AdresseDAO().LectureAdresse(retourPatient.ID); }//lecture de l'adresse a partir de l'IdCompte
            catch (Exception) { retourPatient.Adresse = null; }

            return(retourPatient);
        }
Exemple #4
0
        public Patient NouveauMotDePass(Patient patient)
        {
            using (DataClasses1DataContext entity = new DataClasses1DataContext())
            {
                //Patient patienbdd = _ListPatient.Where(elt => elt.Identifiant == patient.Identifiant).First();
                string MotDePasse = ServiceSecurite.HashMotDePass(patient.MotDePass);
                int    retour     = new CompteDAO().ChangementInformation(entity.T_PATIENT.FirstOrDefault(elt => elt.ID == patient.IDPatient).IdCompte, patient.Identifiant, MotDePasse, null, null, null, null, 0, null, ServiceSecurite.GenererToken(patient.Identifiant, MotDePasse, DateTime.UtcNow.Ticks)); //on transmet l'information de d'Id du compte et on transmet a CompteDAO l'ordre de changer le mot de passe. puis on récupère l'information que l'opération c'est bien passé
                if (retour == -1)
                {
                    throw new CompteModificationException(patient, "Le changement de mot de passe n'a pus être effectué");
                }

                //Rafraichir();
                Patient RetourPatient = VoirPatient(patient.IDPatient);

                return(RetourPatient);
            }
        }
Exemple #5
0
        public Medecin NouveauMotDePass(Medecin medecin)
        {
            using (DataClasses1DataContext entity = new DataClasses1DataContext())
            {
                //Medecin medecinbdd = _ListMedecin.Where(elt => elt.Identifiant == medecin.Identifiant).First();
                //Medecin medecinbdd = VoirMedecin(medecin.Identifiant);
                string MotDePasse = ServiceSecurite.HashMotDePass(medecin.MotDePass);
                int    retour     = new CompteDAO().ChangementInformation(entity.T_MEDECIN.FirstOrDefault(elt => elt.ID == medecin.IDMedecin).IdCompte, null, MotDePasse, null, null, null, null, 0, null, ServiceSecurite.GenererToken(medecin.Identifiant, MotDePasse, DateTime.UtcNow.Ticks)); //on transmet l'information de d'Id du compte et on transmet a CompteDAO l'ordre de changer le mot de passe. puis on récupère l'information que l'opération c'est bien passé
                if (retour == -1)
                {
                    throw new CompteModificationException(medecin, "Le changement de mot de passe n'a pus être effectué");
                }

                //Rafraichir();
                //Medecin RetourMedecin = _ListMedecin.Where(elt => elt.IDMedecin == medecin.IDMedecin).SingleOrDefault();

                //return RetourMedecin;
                return(VoirMedecin(medecin.IDMedecin));
            }
        }
Exemple #6
0
        public Patient LoginTelephoneToken(string Identifiant)
        {
            CompteDAO.AjoutToken(Identifiant);

            return(VoirPatient(Identifiant));
        }