Refill view functionality working.

This commit is contained in:
Adam McCane 2024-02-20 23:57:48 -05:00
parent f85b91d5d6
commit c0d15fed57
4 changed files with 65 additions and 11 deletions

View File

@ -600,6 +600,42 @@ namespace Louis__Pharmacy_CNSA212_FP
} }
} }
public static DataSet GetRefill(string rxID)
{
try
{
// open connection
myConn.Open();
//clear any parameters
cmdString.Parameters.Clear();
// command
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "GetRefills";
// Define input parameter
cmdString.Parameters.Add("@rxID", SqlDbType.VarChar, 11).Value = rxID;
// adapter and dataset
SqlDataAdapter aAdapter = new SqlDataAdapter();
aAdapter.SelectCommand = cmdString;
DataSet aDataSet = new DataSet();
// fill adapter
aAdapter.Fill(aDataSet);
// return dataSet
return aDataSet;
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
}
finally
{
myConn.Close();
}
}
public DataSet NumberofRefills(string rxID) public DataSet NumberofRefills(string rxID)
{ {
try try

View File

@ -921,8 +921,15 @@ namespace Louis__Pharmacy_CNSA212_FP
dgvMedication.Focus(); dgvMedication.Focus();
} }
private void cmuPrescriptionViewRefills_Click(object sender, EventArgs e) public void cmuPrescriptionViewRefills_Click(object sender, EventArgs e)
{ {
DataGridViewRow row = new DataGridViewRow();
row = dgvPrescription.SelectedRows[0];
string rxNumString = (row.Cells[0].Value).ToString();
Int32 rxNum = Int32.Parse(rxNumString);
frmRefill refill = new frmRefill(rxNum);
refill.ShowDialog();
} }
} }

View File

@ -67,12 +67,12 @@ namespace Louis__Pharmacy_CNSA212_FP
private void mnuNavigationAURRefill_Click(object sender, EventArgs e) private void mnuNavigationAURRefill_Click(object sender, EventArgs e)
{ {
frmRefill formRefill = new frmRefill(); //frmRefill formRefill = new frmRefill();
formRefill.MdiParent = this; //formRefill.MdiParent = this;
formRefill.StartPosition = FormStartPosition.CenterScreen; //formRefill.StartPosition = FormStartPosition.CenterScreen;
formRefill.Show(); //formRefill.Show();
formRefill.Focus(); //formRefill.Focus();
mnuNavigationAURRefill.Checked = true; mnuNavigationAURRefill.Checked = true;
} }

View File

@ -18,10 +18,13 @@ namespace Louis__Pharmacy_CNSA212_FP
public partial class frmRefill : Form public partial class frmRefill : Form
{ {
public DataSet ds = new DataSet(); public DataSet ds = new DataSet();
private int rxNum = 0;
public frmRefill() public frmRefill(int thisRxID)
{ {
InitializeComponent(); InitializeComponent();
rxNum = thisRxID;
frmRefill_Load(null, null);
} }
//private void rEFILLSBindingNavigatorSaveItem_Click(object sender, EventArgs e) //private void rEFILLSBindingNavigatorSaveItem_Click(object sender, EventArgs e)
@ -29,10 +32,18 @@ namespace Louis__Pharmacy_CNSA212_FP
//} //}
//private void frmRefill_Load(object sender, EventArgs e) private void frmRefill_Load(object sender, EventArgs e)
//{ {
// dgvRefills.Visible = false; int rxID = 0;
//}
DataGridViewRow row = new DataGridViewRow();
rxID = rxNum;
DataSet ds = new DataSet();
ds = PharmacyDataTier.GetRefill(rxID.ToString());
dgvRefills.DataSource = ds.Tables[0];
}
//private void btnSearch_Click(object sender, EventArgs e) //private void btnSearch_Click(object sender, EventArgs e)
//{ //{