private void btnCancel_Click(object sender, EventArgs e) { frmAdminHomePage ahp = new frmAdminHomePage(); ahp.Show(); this.Hide(); }
private void btnQuit_Click(object sender, EventArgs e) { Form ahp = new frmAdminHomePage(); ahp.Show(); this.Hide(); }
private void btnLogin_Click(object sender, EventArgs e) { if (txtUsername.Text != "" && txtPassword.Text != "") { //test the login request if (md.LoginTest(txtUsername.Text, ms.encryptPassword(txtPassword.Text)).GetValue(0).ToString() == "PASSED") { if (md.LoginTest(txtUsername.Text, ms.encryptPassword(txtPassword.Text)).GetValue(2).ToString() == "administrator") { frmAdminHomePage admin = new frmAdminHomePage(); admin.Show(); usersData.a_id = md.LoginTest(txtUsername.Text, ms.encryptPassword(txtPassword.Text)).GetValue(1).ToString(); this.Hide(); } else if (md.LoginTest(txtUsername.Text, ms.encryptPassword(txtPassword.Text)).GetValue(2).ToString() == "professor") { frmProfessorHomePage ph = new frmProfessorHomePage(); ph.Show(); usersData.p_id = md.LoginTest(txtUsername.Text, ms.encryptPassword(txtPassword.Text)).GetValue(1).ToString(); this.Hide(); } } else { MessageBox.Show("Account Doesn't Exists!", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPassword.Text = ""; txtUsername.Text = ""; txtUsername.Focus(); } } else { if (txtUsername.Text == "") { MessageBox.Show("Username is required!", "Username", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUsername.Focus(); } else if (txtPassword.Text == "") { MessageBox.Show("Password is required!", "Password", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPassword.Focus(); } } }