Got block functionality working on form add refill.

This commit is contained in:
Adam McCane 2024-02-20 11:55:05 -05:00
parent e5f67232df
commit 3c849ec779
3 changed files with 39 additions and 28 deletions

View File

@ -529,7 +529,7 @@ namespace Louis__Pharmacy_CNSA212_FP
} }
} }
public static DataSet NumberofRefills(string rxID) public DataSet NumberofRefills(string rxID)
{ {
try try
{ {

View File

@ -137,8 +137,8 @@
this.textBoxDescription.Size = new System.Drawing.Size(271, 126); this.textBoxDescription.Size = new System.Drawing.Size(271, 126);
this.textBoxDescription.TabIndex = 23; this.textBoxDescription.TabIndex = 23;
this.textBoxDescription.TabStop = false; this.textBoxDescription.TabStop = false;
this.textBoxDescription.Text = "This application is designed to efficiently update and add information into our d" + this.textBoxDescription.Text = "This application is designed to efficiently manipulate database information regar" +
"atabase."; "ding patients, physicians, prescriptions, medications, and refills.";
// //
// okButton // okButton
// //

View File

@ -67,18 +67,24 @@ namespace Louis__Pharmacy_CNSA212_FP
string patientID = ""; string patientID = "";
string medicationID = ""; string medicationID = "";
string rxNum = ""; string rxNum = "";
string numRefills = ""; Int32 numRefills = 0;
string pastNumRefills = ""; Int32 pastNumRefills = 0;
rxNum = txtRxNumber.Text.Trim(); rxNum = txtRxNumber.Text.Trim();
DataSet ds = new DataSet(); try
ds = PharmacyDataTier.NumberofRefills(rxNum);
if (ds.Tables[0].Columns[0] == ds.Tables[0].Columns[1])
{ {
MessageBox.Show("This prescription has reached the maximum number of refills.", "Max Refill", MessageBoxButtons.OK, MessageBoxIcon.Error ); DataSet ds = new DataSet();
PharmacyDataTier phaDT = new PharmacyDataTier();
ds = phaDT.NumberofRefills(rxNum);
numRefills = Int32.Parse(ds.Tables[0].Rows[0]["numRefills"].ToString());
pastNumRefills = Int32.Parse(ds.Tables[0].Rows[0]["pastNumRefills"].ToString());
if (numRefills == pastNumRefills)
{
MessageBox.Show("This prescription has reached the maximum number of refills.", "Max Refill", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
else else
{ {
@ -104,6 +110,11 @@ namespace Louis__Pharmacy_CNSA212_FP
} }
} }
} }
catch (Exception exception)
{
}
}
} }
} }