Exemple #1
0
        public void register(string username, string password, string firstname, string lastname, int age, int weight, string gender, int height, int target)
        {
            int planid = 0;

            planid = plantemp.provideplan(weight, target);
            temp2.InsertUser(username, password, firstname, lastname, age, weight, gender, height, target, planid);
            //string username, string password, string firstname,string lastname, int age, int weight, string gender, int height, int target, int planid
        }
Exemple #2
0
        public void InsertUser()
        {
            User user   = new User("ThureKasperJesperHenrikOle1234", User.HashThisPassword("4321"));
            var  dbUser = new DBUser();

            //var userCtr = new UserCtr();

            //userCtr.InsertUser("ThureKasperJesperHenrikOle1234", user.Password);
            dbUser.InsertUser(user);
            User extractedUser = dbUser.GetByName(user.Username);

            //Assert.IsTrue(extractedUser.Password.Equals(user.Password));
            Assert.IsTrue(extractedUser.Username.Equals(user.Username));
        }
Exemple #3
0
        /// <summary>
        /// Takes a username and password, creates a new user. hashed the password and call db insert, to save the new user to database.
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        public int InsertUser(string username, string password)
        {
            User user = new User(username, password);

            user.HashPassword();
            DBUser dbUser = new DBUser();

            try
            {
                return(dbUser.InsertUser(user));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                throw ex;
            }
        }
        public int CreateUser(User user)
        {
            if (!CheckString(user.UserName, 3))
            {
                return(-1);
            }
            if (!CheckString(user.Password, 6))
            {
                return(-2);
            }
            if (userDb.CheckUserName(user.UserName))
            {
                return(-3);
            }

            if (userDb.InsertUser(user))
            {
                return(1);
            }

            return(0);
        }
Exemple #5
0
 public int InsertUser(User user)
 {
     return(dbuser.InsertUser(user));
 }
Exemple #6
0
 public bool InsertUser(User user)
 {
     return(dbuser.InsertUser(user));
 }