Added working delete functionality to refill form.
This commit is contained in:
parent
b29be83709
commit
546e75677e
@ -675,5 +675,35 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteRefill(string Refill_id)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
// open connection
|
||||
myConn.Open();
|
||||
//clear any parameters
|
||||
cmdString.Parameters.Clear();
|
||||
// command
|
||||
cmdString.Connection = myConn;
|
||||
cmdString.CommandType = CommandType.StoredProcedure;
|
||||
cmdString.CommandTimeout = 1500;
|
||||
cmdString.CommandText = "DeleteRefill";
|
||||
// Define input parameter
|
||||
cmdString.Parameters.Add("@Refill_id", SqlDbType.Char, 10).Value = Refill_id;
|
||||
|
||||
cmdString.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ArgumentException(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
myConn.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
1
Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs
generated
1
Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs
generated
@ -208,6 +208,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.cmuDelete.Name = "cmuDelete";
|
||||
this.cmuDelete.Size = new System.Drawing.Size(180, 22);
|
||||
this.cmuDelete.Text = "Delete";
|
||||
this.cmuDelete.Click += new System.EventHandler(this.cmuDelete_Click);
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
|
@ -85,17 +85,32 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
{
|
||||
string refillID = "";
|
||||
|
||||
if (dgvRefills.Rows.Count > 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private void cmuDelete_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);
|
||||
PharmacyDataTier.DeleteRefill(refillID);
|
||||
btnSearch_Click(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user