//register a user over the ApiLoginOperations with username, password & email private void but_Regestration_Click(object sender, EventArgs e) { try { string username = txb_Username.Text; string password = txb_Password.Text; string eMail = txb_EMail.Text; ApiLoginOperations ops = new ApiLoginOperations(); User user = ops.RegisterUser(username, password, eMail); if (username != String.Empty && password != String.Empty && eMail != String.Empty) { if (user == null) { //To present a successful registration //MessageBox.Show("There was an error"); MessageBox.Show("User account registered", "Successfully"); log.Error("Registration failed"); Login Login = new Login(); this.Hide(); Login.ShowDialog(); this.Close(); return; } Globals.LoggedInUser = user; MessageBox.Show("Registration successful"); Login login = new Login(); login.Show(); this.Hide(); log.Info("Registration successful"); } else { MessageBox.Show("Please fill in all fields", "Error"); log.Error("Registration form was not filled in correctly"); } } catch { log.Error("Registration failed"); } }
//register a user over the ApiLoginOperations with username, password & email private void but_Regestration_Click(object sender, EventArgs e) { try { string username = txb_Username.Text; string password = txb_Password.Text; string eMail = txb_EMail.Text; ApiLoginOperations ops = new ApiLoginOperations(); User user = ops.RegisterUser(username, password, eMail); if (username != String.Empty && password != String.Empty && eMail != String.Empty) { if (user == null) { //Create more than one error message MessageBox.Show("There was an error"); //ToDo Logging return; } Globals.LoggedInUser = user; MessageBox.Show("Registration successful"); FormLogin login = new FormLogin(); login.Show(); this.Hide(); //ToDo Logging } else { MessageBox.Show("Please file all fileds", "Error"); //ToDo Logging } } catch { //ToDo Logging } }