From 1e7dc8b35c3f8b1f1565bf7eff31418fcb7f1f60 Mon Sep 17 00:00:00 2001 From: Adam McCane Date: Wed, 21 Feb 2024 10:47:48 -0500 Subject: [PATCH] Made edit functionality for refills. --- Louis'-Pharmacy_CNSA212-FP/frmInfo.cs | 2 +- .../frmRefill.Designer.cs | 38 +++++++++++++++++++ Louis'-Pharmacy_CNSA212-FP/frmRefill.cs | 36 ++++++++++++++---- Louis'-Pharmacy_CNSA212-FP/frmRefill.resx | 3 ++ 4 files changed, 71 insertions(+), 8 deletions(-) diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs index 11c384b..1b19174 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs @@ -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]; diff --git a/Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs index b2539b7..156ca58 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmRefill.Designer.cs @@ -29,6 +29,7 @@ namespace Louis__Pharmacy_CNSA212_FP /// 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; } } \ No newline at end of file diff --git a/Louis'-Pharmacy_CNSA212-FP/frmRefill.cs b/Louis'-Pharmacy_CNSA212-FP/frmRefill.cs index ce6b98c..d0e2567 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmRefill.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmRefill.cs @@ -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 = ""; @@ -52,14 +74,14 @@ namespace Louis__Pharmacy_CNSA212_FP // try // { - //DataSet ds = new DataSet(); - //PharmacyDataTier phaDT = new PharmacyDataTier(); + //DataSet ds = new DataSet(); + //PharmacyDataTier phaDT = new PharmacyDataTier(); - //patientID = txtPatientID.Text.Trim(); - //if (txtDate.Text.Trim().Length > 0) - //{ - //date = DateTime.Parse(txtDate.Text.Trim()); - //} + //patientID = txtPatientID.Text.Trim(); + //if (txtDate.Text.Trim().Length > 0) + //{ + //date = DateTime.Parse(txtDate.Text.Trim()); + //} // ds = PharmacyDataTier.RefillSearch(date, patientID); diff --git a/Louis'-Pharmacy_CNSA212-FP/frmRefill.resx b/Louis'-Pharmacy_CNSA212-FP/frmRefill.resx index a0d70f5..0a6275b 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmRefill.resx +++ b/Louis'-Pharmacy_CNSA212-FP/frmRefill.resx @@ -132,6 +132,9 @@ True + + 17, 17 +