コード例 #1
0
        public bool ValidateUser(UserDTO user)
        {
            int numberOfUser = 0;

            try
            {
                // count number of users that have same username and password
                numberOfUser = (int)tabUserAdapter.CountUser(user.UserName, user.Password);

                // log in is valid if there is a matched record
                if (numberOfUser != 0)
                {
                    return(true);
                }
            }
            catch (SystemException e)
            {
                Console.WriteLine("Cannot connect to the database" + e.Message);
            }

            return(false);
        }