Made edit functionality for refills.

This commit is contained in:
Adam McCane 2024-02-21 10:47:48 -05:00
parent 7c7629b4ef
commit 1e7dc8b35c
4 changed files with 71 additions and 8 deletions

View File

@ -664,7 +664,7 @@ namespace Louis__Pharmacy_CNSA212_FP
if (dgvPrescription.Rows.Count > 0)
{
dgvPrescription.DataSource = ds.Tables[0];
//dgvPrescription.DataSource = ds.Tables[0];
// Console.WriteLine( dgvPatient.SelectedRows.Count);
DataGridViewRow row = new DataGridViewRow();
row = dgvPrescription.SelectedRows[0];

View File

@ -29,6 +29,7 @@ namespace Louis__Pharmacy_CNSA212_FP
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmRefill));
this.bindingNavigatorAddNewItem = new System.Windows.Forms.ToolStripButton();
@ -49,7 +50,11 @@ namespace Louis__Pharmacy_CNSA212_FP
this.patientid = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.medicationid = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rxnumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cmuRefill = new System.Windows.Forms.ContextMenuStrip(this.components);
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dgvRefills)).BeginInit();
this.cmuRefill.SuspendLayout();
this.SuspendLayout();
//
// bindingNavigatorAddNewItem
@ -124,17 +129,21 @@ namespace Louis__Pharmacy_CNSA212_FP
this.patientid,
this.medicationid,
this.rxnumber});
this.dgvRefills.ContextMenuStrip = this.cmuRefill;
this.dgvRefills.Location = new System.Drawing.Point(12, 12);
this.dgvRefills.Name = "dgvRefills";
this.dgvRefills.ReadOnly = true;
this.dgvRefills.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvRefills.Size = new System.Drawing.Size(613, 298);
this.dgvRefills.TabIndex = 1;
this.dgvRefills.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvRefills_CellDoubleClick);
//
// refillid
//
this.refillid.DataPropertyName = "Refill_id";
this.refillid.HeaderText = "Refill ID";
this.refillid.Name = "refillid";
this.refillid.ReadOnly = true;
//
// refilldate
//
@ -144,24 +153,49 @@ namespace Louis__Pharmacy_CNSA212_FP
this.refilldate.DefaultCellStyle = dataGridViewCellStyle1;
this.refilldate.HeaderText = "Date of Refill";
this.refilldate.Name = "refilldate";
this.refilldate.ReadOnly = true;
//
// patientid
//
this.patientid.DataPropertyName = "Patient_id";
this.patientid.HeaderText = "Patient ID";
this.patientid.Name = "patientid";
this.patientid.ReadOnly = true;
//
// medicationid
//
this.medicationid.DataPropertyName = "Medication_id";
this.medicationid.HeaderText = "Medication ID";
this.medicationid.Name = "medicationid";
this.medicationid.ReadOnly = true;
//
// rxnumber
//
this.rxnumber.DataPropertyName = "RxNum_id";
this.rxnumber.HeaderText = "Rx Number ID";
this.rxnumber.Name = "rxnumber";
this.rxnumber.ReadOnly = true;
//
// cmuRefill
//
this.cmuRefill.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.editToolStripMenuItem,
this.deleteToolStripMenuItem});
this.cmuRefill.Name = "cmuRefill";
this.cmuRefill.Size = new System.Drawing.Size(108, 48);
//
// editToolStripMenuItem
//
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.editToolStripMenuItem.Text = "Edit";
this.editToolStripMenuItem.Click += new System.EventHandler(this.editToolStripMenuItem_Click);
//
// deleteToolStripMenuItem
//
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.deleteToolStripMenuItem.Text = "Delete";
//
// frmRefill
//
@ -174,6 +208,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.Name = "frmRefill";
this.Text = "Louis\' Pharmacy - Prescription Refill";
((System.ComponentModel.ISupportInitialize)(this.dgvRefills)).EndInit();
this.cmuRefill.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -212,5 +247,8 @@ namespace Louis__Pharmacy_CNSA212_FP
private System.Windows.Forms.DataGridViewTextBoxColumn patientid;
private System.Windows.Forms.DataGridViewTextBoxColumn medicationid;
private System.Windows.Forms.DataGridViewTextBoxColumn rxnumber;
private System.Windows.Forms.ContextMenuStrip cmuRefill;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
}
}

View File

@ -45,6 +45,28 @@ namespace Louis__Pharmacy_CNSA212_FP
dgvRefills.DataSource = ds.Tables[0];
}
private void editToolStripMenuItem_Click(object sender, EventArgs e)
{
string refillID = "";
DataGridViewRow row = new DataGridViewRow();
row = dgvRefills.SelectedRows[0];
refillID = (row.Cells[0].Value).ToString();
frmRefillAdd add = new frmRefillAdd(false);
add.MdiParent = MdiParent;
add.StartPosition = FormStartPosition.CenterScreen;
add.Show();
add.Focus();
add.FillRefill(refillID);
}
private void dgvRefills_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
editToolStripMenuItem_Click(sender, e);
}
//private void btnSearch_Click(object sender, EventArgs e)
//{
// string patientID = "";

View File

@ -132,6 +132,9 @@
<metadata name="rxnumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cmuRefill.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>