diff --git a/Louis'-Pharmacy_CNSA212-FP/frmRefillAdd.cs b/Louis'-Pharmacy_CNSA212-FP/frmRefillAdd.cs index 1a6954f..c29e32a 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmRefillAdd.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmRefillAdd.cs @@ -15,6 +15,7 @@ namespace Louis__Pharmacy_CNSA212_FP { private static bool isAdd; public DataSet ds = new DataSet(); + public string currentID = ""; public frmRefillAdd(bool isNew) { @@ -59,6 +60,8 @@ namespace Louis__Pharmacy_CNSA212_FP txtPatientID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString(); txtMedicationID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString(); txtRxNumber.Text = ds.Tables[0].Rows[0]["RxNum_id"].ToString(); + + currentID = txtRxNumber.Text; } private void btnAdd_Click(object sender, EventArgs e) @@ -94,6 +97,13 @@ namespace Louis__Pharmacy_CNSA212_FP frmRefill refill = new frmRefill(0); PharmacyDataTier.UpdateRefill(refillID, date, patientID, medicationID, rxNum); + + if (currentID != rxNum) + { + PharmacyDataTier.DecrementPastRefills(currentID); + PharmacyDataTier.PastRefills(rxNum); + } + refill.Controls.Clear(); refill.Activate(); }