示例#1
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            //if user did not supply userID pr password
            if (txtUserID.Text == "")
            {
                MessageBox.Show("Please enter a valid UserID.");
            }
            if (txtPassword.Text == "")
            {
                MessageBox.Show("Please enter a valid password.");
            }

            //if the userID and password did not match what we have in database
            var inputUserIDandPass = userSearch.FindUser(txtUserID.Text, txtPassword.Text);

            if (inputUserIDandPass == 0)
            {
                MessageBox.Show("Wrong username or password!!!");
            }

            //else direct them to the correct User Page
            else
            {
                if (inputUserIDandPass == 1)
                {
                    //take to user1 home page and give them the ID
                    this.Hide();
                    Page4 page4 = new Page4();
                    page4.Show();
                }
                else if (inputUserIDandPass == 2)
                {
                    this.Hide();
                    Page5 page5 = new Page5();
                    page5.Show();
                }
                else if (inputUserIDandPass == 3)
                {
                    //take to user3 home page and give them the ID
                    this.Hide();
                    Page6 page6 = new Page6();
                    page6.Show();
                }
                else if (inputUserIDandPass == 4)
                {
                    //take to user4 home page and give them the ID
                    this.Hide();
                    Page7 page7 = new Page7();
                    page7.Show();
                }
                else if (inputUserIDandPass == 5)
                {
                    //take to user5 home page and give them the ID
                    this.Hide();
                    Page8 page8 = new Page8();
                    page8.Show();
                }
            }
        }
示例#2
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var userID         = txtUserID.Text;
                var password       = txtPassword.Text;
                var valaidateLogin = login.FindUser(userID, password);


                if (valaidateLogin == 1 || valaidateLogin == 2 || valaidateLogin == 3 || valaidateLogin == 4 || valaidateLogin == 5)
                {
                    MessageBox.Show("Successfully login! \n Please fill out Password, First name, Email then click update. ");
                }
                else
                {
                    MessageBox.Show("Cannot login, Wrong infomation!");
                }
            }
            catch
            {
                MessageBox.Show("Connection time out, something went wront!");
            }
        }