Updated btnRxSearch_Click in frmInfo.cs.

PATIENT ID SEARCH NOW WORKS! (The other 3 dont... yet)
This commit is contained in:
Noah 2024-02-20 13:28:15 -05:00
parent e2d0b5b3ff
commit 1143f79035

View File

@ -24,7 +24,7 @@ namespace Louis__Pharmacy_CNSA212_FP
dgvPatient.DoubleClick += cmuPatientEdit_Click;
dgvPhysician.DoubleClick += cmuPhysicianEdit_Click;
dgvPrescription.DoubleClick += cmuRxEdit_Click;
dgvRx.DoubleClick += cmuRxEdit_Click;
tbcInfo.SelectedIndexChanged += frmInfoTabChange;
@ -126,12 +126,12 @@ namespace Louis__Pharmacy_CNSA212_FP
// if data grid view is not focused, run the search function
if (e.KeyCode == Keys.Enter && medicationIsActive && !dgvPrescription.Focused)
if (e.KeyCode == Keys.Enter && medicationIsActive && !dgvRx.Focused)
{
btnRxSearch_Click(sender,e);
}
// if data grid view is focused, run the edit function
else if (e.KeyCode == Keys.Enter && medicationIsActive && dgvPrescription.Focused)
else if (e.KeyCode == Keys.Enter && medicationIsActive && dgvRx.Focused)
{
cmuRxEdit_Click(sender,e);
}
@ -271,14 +271,14 @@ namespace Louis__Pharmacy_CNSA212_FP
// if (ds.Tables[0].Rows.Count > 0) // There is a record.
// {
// dgvPrescription.Visible = true;
// dgvRx.Visible = true;
// // Get data source.
// dgvPrescription.DataSource = ds.Tables[0];
// dgvPrescription.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
// dgvRx.DataSource = ds.Tables[0];
// dgvRx.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
// // Set the row and column header styles.
// dgvPrescription.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
// dgvPrescription.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
// dgvRx.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
// dgvRx.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
// }
// else
// {
@ -314,10 +314,10 @@ namespace Louis__Pharmacy_CNSA212_FP
// }
// cmuMedicationEdit.Enabled = dgvPrescription.Rows.Count > 0;
// cmuMedicationDelete.Enabled = dgvPrescription.Rows.Count > 0;
// cmuMedicationEdit.Enabled = dgvRx.Rows.Count > 0;
// cmuMedicationDelete.Enabled = dgvRx.Rows.Count > 0;
// dgvPrescription.Focus();
// dgvRx.Focus();
//}
@ -564,12 +564,12 @@ namespace Louis__Pharmacy_CNSA212_FP
private void cmuRxEdit_Click(object sender, EventArgs e)
{
if (dgvPrescription.Rows.Count > 0)
if (dgvRx.Rows.Count > 0)
{
dgvPrescription.DataSource = ds.Tables[0];
dgvRx.DataSource = ds.Tables[0];
DataGridViewRow row = new DataGridViewRow();
row = dgvPrescription.SelectedRows[0];
row = dgvRx.SelectedRows[0];
string rxID = "";
rxID = (row.Cells[0].Value).ToString();
frmMedication prescriptionAdd = new frmMedication(this, false);
@ -586,12 +586,12 @@ namespace Louis__Pharmacy_CNSA212_FP
if (dgvPrescription.Rows.Count > 0)
if (dgvRx.Rows.Count > 0)
{
dgvPrescription.DataSource = ds.Tables[0];
dgvRx.DataSource = ds.Tables[0];
DataGridViewRow row = new DataGridViewRow();
row = dgvPrescription.SelectedRows[0];
row = dgvRx.SelectedRows[0];
string medID = "";
medID = (row.Cells[0].Value).ToString();
@ -639,13 +639,18 @@ namespace Louis__Pharmacy_CNSA212_FP
string patID = "";
if (txtPrescriptionPatID.Text.Length + txtRxNumber.Text.Length > 0)
if (txtRxPatientID.Text.Length + txtRxNumber.Text.Length > 0)
{
try
{
rxNum = txtRxPrescriptionID.Text;
rxNum = txtRxPrescriptionID.Text;
medID = txtRxMedicationID.Text;
physID = txtRxPhysicianID.Text;
patID = txtRxPatientID.Text;
try
{
@ -656,14 +661,14 @@ namespace Louis__Pharmacy_CNSA212_FP
if (ds.Tables[0].Rows.Count > 0) // There is a record.
{
dgvPrescription.Visible = true;
dgvRx.Visible = true;
// Get data source.
dgvPrescription.DataSource = ds.Tables[0];
dgvPrescription.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
dgvRx.DataSource = ds.Tables[0];
dgvRx.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
// Set the row and column header styles.
dgvPrescription.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
dgvPrescription.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
dgvRx.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
dgvRx.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
}
else
{
@ -690,10 +695,10 @@ namespace Louis__Pharmacy_CNSA212_FP
}
cmuMedicationEdit.Enabled = dgvPrescription.Rows.Count > 0;
cmuMedicationDelete.Enabled = dgvPrescription.Rows.Count > 0;
cmuMedicationEdit.Enabled = dgvRx.Rows.Count > 0;
cmuMedicationDelete.Enabled = dgvRx.Rows.Count > 0;
dgvPrescription.Focus();
dgvRx.Focus();
}
}