Did more work on the add/update functionality.

This commit is contained in:
Adam McCane 2024-02-16 18:41:12 -05:00
parent 5b66345aeb
commit c645029540
2 changed files with 7 additions and 27 deletions

View File

@ -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 try
{ {
@ -493,14 +493,7 @@ namespace Louis__Pharmacy_CNSA212_FP
cmdString.Parameters.Add("@medicationID", SqlDbType.VarChar, 7).Value = medicationID; cmdString.Parameters.Add("@medicationID", SqlDbType.VarChar, 7).Value = medicationID;
cmdString.Parameters.Add("@rxNum", SqlDbType.VarChar, 11).Value = rxNum; cmdString.Parameters.Add("@rxNum", SqlDbType.VarChar, 11).Value = rxNum;
SqlDataAdapter aAdapter = new SqlDataAdapter(); cmdString.ExecuteNonQuery();
aAdapter.SelectCommand = cmdString;
DataSet aDataSet = new DataSet();
aAdapter.Fill(aDataSet);
return aDataSet;
} }
catch (Exception ex) 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 try
{ {
@ -532,14 +525,7 @@ namespace Louis__Pharmacy_CNSA212_FP
cmdString.Parameters.Add("@medicationID", SqlDbType.VarChar, 7).Value = medicationID; cmdString.Parameters.Add("@medicationID", SqlDbType.VarChar, 7).Value = medicationID;
cmdString.Parameters.Add("@rxNum", SqlDbType.VarChar, 11).Value = rxNum; cmdString.Parameters.Add("@rxNum", SqlDbType.VarChar, 11).Value = rxNum;
SqlDataAdapter aAdapter = new SqlDataAdapter(); cmdString.ExecuteNonQuery();
aAdapter.SelectCommand = cmdString;
DataSet aDataSet = new DataSet();
aAdapter.Fill(aDataSet);
return aDataSet;
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -46,8 +46,8 @@ namespace Louis__Pharmacy_CNSA212_FP
{ {
DataSet ds = new DataSet(); DataSet ds = new DataSet();
txtRefillID.Text = ds.Tables[0].Rows[0]["Refill_id"].ToString();
FillRefill(refillID); 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(); medicationID= txtMedicationID.Text.Trim();
rxNum = txtRxNumber.Text.Trim(); rxNum = txtRxNumber.Text.Trim();
DataSet ds = new DataSet(); PharmacyDataTier.AddRefill(refillID, date, patientID, medicationID, rxNum);
PharmacyDataTier phaDT = new PharmacyDataTier();
ds = phaDT.AddRefill(refillID, date, patientID, medicationID, rxNum);
} }
else else
{ {
@ -93,10 +90,7 @@ namespace Louis__Pharmacy_CNSA212_FP
medicationID = txtMedicationID.Text.Trim(); medicationID = txtMedicationID.Text.Trim();
rxNum = txtRxNumber.Text.Trim(); rxNum = txtRxNumber.Text.Trim();
DataSet ds = new DataSet(); PharmacyDataTier.UpdateRefill(refillID, date, patientID, medicationID, rxNum);
PharmacyDataTier phaDT = new PharmacyDataTier();
ds = phaDT.UpdateRefill(refillID, date, patientID, medicationID, rxNum);
} }
} }
} }