Example #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //username input is not case sensitive
            string username = txtUsername.Text.Trim().ToLower();
            string password = txtPassword.Text;

            LogIn logIn = new LogIn(username, password);

            if (logIn.Authenticate())
            {
                userId   = logIn.GetUserId();
                authorId = userId;
                //Login Correct
                this.Close();
                thread = new Thread(openDashboard);
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            else
            {
                //Login Incorrect
                MessageBox.Show
                (
                    " Wrong Username or Password.\r" +
                    "If you are not a Registered User please Register.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation
                );
            }
        }
Example #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username = txtUsername.Text.Trim().ToLower();
            string password = txtPassword.Text;
            LogIn  logIn    = new LogIn(username, password);

            if (logIn.Authenticate())
            {
                //The credentials are correct
                userId = logIn.GetUserId();

                this.Close();
                thread = new Thread(OpenDashboard);
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            else
            {
                //Wrong credentials
                //Send Messagebox
            }
        }