示例#1
0
        private void SignIn_Clicked()
        {
            //regex pattern check
            string pattern = @"[A-Z0-9a-z_]+";

            if (!Regex.IsMatch(Username.Text, pattern) || !Regex.IsMatch(Password.Password, pattern))
            {
                MessageBox.Show("Incorrect input, check and try again!");
                Username.Focus();
                return;
            }

            CONNECTION.DbHandle = new DataBaseHandler();
            //set attributes
            CONNECTION.DbHandle.Password = Password.Password;
            CONNECTION.DbHandle.Username = Username.Text;

            //test



            //endtest



            if (CONNECTION.DbHandle.DB_Query_Result())
            {
                UserFrame userFrame = new UserFrame();
                userFrame.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("The combination of username and password you have entered is incorrect!");
                this.reset();
            }
        }
示例#2
0
        private void SignIn_Clicked()
        {
            //regex pattern check
            string pattern = @"[A-Z0-9a-z_]+";
            if (!Regex.IsMatch(Username.Text, pattern) || !Regex.IsMatch(Password.Password, pattern))
            {
                MessageBox.Show("Incorrect input, check and try again!");
                Username.Focus();
                return;
            }

            CONNECTION.DbHandle = new DataBaseHandler();
            //set attributes
            CONNECTION.DbHandle.Password = Password.Password;
            CONNECTION.DbHandle.Username = Username.Text;

            //test

            //endtest

            if (CONNECTION.DbHandle.DB_Query_Result())
            {

                UserFrame userFrame = new UserFrame();
                userFrame.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("The combination of username and password you have entered is incorrect!");
                this.reset();
            }
        }