Exemplo n.º 1
0
        private void btlogin_Click(object sender, EventArgs e)
        {
            string userName = tbUserNameLogIn.Text.ToUpper();
            string password = tbPasswordLogIn.Text;
            string holderpw = "";
            string holderun = "";

            lblUserErrorLogIn.Visible     = false;
            lblPasswordErrorLogIn.Visible = false;
            if (userName != holderun)
            {
                lblUserErrorLogIn.Text        = "Error: User Name is Incorrect";
                lblUserErrorLogIn.Visible     = true;
                tbUserNameLogIn.Text          = "";
                lblPasswordErrorLogIn.Text    = "Error: User Name Error";
                lblPasswordErrorLogIn.Visible = true;
                tbPasswordLogIn.Text          = "";
            }

            else if (password != holderpw)
            {
                lblPasswordErrorLogIn.Text    = "Error: Password is Incorrect";
                lblPasswordErrorLogIn.Visible = true;
                tbPasswordLogIn.Text          = "";
            }
            else
            {
                //Close LogIn,the current open form.
                this.Hide();
                //Opens ViewPage
                fViewPage f = new fViewPage();
                f.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void btlogin_Click(object sender, EventArgs e)
        {
            int maxrow = 0;

            //Query to pull username and password from DB
            sql = "select * from AMH_Users " +
                  "where username = '******' AND password ='******'";
            maxrow = login(sql);

            if (maxrow > 0)
            {
                //Opens view page when login is successful.
                this.Hide();
                fViewPage f = new fViewPage();
                f.ShowDialog();
            }
            else
            {
                //Message box is shown stating that login was unsuccessful.
                MessageBox.Show("The username or password you entered is incorrect.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //This clears the textboxes when OK is clicked on message box.
                tbUserNameLogIn.Clear();
                tbPasswordLogIn.Clear();
                tbUserNameLogIn.Focus();
            }
        }
Exemplo n.º 3
0
        private void btClear_Click(object sender, EventArgs e)
        {
            fViewPage f = new fViewPage();

            f.ShowDialog();
        }