private void ViewB_Click(object sender, EventArgs e) { if (patientIDcb.SelectedIndex == 0) { MessageBox.Show("Please select valid Id"); return; } if (patientIDcb.SelectedIndex > 0) { DbConnector dbConn = new DbConnector(); dbConn.connect(); PatientHandler patientHandler = new PatientHandler(); int patientId = int.Parse(patientIDcb.SelectedItem.ToString()); bool status = patientHandler.checkPatientID(dbConn.getConn(), patientId); string selected1 = optional1ComboBox.SelectedItem.ToString().ToLower(); if (status) { if (optional1ComboBox.SelectedIndex == 0) { MessageBox.Show("Please select valid value for reading"); return; } if (optional1ComboBox.SelectedIndex > 0) { readingGridView.DataSource = patientHandler.patientWithOptional(dbConn.getConn(), patientId, selected1); } } else { MessageBox.Show("Invalid patient ID. Please try again", "Patient Not In Record", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void viewBtn_Click(object sender, EventArgs e) { DbConnector dbConn = new DbConnector(); dbConn.connect(); PatientHandler patientHandler = new PatientHandler(); int patientId = int.Parse(patientIDcomboBox.Text); bool status = patientHandler.checkPatientID(dbConn.getConn(), patientId); if (status) { patientGridView.DataSource = patientHandler.getSpecificPatientList(dbConn.getConn(), patientIDcomboBox.Text); } else { MessageBox.Show("Invalid patient ID. Please try again", "Patient Not In Record", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }