//register user and then redirect to manage bookings screen private void btnRegister_Click(object sender, EventArgs e) { string role; //get the user role if (radCustomer.Checked == true) { role = "Customer"; } else { role = "Owner"; } //set current user theCurrentUser = new ControlAccount(txtRegUser.Text, txtRegPass.Text, role); //register the account - returns true if succesful if (theCurrentUser.RegisterAccount(txtRegUser.Text, txtRegPass.Text, role) == true) { grpRegister.Visible = false; SetBookingsView(role); } else { theCurrentUser = null; MessageBox.Show("Username already exists!"); } }
private void btnLogin_Click(object sender, EventArgs e) { string check; //set current user - set role as customer for now theCurrentUser = new ControlAccount(txtLogUser.Text, txtLogPass.Text, "NEW"); check = theCurrentUser.CheckLogin(txtLogUser.Text, txtLogPass.Text); if (check == "nonuser") { MessageBox.Show("Username does not exist!"); } else if (check == "nonpassword") { MessageBox.Show("Incorrect Password!"); } else { grpLogin.Visible = false; SetBookingsView(check); } }