Finished refill add and update functionality.

This commit is contained in:
Adam McCane 2024-02-17 00:22:25 -05:00
parent 5c6b0eb208
commit 6b0ffde53e
4 changed files with 39 additions and 12 deletions

View File

@ -373,7 +373,7 @@ namespace Louis__Pharmacy_CNSA212_FP
cmdString.CommandText = "SearchRefills";
// Define input parameter
cmdString.Parameters.Add("@date", SqlDbType.Date).Value = date;
cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 8).Value = id;
cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 10).Value = id;
// adapter and dataset
SqlDataAdapter aAdapter = new SqlDataAdapter();
aAdapter.SelectCommand = cmdString;
@ -407,9 +407,10 @@ namespace Louis__Pharmacy_CNSA212_FP
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "SearchRefills";
cmdString.CommandText = "SearchRefills2";
// Define input parameter
cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 8).Value = id;
cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 10).Value = id;
//cmdString.Parameters.Add("@date", SqlDbType.Date).Value = "";
// adapter and dataset
SqlDataAdapter aAdapter = new SqlDataAdapter();
aAdapter.SelectCommand = cmdString;

View File

@ -187,24 +187,26 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuUpdate,
this.cmuDelete});
this.cmuRefill.Name = "contextMenuStrip1";
this.cmuRefill.Size = new System.Drawing.Size(113, 70);
this.cmuRefill.Size = new System.Drawing.Size(181, 92);
//
// cmuAdd
//
this.cmuAdd.Name = "cmuAdd";
this.cmuAdd.Size = new System.Drawing.Size(112, 22);
this.cmuAdd.Size = new System.Drawing.Size(180, 22);
this.cmuAdd.Text = "Add";
this.cmuAdd.Click += new System.EventHandler(this.cmuAdd_Click);
//
// cmuUpdate
//
this.cmuUpdate.Name = "cmuUpdate";
this.cmuUpdate.Size = new System.Drawing.Size(112, 22);
this.cmuUpdate.Size = new System.Drawing.Size(180, 22);
this.cmuUpdate.Text = "Update";
this.cmuUpdate.Click += new System.EventHandler(this.cmuUpdate_Click);
//
// cmuDelete
//
this.cmuDelete.Name = "cmuDelete";
this.cmuDelete.Size = new System.Drawing.Size(112, 22);
this.cmuDelete.Size = new System.Drawing.Size(180, 22);
this.cmuDelete.Text = "Delete";
//
// splitContainer1

View File

@ -17,6 +17,8 @@ namespace Louis__Pharmacy_CNSA212_FP
{
public partial class frmRefill : Form
{
public DataSet ds = new DataSet();
public frmRefill()
{
InitializeComponent();
@ -39,7 +41,7 @@ namespace Louis__Pharmacy_CNSA212_FP
try
{
DataSet ds = new DataSet();
//DataSet ds = new DataSet();
//PharmacyDataTier phaDT = new PharmacyDataTier();
patientID = txtPatientID.Text.Trim();
@ -69,5 +71,31 @@ namespace Louis__Pharmacy_CNSA212_FP
}
}
private void cmuAdd_Click(object sender, EventArgs e)
{
frmRefillAdd refillAdd = new frmRefillAdd(true);
refillAdd.MdiParent = MdiParent;
refillAdd.StartPosition = FormStartPosition.CenterScreen;
refillAdd.Show();
refillAdd.Focus();
}
private void cmuUpdate_Click(object sender, EventArgs e)
{
string refillID = "";
dgvRefills.DataSource = ds.Tables[0];
DataGridViewRow row = new DataGridViewRow();
row = dgvRefills.SelectedRows[0];
refillID = (row.Cells[0].Value).ToString();
frmRefillAdd refillUpdate = new frmRefillAdd(false);
refillUpdate.MdiParent = MdiParent;
refillUpdate.StartPosition = FormStartPosition.CenterScreen;
refillUpdate.Show();
refillUpdate.Focus();
refillUpdate.FillRefill(refillID);
}
}
}

View File

@ -35,7 +35,6 @@ namespace Louis__Pharmacy_CNSA212_FP
private void frmRefillAdd_Load(object sender, EventArgs e)
{
txtRefillID.Enabled = false;
string refillID = "";
if (isAdd)
{
@ -44,10 +43,7 @@ namespace Louis__Pharmacy_CNSA212_FP
}
else
{
DataSet ds = new DataSet();
FillRefill(refillID);
txtRefillID.Text = ds.Tables[0].Rows[0]["Refill_id"].ToString();
}
}