private void btnRegister_Click(object sender, RoutedEventArgs e) { string userName = tbUserName.Text; string email = tbEmail.Text; string passWord = tbPassword.Password; string confirmPassword = tbConfirmPassword.Password; if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(passWord) || (passWord != confirmPassword)) { MessageBox.Show("Please enter a username, email and matching passwords", "Registration", MessageBoxButton.OK); } else { if (!registrationModel.Register(userName, email, passWord)) { MessageBox.Show("Registration failed. Please try again", "Registration", MessageBoxButton.OK); clearFields(); } else { clearFields(); MainWindow.Instance.SetCurrentPanel(UseControls.Login); } } }
private void Register() { TextBox_MasterPassword = GlobalResources.MasterPassword; TextBox_ConfirmMasterPassword = GlobalResources.ConfirmMasterPassword; GlobalResources.MasterPassword = null; GlobalResources.ConfirmMasterPassword = null; RegistrationModelObject.FullName = TextBox_FullName; RegistrationModelObject.EmployeeID = TextBox_EmployeeID; RegistrationModelObject.EmailID = TextBox_EmailID; RegistrationModelObject.MasterPassword = TextBox_MasterPassword; if (string.Equals(TextBox_MasterPassword, TextBox_ConfirmMasterPassword)) { RegistrationModelObject.Register(); RBSNavigationSystem.IPressedRegistrationScreenRegisterButton(); } }