Ejemplo n.º 1
0
        private void cmdSkipLogin_Click(object sender, EventArgs e)
        {
            HomePage homePage = new HomePage();

            User newUser = new User("username", "password", "Admin", "Hack", null, "Example bio");

            homePage.setCurrentUser(newUser);
            homePage.Show();

            this.Hide();
        }
Ejemplo n.º 2
0
        /*
         * Button to attempt the login
         * @AUTHOR: Andrew Davis
         */
        private void cmdLogin_Click(object sender, EventArgs e)
        {
            // Create a LoginModel object to handle the login
            LoginModel loginModel = new LoginModel();

            // Get the user credentials from the form
            String username = txtUsername.Text;
            String password = txtPassword.Text;

            // Attempt the login
            User loggedIn = loginModel.doLogin(username, password);

            // If it was successful, go to the Home Page
            if (loggedIn != null)
            {

                MessageBox.Show("SUCCESS! LOGGED IN AS: " + loggedIn.getFirstName() + " " + loggedIn.getLastName());

                // Create a Home Form
                HomePage homeForm = new HomePage();

                // Set the Current User of the HomePage to be the newly logged in user
                homeForm.setCurrentUser(loggedIn);

                // Show the Home Form
                homeForm.Show();

                // Hide the current form
                this.Hide();

            }
            else
            {
                MessageBox.Show("UNSUCCESSFUL LOGIN");

                // Clear the Password field
                txtPassword.Text = "";
            }
        }