private void CreateUser(object sender, RoutedEventArgs e) { string name = this.cuwNameField?.Text; string username = this.cuwUsernameField?.Text; string password = this.cuwPasswordBox?.Password; string errorMessage = GiftManager.HasInvalidMemberTextFields(name, username, password); if (!string.IsNullOrEmpty(errorMessage)) { MessageBox.Show(errorMessage); return; } string comboText = this.comboBox.Text; bool isAdminUser = comboText.Equals("Yes") ? true : false; bool[] creationInfo = GiftManager.CreateUser(name, username, password, isAdminUser); bool created = creationInfo[0]; if (created) { ShowUserCreatedBalloonNotification(name, username); ClearAllFields(); } else { MessageBox.Show($"An error occurred, and {username} could not be added", $"Error adding {name}", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void CreateUser(object sender, RoutedEventArgs e) { string name = this.cuwNameField?.Text; string username = this.cuwUsernameField?.Text; string password = this.cuwPasswordBox?.Password; string errorMessage = GiftManager.HasInvalidMemberTextFields(name, username, password); if (!string.IsNullOrEmpty(errorMessage)) { MessageBox.Show(errorMessage); return; } bool[] creationInfo = GiftManager.CreateUser(name, username, password, false); bool created = creationInfo[0]; bool isAdminUser = creationInfo[1]; if (created) { if (isAdminUser) { var dashboard = new AdminDashboard(); dashboard.Show(); this.Close(); } else { var dashboard = new Dashboard(); dashboard.Show(); this.Close(); } } }