Exemplo n.º 1
0
        public bool CreateAccount(string username, string password, string firstName, string lastName, string phoneNumber, string address, string email)
        {
            var result = false;

            if (username.Length < 5 || username.Length > 20)
            {
                throw new ApplicationException("INVALID USERNAME: Your username must be at least 6 characters and no more than 20 characters long.");
            }
            else if (password.Length < 7)
            {
                throw new ApplicationException("INVALID PASSWORD: Your Password must be at least 7 characters long.");
            }

            try
            {
                if (1 == UserAccessor.AddNewUser(username, HashSHA256(password), firstName, lastName, phoneNumber, address, email))
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(result);
        }