From ea7474900fe0b4b13fe2645bcf3805479e360eb9 Mon Sep 17 00:00:00 2001 From: Adam McCane Date: Wed, 21 Feb 2024 16:56:17 -0500 Subject: [PATCH] Merge --- .../PharmacyDataTier.cs | 28 +++++++++++++++++++ .../frmRefill.Designer.cs | 7 +++-- Louis'-Pharmacy_CNSA212-FP/frmRefill.cs | 15 ++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs b/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs index de40a46..11a2d1a 100644 --- a/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs +++ b/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs @@ -1235,6 +1235,34 @@ namespace Louis__Pharmacy_CNSA212_FP } } + public static void DecrementPastRefills(string rxNum) + { + try + { + myConn.Open(); + + cmdString.Parameters.Clear(); + + cmdString.Connection = myConn; + cmdString.CommandType = CommandType.StoredProcedure; + cmdString.CommandTimeout = 1500; + + cmdString.CommandText = "DecrementPastRefills"; + + cmdString.Parameters.Add("@Prescription_id", SqlDbType.VarChar, 11).Value = rxNum; + + cmdString.ExecuteNonQuery(); + } + catch (Exception ex) + { + throw new ArgumentException(ex.Message); + } + finally + { + myConn.Close(); + } + } + public static void CreatePrescription( string RxNum, string Patient_id, diff --git a/Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs index 156ca58..5a985e2 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs @@ -182,20 +182,21 @@ namespace Louis__Pharmacy_CNSA212_FP this.editToolStripMenuItem, this.deleteToolStripMenuItem}); this.cmuRefill.Name = "cmuRefill"; - this.cmuRefill.Size = new System.Drawing.Size(108, 48); + this.cmuRefill.Size = new System.Drawing.Size(181, 70); // // editToolStripMenuItem // this.editToolStripMenuItem.Name = "editToolStripMenuItem"; - this.editToolStripMenuItem.Size = new System.Drawing.Size(107, 22); + this.editToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.editToolStripMenuItem.Text = "Edit"; this.editToolStripMenuItem.Click += new System.EventHandler(this.editToolStripMenuItem_Click); // // deleteToolStripMenuItem // this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(107, 22); + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.deleteToolStripMenuItem.Text = "Delete"; + this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); // // frmRefill // diff --git a/Louis'-Pharmacy_CNSA212-FP/frmRefill.cs b/Louis'-Pharmacy_CNSA212-FP/frmRefill.cs index d0e2567..44050f5 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmRefill.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmRefill.cs @@ -67,6 +67,21 @@ namespace Louis__Pharmacy_CNSA212_FP editToolStripMenuItem_Click(sender, e); } + private void deleteToolStripMenuItem_Click(object sender, EventArgs e) + { + string refillID = ""; + string rxID = ""; + + DataGridViewRow row = new DataGridViewRow(); + row = dgvRefills.SelectedRows[0]; + + refillID = (row.Cells[0].Value).ToString(); + rxID = (row.Cells[4].Value).ToString(); + + PharmacyDataTier.DeleteRefill(refillID); + PharmacyDataTier.DecrementPastRefills(rxID); + } + //private void btnSearch_Click(object sender, EventArgs e) //{ // string patientID = "";