diff --git a/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs b/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs index 281950b..9775fcc 100644 --- a/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs +++ b/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs @@ -473,7 +473,7 @@ namespace Louis__Pharmacy_CNSA212_FP } } - public DataSet AddRefill(string refillID, DateTime date, string patientID, string medicationID, string rxNum) + public static void AddRefill(string refillID, DateTime date, string patientID, string medicationID, string rxNum) { try { @@ -493,14 +493,7 @@ namespace Louis__Pharmacy_CNSA212_FP cmdString.Parameters.Add("@medicationID", SqlDbType.VarChar, 7).Value = medicationID; cmdString.Parameters.Add("@rxNum", SqlDbType.VarChar, 11).Value = rxNum; - SqlDataAdapter aAdapter = new SqlDataAdapter(); - - aAdapter.SelectCommand = cmdString; - DataSet aDataSet = new DataSet(); - - aAdapter.Fill(aDataSet); - - return aDataSet; + cmdString.ExecuteNonQuery(); } catch (Exception ex) { @@ -512,7 +505,7 @@ namespace Louis__Pharmacy_CNSA212_FP } } - public DataSet UpdateRefill(string refillID, DateTime date, string patientID, string medicationID, string rxNum) + public static void UpdateRefill(string refillID, DateTime date, string patientID, string medicationID, string rxNum) { try { @@ -532,14 +525,7 @@ namespace Louis__Pharmacy_CNSA212_FP cmdString.Parameters.Add("@medicationID", SqlDbType.VarChar, 7).Value = medicationID; cmdString.Parameters.Add("@rxNum", SqlDbType.VarChar, 11).Value = rxNum; - SqlDataAdapter aAdapter = new SqlDataAdapter(); - - aAdapter.SelectCommand = cmdString; - DataSet aDataSet = new DataSet(); - - aAdapter.Fill(aDataSet); - - return aDataSet; + cmdString.ExecuteNonQuery(); } catch (Exception ex) { diff --git a/Louis'-Pharmacy_CNSA212-FP/frmRefillAdd.cs b/Louis'-Pharmacy_CNSA212-FP/frmRefillAdd.cs index 71a7f59..3a58acf 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmRefillAdd.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmRefillAdd.cs @@ -46,8 +46,8 @@ namespace Louis__Pharmacy_CNSA212_FP { DataSet ds = new DataSet(); - txtRefillID.Text = ds.Tables[0].Rows[0]["Refill_id"].ToString(); FillRefill(refillID); + txtRefillID.Text = ds.Tables[0].Rows[0]["Refill_id"].ToString(); } } @@ -80,10 +80,7 @@ namespace Louis__Pharmacy_CNSA212_FP medicationID= txtMedicationID.Text.Trim(); rxNum = txtRxNumber.Text.Trim(); - DataSet ds = new DataSet(); - PharmacyDataTier phaDT = new PharmacyDataTier(); - - ds = phaDT.AddRefill(refillID, date, patientID, medicationID, rxNum); + PharmacyDataTier.AddRefill(refillID, date, patientID, medicationID, rxNum); } else { @@ -93,10 +90,7 @@ namespace Louis__Pharmacy_CNSA212_FP medicationID = txtMedicationID.Text.Trim(); rxNum = txtRxNumber.Text.Trim(); - DataSet ds = new DataSet(); - PharmacyDataTier phaDT = new PharmacyDataTier(); - - ds = phaDT.UpdateRefill(refillID, date, patientID, medicationID, rxNum); + PharmacyDataTier.UpdateRefill(refillID, date, patientID, medicationID, rxNum); } } }