private void lbRegister_Click(object sender, EventArgs e) { Frm_Login fLogin = new Frm_Login(); this.Hide(); fLogin.ShowDialog(); }
private void lbLogOut_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Are you sure you want to quit?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { CurrentUser.Username = null; Frm_Login lg = new Frm_Login(); this.Hide(); lg.ShowDialog(); } }
private void btnRegister_Click(object sender, EventArgs e) { string usernameErr = errorProvider1.GetError(txtUsername); string passwordErr = errorProvider2.GetError(txtPassword); string passwordConfimErr = errorProvider3.GetError(txtPasswordConfirm); string emaailErr = errorProvider4.GetError(txtEmail); if (usernameErr != "" || passwordErr != "" || passwordConfimErr != "" || emaailErr != "") { MessageBox.Show("Please enter valid information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtUsername.Text == "" || txtPassword.Text == "" || txtPasswordConfirm.Text == "" || txtEmail.Text == "") { MessageBox.Show("Please enter all mandatory fields", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtUsername.Text == "User Name" || txtPassword.Text == "Password" || txtPasswordConfirm.Text == "Password" || txtEmail.Text == "Email") { MessageBox.Show("Please enter all mandatory fields", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (BUS_User.Register(txtUsername.Text, txtPassword.Text, txtEmail.Text) == 1) { MessageBox.Show("Username already exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Insert user in database success!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); Frm_Login login = new Frm_Login(); this.Hide(); login.ShowDialog(); } }