private void btn_signin_Click(object sender, EventArgs e)
 {
     if (checkUsername(cmb_loginas.SelectedItem.ToString(),
                       txt_username.Text) &&
         checkPassword(cmb_loginas.SelectedItem.ToString(),
                       txt_username.Text, txt_password.Text))
     {
         if (cmb_loginas.SelectedItem.ToString() == "Doctor")
         {
             doctorForm Doctor_Form = new doctorForm(this, txt_username.Text);
             this.Hide();
             Doctor_Form.Show();
         }
     }
     else if (!checkUsername(cmb_loginas.SelectedItem.ToString(),
                             txt_username.Text))
     {
         MessageBox.Show("Username does not exist", "Error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         MessageBox.Show("Password incorrect", "Error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #2
0
        private void btn_signin_Click(object sender, EventArgs e)
        {
            if (cmb_loginas.SelectedIndex >= 0 && cmb_loginas.SelectedIndex < 3)
            {
                if (checkUsername(cmb_loginas.SelectedItem.ToString(),
                                  txt_username.Text) &&
                    checkPassword(cmb_loginas.SelectedItem.ToString(),
                                  txt_username.Text, txt_password.Text))
                {
                    if (cmb_loginas.SelectedItem.ToString() == "Doctor")
                    {
                        doctorForm Doctor_Form = new doctorForm(this, txt_username.Text);

                        Doctor_Form.Show();
                    }
                    if (cmb_loginas.SelectedItem.ToString() == "Patient")
                    {
                        // Patient pat = new Patient(this, txt_username.Text);
                        PatientOpions a = new PatientOpions();

                        a.Show();
                    }
                    if (cmb_loginas.SelectedItem.ToString() == "Nurse")
                    {
                        NurseOptions b = new NurseOptions();
                        b.Show();
                        //  this.Close();
                    }
                }
                else if (!checkUsername(cmb_loginas.SelectedItem.ToString(),
                                        txt_username.Text))
                {
                    MessageBox.Show("Username does not exist", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Password incorrect", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                if (txt_username.Text == "pola" && txt_password.Text == "pola")
                {
                    AdminOptions adminForm = new AdminOptions();
                    adminForm.Show();
                }
            }
            txt_username.Text = "";
            txt_password.Text = "";
        }