private void btnSave_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you want to save?", "Save changes", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (dr == DialogResult.Yes)
            {
                frmProfessorHomePage php = new frmProfessorHomePage();
                string gender            = (rdoMale.Checked == true) ? "Male" : "Female";
                string teachStatus       = "";
                if (rdoFulltimer.Checked == true)
                {
                    teachStatus = "Fulltimer";
                }
                if (rdoParttimer.Checked == true)
                {
                    teachStatus = "Parttimer";
                }
                if (rdoRetiree.Checked == true)
                {
                    teachStatus = "Retiree";
                }
                md.UpdateUsersAccount(usersData.p_id, txtUsername.Text, txtPassword.Text, txtFirstName.Text, txtMiddleName.Text, txtLastName.Text, txtAddress.Text, gender, teachStatus, "", txtEmailAddress.Text, txtMobileNumber.Text);
                php.Show();
                php.lbl_id.Text = lbl_id.Text;
                this.Hide();
            }
        }
        private void btnCancel_Click(object sender, EventArgs e)
        {
            frmProfessorHomePage php = new frmProfessorHomePage();

            php.Show();
            php.lbl_id.Text = lbl_id.Text;
            this.Hide();
        }
Exemple #3
0
 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();
         }
     }
 }