Ejemplo n.º 1
0
        /// <summary>
        /// ajoute un utilisateur à la base tpexpaceo
        /// </summary>
        /// <param name="name"></param>
        /// <param name="password"></param>
        /// <param name="userRight"></param>
        /// <param name="mail"></param>
        /// <returns>retourne le code d'erreur de l'execution de la requete via query.ExecuteNonQuery() (1=OK) </returns>
        public int AddUser(string name, string password, int userRight, string mail = null)
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("name", name);
            data.Add("password", password);
            data.Add("user_right", userRight.ToString());
            if (mail != null)
            {
                data.Add("mail", mail);
            }

            return(access.AddData("user", data));
        }
Ejemplo n.º 2
0
        public void TestAddUser()
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("name", "test");
            data.Add("password", "passTest");
            data.Add("mail", "*****@*****.**");
            data.Add("user_right", "5");
            if (access.AddData("user", data) != 1)
            {
                Assert.IsTrue(false);
            }
            else
            {
                Assert.IsTrue(true);
            }
        }