private void bunifuThinButton21_Click(object sender, EventArgs e) { if (txtUserName.Text != "" && txtPassword.Text != "" && comboBox1.SelectedItem.ToString() != "") { if (comboBox1.SelectedItem.ToString() == "Admin") { string queryAdmin = "select * from [Administrator]"; DataTable dt = db.DataNavigationOperation(queryAdmin); foreach (DataRow dr in dt.Rows) { if (txtUserName.Text.ToLower() == dr[2].ToString().ToLower() && txtPassword.Text.ToLower() == dr[3].ToString().ToLower()) { Admin admin = new Admin(); admin.Show(); return; } } } // if (comboBox1.SelectedItem.ToString() == "Patient") { string queryAdmin = "select * from [Patient]"; DataTable dt = db.DataNavigationOperation(queryAdmin); foreach (DataRow dr in dt.Rows) { if (txtUserName.Text.ToLower() == dr[3].ToString().ToLower() && txtPassword.Text.ToLower() == dr[4].ToString().ToLower()) { Patient admin = new Patient(); admin.Show(); return; } } } if (comboBox1.SelectedItem.ToString() == "Pharmist") { string queryAdmin = "select * from [Pharmist]"; DataTable dt = db.DataNavigationOperation(queryAdmin); foreach (DataRow dr in dt.Rows) { if (txtUserName.Text.ToLower() == dr[3].ToString().ToLower() && txtPassword.Text.ToLower() == dr[4].ToString().ToLower()) { Pharmacy admin = new Pharmacy(); admin.Show(); return; } } } if (comboBox1.SelectedItem.ToString() == "Receptionist") { string queryAdmin = "select * from [Reception]"; DataTable dt = db.DataNavigationOperation(queryAdmin); foreach (DataRow dr in dt.Rows) { if (txtUserName.Text.ToLower() == dr[3].ToString().ToLower() && txtPassword.Text.ToLower() == dr[4].ToString().ToLower()) { Reciption admin = new Reciption(); admin.Show(); return; } } } if (comboBox1.SelectedItem.ToString() == "Doctor") { string queryAdmin = "select * from [Doctor]"; DataTable dt = db.DataNavigationOperation(queryAdmin); foreach (DataRow dr in dt.Rows) { if (txtUserName.Text.ToLower() == dr[3].ToString().ToLower() && txtPassword.Text.ToLower() == dr[4].ToString().ToLower()) { Doctor admin = new Doctor(); admin.Show(); return; } } } else { MessageBox.Show("Invalid Password"); } } else { MessageBox.Show("Please Enter All Feilds"); } }