Пример #1
0
 private void LogInButton_Click(object sender, EventArgs e)
 {
     //Log in method called using management system
     User loggedInUser = managementSystem.logIn(EmailTextBox.Text, PasswordTextBox.Text);
     //If login is successful
     if (loggedInUser != null)
     {
         //Create a new main screen and pass the user as a parameter
         rentalScreen = new RentalMainScreen(loggedInUser);
         rentalScreen.Show();
         this.Hide();
     }
     else // Login failed
     {
         MessageBox.Show("Invalid login. Please Try again.");
     }
 }
 private void registerButton_Click(object sender, EventArgs e)
 {
     //Checks that textboxes are filled
     if (checkValidTextBoxes())
     {
         //If they are, call register from management system, textbox values passed as parameters
         if (managementSystem.register(firstNameTextBox.Text, lastNameTextBox.Text, emailTextBox.Text,
            passwordTextBox.Text, addressTextBox.Text, cityTextBox.Text, stateComboBox.Text, zipTextBox.Text))
         {
             //Create a new user and log them in
             User loggedInUser = managementSystem.logIn(emailTextBox.Text, passwordTextBox.Text);
             if (loggedInUser != null)
             {
                 //Create new main screen and pass the new user
                 rentalScreen = new RentalMainScreen(loggedInUser);
                 rentalScreen.Show();
                 this.Hide();
             }
         }
     }
 }