private void GuestButton_Click(object sender, RoutedEventArgs e) { CustomerModel guest = (CustomerModel)DBAccessHelper.GetUser("guest@guest", "guest"); OrderModel order = new OrderModel() { ID = 0, User = guest }; ChangePageTo(new SearchProductsPage(order)); }
private void VerifyLoginButton_Click(object sender, RoutedEventArgs e) { string email = staffEmailTxt.Text.Trim(); string password = staffPasswordPwb.Password; var staff = (StaffModel)DBAccessHelper.GetUser(email, password); // invalid staff memeber if (staff == null) { MessageBox.Show("Wrong email/password combination!"); return; } // valid staff member DialogResult = true; Close(); }
private void LoginButton_Click(object sender, RoutedEventArgs e) { // check email string email = EmailTextBox.Text; // invalid email if (!InputValidationHelper.ValidInput(EmailTextBox, EmailErrorMessage, ErrorHelper.UIError.InvalidEmail)) { return; } // otherwise valid // check credentials string password = PasswordPBox.Password; IUser userLoggingIn = DBAccessHelper.GetUser(email, password); // credentials are invalid if (userLoggingIn == null) { ErrorHelper.ShowInputError(ErrorHelper.UIError.EmailPasswordComboNotRecognised, EmailErrorMessage); ErrorHelper.ShowInputError(ErrorHelper.UIError.EmailPasswordComboNotRecognised, PasswordErrorMessage); return; } // customer logging in if (!userLoggingIn.IsStaff) { // credentials are valid OrderModel order = new OrderModel() { User = userLoggingIn }; ChangePageTo(new SearchProductsPage(order)); return; } // staff logging in var staffMember = (StaffModel)userLoggingIn; ChangePageTo(new StaffLandingPage(staffMember)); }