Esempio n. 1
0
        public static Users REQUETEUR_USERS(string login, string mdp)
        {
            string requete = "select * from users where loginuser='******' and passworduser ='******'";
            Users  u       = null;

            try
            {
                OleDbCommand    cmdaccess = new OleDbCommand(requete, BDGestionAccess2013.connexion_access);
                OleDbDataReader lecteur   = cmdaccess.ExecuteReader();


                while (lecteur.Read())
                {
                    u            = new Users();
                    u.persUserId = lecteur.GetInt32(1);
                    u.droitsuser = lecteur.GetInt32(2);
                    u.prefsuser  = lecteur.GetInt32(3);
                    u.login      = lecteur.GetString(4);
                    u.password   = lecteur.GetString(5);
                }

                lecteur.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.InnerException);
            }



            return(u);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="P"></param>
        /// <param name="droits"></param>
        /// <param name="prefs">0:uilisateur |1:administrateur</param>
        public static void CREA_USER(PersonneClass P, int droits, int prefs, string login, string password)
        {
            try
            {
                string ins = "Insert into users (persuserid,droitsuser,prefsuser,loginuser,passworduser) values (" + P.idPers + "," + droits + "," + prefs + ",'" + login + "','" + MD5CLASS.getMd5Hash(password) + "')";

                OleDbCommand cmdacc = new OleDbCommand(ins, BDGestionAccess2013.connexion_access);

                int res = cmdacc.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " " + ex.StackTrace);
            }
        }