Esempio n. 1
0
 public static void AjoutToken(string Identifiant)
 {
     using (DataClasses1DataContext entity = new DataClasses1DataContext())
     {
         T_COMPTE t_compte = entity.T_COMPTE.Single(c => c.Identifiant == Identifiant);
         t_compte.Token = ServiceSecurite.GenererToken(t_compte.Identifiant, t_compte.MotDePass, DateTime.UtcNow.Ticks);
         entity.SubmitChanges();
     }
 }
Esempio n. 2
0
        public int AjoutCompte(Compte compte)
        {
            using (DataClasses1DataContext entity = new DataClasses1DataContext())
            {
                DateTime Maintenant = DateTime.Now;

                T_COMPTE T_Compte = new T_COMPTE()
                {
                    Identifiant = compte.Identifiant, MotDePass = compte.MotDePass, Nom = compte.Nom, Prenom = compte.Prenom, DateCreation = Maintenant.Ticks.ToString(), DerniereModif = Maintenant.Ticks.ToString(), CreePar = 0
                };
                entity.T_COMPTE.Attach(T_Compte);
                entity.SubmitChanges();
                //int retour = entity.AjoutCompte(compte.Login, compte.MotDePass, compte.Nom, compte.Prenom, Maintenant.ToLongDateString, Maintenant.ToLongDateString, 0);
                return(0);
            }
        }
Esempio n. 3
0
        public Compte GetCompte(string Identifiant)
        {
            List <Compte> _ListCompte = new List <Compte>();

            using (DataClasses1DataContext entity = new DataClasses1DataContext())
            {
                T_COMPTE retour = entity.T_COMPTE.Where(compte => compte.Identifiant == Identifiant).SingleOrDefault();
                //T_COMPTE res = (from elt in entity.T_COMPTE where (elt.Identifiant == Logincompte) select elt).First();
                if (retour == null)
                {
                    throw new AutentificationIncorrecteException(Identifiant, "Identifiant ou mot de passe incorrecte");
                }
                else
                {
                    return new Compte()
                           {
                               ID = retour.ID, Identifiant = retour.Identifiant, MotDePass = retour.MotDePass, Nom = retour.Nom, Prenom = retour.Prenom
                           }
                };
            }
        }