From a3a2fa780eb72b427a8ae10e23d8f0c9fbc54801 Mon Sep 17 00:00:00 2001 From: EggMan20339 <99349302+EggMan20339@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:06:03 -0500 Subject: [PATCH 1/3] added prescription tab --- .../frmInfo.Designer.cs | 240 +++++++++++++++--- Louis'-Pharmacy_CNSA212-FP/frmInfo.cs | 33 ++- Louis'-Pharmacy_CNSA212-FP/frmInfo.resx | 5 +- .../frmMain.Designer.cs | 32 ++- 4 files changed, 254 insertions(+), 56 deletions(-) diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs index 55d6355..6dd53c7 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs @@ -80,10 +80,10 @@ namespace Louis__Pharmacy_CNSA212_FP this.Dosage = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Purpose = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.RxNum = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.cmuRx = new System.Windows.Forms.ContextMenuStrip(this.components); - this.cmuRxNew = new System.Windows.Forms.ToolStripMenuItem(); - this.cmuRxEdit = new System.Windows.Forms.ToolStripMenuItem(); - this.cmuRxDelete = new System.Windows.Forms.ToolStripMenuItem(); + this.cmuMedication = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cmuMedicationNew = new System.Windows.Forms.ToolStripMenuItem(); + this.cmuMedicationEdit = new System.Windows.Forms.ToolStripMenuItem(); + this.cmuMedicationDelete = new System.Windows.Forms.ToolStripMenuItem(); this.tbpPhysician = new System.Windows.Forms.TabPage(); this.splcPhysician = new System.Windows.Forms.SplitContainer(); this.txtPhysicianID = new System.Windows.Forms.TextBox(); @@ -107,6 +107,21 @@ namespace Louis__Pharmacy_CNSA212_FP this.cmuPhysicianNew = new System.Windows.Forms.ToolStripMenuItem(); this.cmuPhysicianEdit = new System.Windows.Forms.ToolStripMenuItem(); this.cmuPhysicianDelete = new System.Windows.Forms.ToolStripMenuItem(); + this.tbcInfoPrescriptions = new System.Windows.Forms.TabPage(); + this.txtRxPatientID = new System.Windows.Forms.TextBox(); + this.txtRxMedicationID = new System.Windows.Forms.TextBox(); + this.txtRxPhysicianID = new System.Windows.Forms.TextBox(); + this.txtRxPrescriptionID = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.btnRxSearch = new System.Windows.Forms.Button(); + this.dgvRx = new System.Windows.Forms.DataGridView(); + this.cmuPrescription = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cmuPrescriptionNew = new System.Windows.Forms.ToolStripMenuItem(); + this.cmuPrescriptionEdit = new System.Windows.Forms.ToolStripMenuItem(); + this.cmuPrescriptionDelete = new System.Windows.Forms.ToolStripMenuItem(); lblPatientFirst = new System.Windows.Forms.Label(); lblPatientLast = new System.Windows.Forms.Label(); lblPhysicianFirst = new System.Windows.Forms.Label(); @@ -125,7 +140,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.splcPrescription.Panel2.SuspendLayout(); this.splcPrescription.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvPrescription)).BeginInit(); - this.cmuRx.SuspendLayout(); + this.cmuMedication.SuspendLayout(); this.tbpPhysician.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splcPhysician)).BeginInit(); this.splcPhysician.Panel1.SuspendLayout(); @@ -133,6 +148,9 @@ namespace Louis__Pharmacy_CNSA212_FP this.splcPhysician.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvPhysician)).BeginInit(); this.cmuPhysician.SuspendLayout(); + this.tbcInfoPrescriptions.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvRx)).BeginInit(); + this.cmuPrescription.SuspendLayout(); this.SuspendLayout(); // // lblPatientFirst @@ -176,6 +194,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.tbcInfo.Controls.Add(this.tbpPatient); this.tbcInfo.Controls.Add(this.tbpMedication); this.tbcInfo.Controls.Add(this.tbpPhysician); + this.tbcInfo.Controls.Add(this.tbcInfoPrescriptions); this.tbcInfo.Location = new System.Drawing.Point(12, 12); this.tbcInfo.Name = "tbcInfo"; this.tbcInfo.SelectedIndex = 0; @@ -525,7 +544,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.dgvPrescription.AllowUserToDeleteRows = false; this.dgvPrescription.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Medication_id, this.MedicationName, this.IntakeMethod, this.Frequency, this.Dosage, this.Purpose, this.RxNum }); - this.dgvPrescription.ContextMenuStrip = this.cmuRx; + this.dgvPrescription.ContextMenuStrip = this.cmuMedication; this.dgvPrescription.Location = new System.Drawing.Point(3, 3); this.dgvPrescription.Name = "dgvPrescription"; this.dgvPrescription.ReadOnly = true; @@ -583,33 +602,33 @@ namespace Louis__Pharmacy_CNSA212_FP this.RxNum.Name = "RxNum"; this.RxNum.ReadOnly = true; // - // cmuRx + // cmuMedication // - this.cmuRx.ImageScalingSize = new System.Drawing.Size(20, 20); - this.cmuRx.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuRxNew, this.cmuRxEdit, this.cmuRxDelete }); - this.cmuRx.Name = "cmuRx"; - this.cmuRx.Size = new System.Drawing.Size(108, 70); + this.cmuMedication.ImageScalingSize = new System.Drawing.Size(20, 20); + this.cmuMedication.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuMedicationNew, this.cmuMedicationEdit, this.cmuMedicationDelete }); + this.cmuMedication.Name = "cmuMedication"; + this.cmuMedication.Size = new System.Drawing.Size(108, 70); // - // cmuRxNew + // cmuMedicationNew // - this.cmuRxNew.Name = "cmuRxNew"; - this.cmuRxNew.Size = new System.Drawing.Size(107, 22); - this.cmuRxNew.Text = "New"; - this.cmuRxNew.Click += new System.EventHandler(this.cmuRxNew_Click); + this.cmuMedicationNew.Name = "cmuMedicationNew"; + this.cmuMedicationNew.Size = new System.Drawing.Size(107, 22); + this.cmuMedicationNew.Text = "New"; + this.cmuMedicationNew.Click += new System.EventHandler(this.cmuRxNew_Click); // - // cmuRxEdit + // cmuMedicationEdit // - this.cmuRxEdit.Name = "cmuRxEdit"; - this.cmuRxEdit.Size = new System.Drawing.Size(107, 22); - this.cmuRxEdit.Text = "Edit"; - this.cmuRxEdit.Click += new System.EventHandler(this.cmuRxEdit_Click); + this.cmuMedicationEdit.Name = "cmuMedicationEdit"; + this.cmuMedicationEdit.Size = new System.Drawing.Size(107, 22); + this.cmuMedicationEdit.Text = "Edit"; + this.cmuMedicationEdit.Click += new System.EventHandler(this.cmuRxEdit_Click); // - // cmuRxDelete + // cmuMedicationDelete // - this.cmuRxDelete.Name = "cmuRxDelete"; - this.cmuRxDelete.Size = new System.Drawing.Size(107, 22); - this.cmuRxDelete.Text = "Delete"; - this.cmuRxDelete.Click += new System.EventHandler(this.cmuRxDelete_Click); + this.cmuMedicationDelete.Name = "cmuMedicationDelete"; + this.cmuMedicationDelete.Size = new System.Drawing.Size(107, 22); + this.cmuMedicationDelete.Text = "Delete"; + this.cmuMedicationDelete.Click += new System.EventHandler(this.cmuRxDelete_Click); // // tbpPhysician // @@ -645,8 +664,9 @@ namespace Louis__Pharmacy_CNSA212_FP // this.splcPhysician.Panel2.AutoScroll = true; this.splcPhysician.Panel2.Controls.Add(this.dgvPhysician); + this.splcPhysician.Panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.Panel2_Paint); this.splcPhysician.Size = new System.Drawing.Size(727, 478); - this.splcPhysician.SplitterDistance = 210; + this.splcPhysician.SplitterDistance = 195; this.splcPhysician.TabIndex = 0; // // txtPhysicianID @@ -696,12 +716,12 @@ namespace Louis__Pharmacy_CNSA212_FP this.dgvPhysician.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvPhysician.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Phys_id, this.namefirst, this.namelast, this.initialsmiddle, this.cit, this.state, this.zipp, this.dobb, this.numberphone, this.gennder, this.Specialty }); this.dgvPhysician.ContextMenuStrip = this.cmuPhysician; - this.dgvPhysician.Location = new System.Drawing.Point(0, 0); + this.dgvPhysician.Location = new System.Drawing.Point(0, 3); this.dgvPhysician.Name = "dgvPhysician"; this.dgvPhysician.ReadOnly = true; this.dgvPhysician.RowHeadersWidth = 51; this.dgvPhysician.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgvPhysician.Size = new System.Drawing.Size(727, 263); + this.dgvPhysician.Size = new System.Drawing.Size(727, 260); this.dgvPhysician.TabIndex = 0; this.dgvPhysician.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvPhysician_CellContentClick_1); // @@ -835,6 +855,135 @@ namespace Louis__Pharmacy_CNSA212_FP this.cmuPhysicianDelete.Text = "Delete"; this.cmuPhysicianDelete.Click += new System.EventHandler(this.cmuPhysicianDelete_Click); // + // tbcInfoPrescriptions + // + this.tbcInfoPrescriptions.Controls.Add(this.txtRxPatientID); + this.tbcInfoPrescriptions.Controls.Add(this.txtRxMedicationID); + this.tbcInfoPrescriptions.Controls.Add(this.txtRxPhysicianID); + this.tbcInfoPrescriptions.Controls.Add(this.txtRxPrescriptionID); + this.tbcInfoPrescriptions.Controls.Add(this.label4); + this.tbcInfoPrescriptions.Controls.Add(this.label3); + this.tbcInfoPrescriptions.Controls.Add(this.label2); + this.tbcInfoPrescriptions.Controls.Add(this.label1); + this.tbcInfoPrescriptions.Controls.Add(this.btnRxSearch); + this.tbcInfoPrescriptions.Controls.Add(this.dgvRx); + this.tbcInfoPrescriptions.Location = new System.Drawing.Point(4, 22); + this.tbcInfoPrescriptions.Name = "tbcInfoPrescriptions"; + this.tbcInfoPrescriptions.Padding = new System.Windows.Forms.Padding(3); + this.tbcInfoPrescriptions.Size = new System.Drawing.Size(733, 484); + this.tbcInfoPrescriptions.TabIndex = 5; + this.tbcInfoPrescriptions.Text = "Prescriptions"; + this.tbcInfoPrescriptions.UseVisualStyleBackColor = true; + // + // txtRxPatientID + // + this.txtRxPatientID.Location = new System.Drawing.Point(138, 121); + this.txtRxPatientID.Name = "txtRxPatientID"; + this.txtRxPatientID.Size = new System.Drawing.Size(124, 20); + this.txtRxPatientID.TabIndex = 9; + // + // txtRxMedicationID + // + this.txtRxMedicationID.Location = new System.Drawing.Point(138, 98); + this.txtRxMedicationID.Name = "txtRxMedicationID"; + this.txtRxMedicationID.Size = new System.Drawing.Size(124, 20); + this.txtRxMedicationID.TabIndex = 8; + // + // txtRxPhysicianID + // + this.txtRxPhysicianID.Location = new System.Drawing.Point(138, 75); + this.txtRxPhysicianID.Name = "txtRxPhysicianID"; + this.txtRxPhysicianID.Size = new System.Drawing.Size(124, 20); + this.txtRxPhysicianID.TabIndex = 7; + // + // txtRxPrescriptionID + // + this.txtRxPrescriptionID.Location = new System.Drawing.Point(138, 52); + this.txtRxPrescriptionID.Name = "txtRxPrescriptionID"; + this.txtRxPrescriptionID.Size = new System.Drawing.Size(124, 20); + this.txtRxPrescriptionID.TabIndex = 6; + // + // label4 + // + this.label4.Location = new System.Drawing.Point(32, 73); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(100, 23); + this.label4.TabIndex = 5; + this.label4.Text = "Physician ID:"; + this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(32, 96); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(100, 23); + this.label3.TabIndex = 4; + this.label3.Text = "Medication ID:"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(32, 119); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(100, 23); + this.label2.TabIndex = 3; + this.label2.Text = "Patient ID:"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(32, 50); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(100, 23); + this.label1.TabIndex = 2; + this.label1.Text = "Prescription ID:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // btnRxSearch + // + this.btnRxSearch.Location = new System.Drawing.Point(32, 186); + this.btnRxSearch.Name = "btnRxSearch"; + this.btnRxSearch.Size = new System.Drawing.Size(75, 23); + this.btnRxSearch.TabIndex = 1; + this.btnRxSearch.Text = "Search"; + this.btnRxSearch.UseVisualStyleBackColor = true; + this.btnRxSearch.Click += new System.EventHandler(this.btnRxSearch_Click); + // + // dgvRx + // + this.dgvRx.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvRx.Location = new System.Drawing.Point(0, 236); + this.dgvRx.Name = "dgvRx"; + this.dgvRx.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dgvRx.Size = new System.Drawing.Size(730, 248); + this.dgvRx.TabIndex = 0; + // + // cmuPrescription + // + this.cmuPrescription.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPrescriptionNew, this.cmuPrescriptionEdit, this.cmuPrescriptionDelete }); + this.cmuPrescription.Name = "cmuPrescription"; + this.cmuPrescription.Size = new System.Drawing.Size(108, 70); + // + // cmuPrescriptionNew + // + this.cmuPrescriptionNew.Name = "cmuPrescriptionNew"; + this.cmuPrescriptionNew.Size = new System.Drawing.Size(107, 22); + this.cmuPrescriptionNew.Text = "New"; + // + // cmuPrescriptionEdit + // + this.cmuPrescriptionEdit.Name = "cmuPrescriptionEdit"; + this.cmuPrescriptionEdit.Size = new System.Drawing.Size(107, 22); + this.cmuPrescriptionEdit.Text = "Edit"; + this.cmuPrescriptionEdit.Click += new System.EventHandler(this.cmuPrescriptionEdit_Click); + // + // cmuPrescriptionDelete + // + this.cmuPrescriptionDelete.Name = "cmuPrescriptionDelete"; + this.cmuPrescriptionDelete.Size = new System.Drawing.Size(107, 22); + this.cmuPrescriptionDelete.Text = "Delete"; + this.cmuPrescriptionDelete.Click += new System.EventHandler(this.cmuPrescriptionDelete_Click); + // // frmInfo // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -862,7 +1011,7 @@ namespace Louis__Pharmacy_CNSA212_FP ((System.ComponentModel.ISupportInitialize)(this.splcPrescription)).EndInit(); this.splcPrescription.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dgvPrescription)).EndInit(); - this.cmuRx.ResumeLayout(false); + this.cmuMedication.ResumeLayout(false); this.tbpPhysician.ResumeLayout(false); this.splcPhysician.Panel1.ResumeLayout(false); this.splcPhysician.Panel1.PerformLayout(); @@ -871,9 +1020,27 @@ namespace Louis__Pharmacy_CNSA212_FP this.splcPhysician.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dgvPhysician)).EndInit(); this.cmuPhysician.ResumeLayout(false); + this.tbcInfoPrescriptions.ResumeLayout(false); + this.tbcInfoPrescriptions.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvRx)).EndInit(); + this.cmuPrescription.ResumeLayout(false); this.ResumeLayout(false); } + private System.Windows.Forms.TextBox txtRxPhysicianID; + private System.Windows.Forms.TextBox txtRxMedicationID; + private System.Windows.Forms.TextBox txtRxPatientID; + private System.Windows.Forms.Button btnRxSearch; + + private System.Windows.Forms.DataGridView dgvRx; + + private System.Windows.Forms.ContextMenuStrip cmuPrescription; + private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionNew; + private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionEdit; + private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionDelete; + + private System.Windows.Forms.TabPage tbcInfoPrescriptions; + private System.Windows.Forms.DataGridViewTextBoxColumn MedicationName; private System.Windows.Forms.DataGridViewTextBoxColumn IntakeMethod; private System.Windows.Forms.DataGridViewTextBoxColumn Frequency; @@ -882,10 +1049,10 @@ namespace Louis__Pharmacy_CNSA212_FP private System.Windows.Forms.DataGridViewTextBoxColumn RxNum; private System.Windows.Forms.ContextMenuStrip cmuPatient; - private System.Windows.Forms.ContextMenuStrip cmuRx; - private System.Windows.Forms.ToolStripMenuItem cmuRxNew; - private System.Windows.Forms.ToolStripMenuItem cmuRxEdit; - private System.Windows.Forms.ToolStripMenuItem cmuRxDelete; + private System.Windows.Forms.ContextMenuStrip cmuMedication; + private System.Windows.Forms.ToolStripMenuItem cmuMedicationNew; + private System.Windows.Forms.ToolStripMenuItem cmuMedicationEdit; + private System.Windows.Forms.ToolStripMenuItem cmuMedicationDelete; private System.Windows.Forms.ToolStripMenuItem cmuPhysicianNew; private System.Windows.Forms.ToolStripMenuItem cmuPhysicianEdit; private System.Windows.Forms.ToolStripMenuItem cmuPhysicianDelete; @@ -948,5 +1115,10 @@ namespace Louis__Pharmacy_CNSA212_FP private System.Windows.Forms.Label lblPhysicianID; public System.Windows.Forms.TextBox txtPatientID; private System.Windows.Forms.Label lblPatientID; + System.Windows.Forms.Label label1 = new System.Windows.Forms.Label(); + System.Windows.Forms.Label label2 = new System.Windows.Forms.Label(); + System.Windows.Forms.Label label3 = new System.Windows.Forms.Label(); + System.Windows.Forms.Label label4 = new System.Windows.Forms.Label(); + System.Windows.Forms.TextBox txtRxPrescriptionID = new System.Windows.Forms.TextBox(); } } \ No newline at end of file diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs index 61eba14..371ecff 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs @@ -40,8 +40,8 @@ namespace Louis__Pharmacy_CNSA212_FP cmuPatientDelete.Enabled = false; cmuPhysicianEdit.Enabled = false; cmuPhysicianDelete.Enabled = false; - cmuRxEdit.Enabled = false; - cmuRxDelete.Enabled = false; + cmuMedicationEdit.Enabled = false; + cmuMedicationDelete.Enabled = false; txtPatientFirst.Focus(); @@ -300,8 +300,8 @@ namespace Louis__Pharmacy_CNSA212_FP } - cmuRxEdit.Enabled = dgvPrescription.Rows.Count > 0; - cmuRxDelete.Enabled = dgvPrescription.Rows.Count > 0; + cmuMedicationEdit.Enabled = dgvPrescription.Rows.Count > 0; + cmuMedicationDelete.Enabled = dgvPrescription.Rows.Count > 0; dgvPrescription.Focus(); @@ -573,5 +573,30 @@ namespace Louis__Pharmacy_CNSA212_FP { } + + private void Panel2_Paint(object sender, PaintEventArgs e) + { + + } + + private void cmuPrescriptionNew_Click(object sender, EventArgs e) + { + + } + + private void cmuPrescriptionEdit_Click(object sender, EventArgs e) + { + + } + + private void cmuPrescriptionDelete_Click(object sender, EventArgs e) + { + + } + + private void btnRxSearch_Click(object sender, EventArgs e) + { + + } } } diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.resx b/Louis'-Pharmacy_CNSA212-FP/frmInfo.resx index fb69f30..11332cc 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.resx +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.resx @@ -198,7 +198,7 @@ True - + 125, 17 @@ -237,6 +237,9 @@ 211, 17 + + 332, 17 + diff --git a/Louis'-Pharmacy_CNSA212-FP/frmMain.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmMain.Designer.cs index 1d62181..a481430 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmMain.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmMain.Designer.cs @@ -48,8 +48,7 @@ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuNavigation, this.mnuWindow, this.mnuHelp }); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Padding = new System.Windows.Forms.Padding(9, 3, 0, 3); - this.menuStrip1.Size = new System.Drawing.Size(1450, 35); + this.menuStrip1.Size = new System.Drawing.Size(967, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -57,20 +56,20 @@ // this.mnuNavigation.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuNavigationView, this.mnuNavigationAURRefill }); this.mnuNavigation.Name = "mnuNavigation"; - this.mnuNavigation.Size = new System.Drawing.Size(110, 29); + this.mnuNavigation.Size = new System.Drawing.Size(77, 20); this.mnuNavigation.Text = "Navigation"; // // mnuNavigationView // this.mnuNavigationView.Name = "mnuNavigationView"; - this.mnuNavigationView.Size = new System.Drawing.Size(373, 30); - this.mnuNavigationView.Text = "Patient/Prescription/Physician Search"; + this.mnuNavigationView.Size = new System.Drawing.Size(302, 22); + this.mnuNavigationView.Text = "Patient/Prescription/Physician/Prescription"; this.mnuNavigationView.Click += new System.EventHandler(this.mnuNavigationView_Click); // // mnuNavigationAURRefill // this.mnuNavigationAURRefill.Name = "mnuNavigationAURRefill"; - this.mnuNavigationAURRefill.Size = new System.Drawing.Size(373, 30); + this.mnuNavigationAURRefill.Size = new System.Drawing.Size(302, 22); this.mnuNavigationAURRefill.Text = "Add/Update/Remove Refill"; this.mnuNavigationAURRefill.Click += new System.EventHandler(this.mnuNavigationAURRefill_Click); // @@ -78,41 +77,41 @@ // this.mnuWindow.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuWindowArrangeIcons, this.mnuWindowCascade, this.mnuWindowHorizontal, this.mnuWindowVertical, this.mnuWindowCloseAll }); this.mnuWindow.Name = "mnuWindow"; - this.mnuWindow.Size = new System.Drawing.Size(90, 29); + this.mnuWindow.Size = new System.Drawing.Size(63, 20); this.mnuWindow.Text = "Window"; // // mnuWindowArrangeIcons // this.mnuWindowArrangeIcons.Name = "mnuWindowArrangeIcons"; - this.mnuWindowArrangeIcons.Size = new System.Drawing.Size(194, 30); + this.mnuWindowArrangeIcons.Size = new System.Drawing.Size(147, 22); this.mnuWindowArrangeIcons.Text = "Arrange Icons"; this.mnuWindowArrangeIcons.Click += new System.EventHandler(this.mnuWindowArrangeIcons_Click); // // mnuWindowCascade // this.mnuWindowCascade.Name = "mnuWindowCascade"; - this.mnuWindowCascade.Size = new System.Drawing.Size(194, 30); + this.mnuWindowCascade.Size = new System.Drawing.Size(147, 22); this.mnuWindowCascade.Text = "Cascade"; this.mnuWindowCascade.Click += new System.EventHandler(this.mnuWindowCascade_Click); // // mnuWindowHorizontal // this.mnuWindowHorizontal.Name = "mnuWindowHorizontal"; - this.mnuWindowHorizontal.Size = new System.Drawing.Size(194, 30); + this.mnuWindowHorizontal.Size = new System.Drawing.Size(147, 22); this.mnuWindowHorizontal.Text = "Horizontal"; this.mnuWindowHorizontal.Click += new System.EventHandler(this.mnuWindowHorizontal_Click); // // mnuWindowVertical // this.mnuWindowVertical.Name = "mnuWindowVertical"; - this.mnuWindowVertical.Size = new System.Drawing.Size(194, 30); + this.mnuWindowVertical.Size = new System.Drawing.Size(147, 22); this.mnuWindowVertical.Text = "Vertical"; this.mnuWindowVertical.Click += new System.EventHandler(this.mnuWindowVertical_Click); // // mnuWindowCloseAll // this.mnuWindowCloseAll.Name = "mnuWindowCloseAll"; - this.mnuWindowCloseAll.Size = new System.Drawing.Size(194, 30); + this.mnuWindowCloseAll.Size = new System.Drawing.Size(147, 22); this.mnuWindowCloseAll.Text = "Close All"; this.mnuWindowCloseAll.Click += new System.EventHandler(this.mnuWindowCloseAll_Click); // @@ -120,25 +119,24 @@ // this.mnuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuHelpAbout }); this.mnuHelp.Name = "mnuHelp"; - this.mnuHelp.Size = new System.Drawing.Size(61, 29); + this.mnuHelp.Size = new System.Drawing.Size(44, 20); this.mnuHelp.Text = "Help"; // // mnuHelpAbout // this.mnuHelpAbout.Name = "mnuHelpAbout"; - this.mnuHelpAbout.Size = new System.Drawing.Size(134, 30); + this.mnuHelpAbout.Size = new System.Drawing.Size(107, 22); this.mnuHelpAbout.Text = "About"; this.mnuHelpAbout.Click += new System.EventHandler(this.mnuHelpAbout_Click); // // frmMain // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1450, 942); + this.ClientSize = new System.Drawing.Size(967, 612); this.Controls.Add(this.menuStrip1); this.IsMdiContainer = true; this.MainMenuStrip = this.menuStrip1; - this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.Name = "frmMain"; this.Text = "frmMain"; this.Load += new System.EventHandler(this.frmMain_Load); From 382686e770165b56738d233cedf07999e39be6ec Mon Sep 17 00:00:00 2001 From: Noah Date: Tue, 20 Feb 2024 10:08:53 -0500 Subject: [PATCH 2/3] Added frmPrescription --- .../Louis'-Pharmacy_CNSA212-FP.csproj | 9 + .../frmPrescription.Designer.cs | 248 ++++++++++++++++++ Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs | 20 ++ .../frmPrescription.resx | 120 +++++++++ 4 files changed, 397 insertions(+) create mode 100644 Louis'-Pharmacy_CNSA212-FP/frmPrescription.Designer.cs create mode 100644 Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs create mode 100644 Louis'-Pharmacy_CNSA212-FP/frmPrescription.resx diff --git a/Louis'-Pharmacy_CNSA212-FP/Louis'-Pharmacy_CNSA212-FP.csproj b/Louis'-Pharmacy_CNSA212-FP/Louis'-Pharmacy_CNSA212-FP.csproj index 37fedb6..8288149 100644 --- a/Louis'-Pharmacy_CNSA212-FP/Louis'-Pharmacy_CNSA212-FP.csproj +++ b/Louis'-Pharmacy_CNSA212-FP/Louis'-Pharmacy_CNSA212-FP.csproj @@ -89,6 +89,12 @@ frmPhysician.cs + + Form + + + frmPrescription.cs + Form @@ -131,6 +137,9 @@ frmPhysician.cs + + frmPrescription.cs + frmRefill.cs diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.Designer.cs new file mode 100644 index 0000000..65160f9 --- /dev/null +++ b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.Designer.cs @@ -0,0 +1,248 @@ + +namespace Louis__Pharmacy_CNSA212_FP +{ + partial class frmPrescription + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtRxNum = new System.Windows.Forms.TextBox(); + this.txtPurpose = new System.Windows.Forms.TextBox(); + this.txtDosage = new System.Windows.Forms.TextBox(); + this.txtFrequency = new System.Windows.Forms.TextBox(); + this.txtIntake = new System.Windows.Forms.TextBox(); + this.txtName = new System.Windows.Forms.TextBox(); + this.txtMedID = new System.Windows.Forms.TextBox(); + this.lblDisPurpose = new System.Windows.Forms.Label(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnGO = new System.Windows.Forms.Button(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // txtRxNum + // + this.txtRxNum.Location = new System.Drawing.Point(433, 347); + this.txtRxNum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.txtRxNum.Name = "txtRxNum"; + this.txtRxNum.Size = new System.Drawing.Size(163, 22); + this.txtRxNum.TabIndex = 33; + // + // txtPurpose + // + this.txtPurpose.Location = new System.Drawing.Point(433, 313); + this.txtPurpose.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.txtPurpose.Name = "txtPurpose"; + this.txtPurpose.Size = new System.Drawing.Size(163, 22); + this.txtPurpose.TabIndex = 32; + // + // txtDosage + // + this.txtDosage.Location = new System.Drawing.Point(433, 279); + this.txtDosage.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.txtDosage.Name = "txtDosage"; + this.txtDosage.Size = new System.Drawing.Size(163, 22); + this.txtDosage.TabIndex = 31; + // + // txtFrequency + // + this.txtFrequency.Location = new System.Drawing.Point(433, 244); + this.txtFrequency.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.txtFrequency.Name = "txtFrequency"; + this.txtFrequency.Size = new System.Drawing.Size(163, 22); + this.txtFrequency.TabIndex = 30; + // + // txtIntake + // + this.txtIntake.Location = new System.Drawing.Point(433, 210); + this.txtIntake.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.txtIntake.Name = "txtIntake"; + this.txtIntake.Size = new System.Drawing.Size(163, 22); + this.txtIntake.TabIndex = 29; + // + // txtName + // + this.txtName.Location = new System.Drawing.Point(433, 175); + this.txtName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.txtName.Name = "txtName"; + this.txtName.Size = new System.Drawing.Size(163, 22); + this.txtName.TabIndex = 28; + // + // txtMedID + // + this.txtMedID.Location = new System.Drawing.Point(433, 141); + this.txtMedID.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.txtMedID.Name = "txtMedID"; + this.txtMedID.Size = new System.Drawing.Size(163, 22); + this.txtMedID.TabIndex = 27; + // + // lblDisPurpose + // + this.lblDisPurpose.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblDisPurpose.Location = new System.Drawing.Point(142, 32); + this.lblDisPurpose.Name = "lblDisPurpose"; + this.lblDisPurpose.Size = new System.Drawing.Size(615, 58); + this.lblDisPurpose.TabIndex = 26; + this.lblDisPurpose.Text = "Prescription"; + this.lblDisPurpose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btnCancel + // + this.btnCancel.Location = new System.Drawing.Point(782, 463); + this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(89, 28); + this.btnCancel.TabIndex = 25; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // btnGO + // + this.btnGO.Location = new System.Drawing.Point(667, 463); + this.btnGO.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnGO.Name = "btnGO"; + this.btnGO.Size = new System.Drawing.Size(89, 28); + this.btnGO.TabIndex = 24; + this.btnGO.UseVisualStyleBackColor = true; + // + // label7 + // + this.label7.Location = new System.Drawing.Point(282, 341); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(145, 34); + this.label7.TabIndex = 23; + this.label7.Text = "Rx Number:"; + this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label6 + // + this.label6.Location = new System.Drawing.Point(282, 307); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(145, 34); + this.label6.TabIndex = 22; + this.label6.Text = "Purpose:"; + this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label5 + // + this.label5.Location = new System.Drawing.Point(282, 272); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(145, 34); + this.label5.TabIndex = 21; + this.label5.Text = "Dosage:"; + this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label4 + // + this.label4.Location = new System.Drawing.Point(282, 238); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(145, 34); + this.label4.TabIndex = 20; + this.label4.Text = "Frequency:"; + this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(282, 203); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(145, 34); + this.label3.TabIndex = 19; + this.label3.Text = "Intake Method:"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(282, 169); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(145, 34); + this.label2.TabIndex = 18; + this.label2.Text = "Name:"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(282, 135); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(145, 34); + this.label1.TabIndex = 17; + this.label1.Text = "Medication ID:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // frmPrescription + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(929, 523); + this.Controls.Add(this.txtRxNum); + this.Controls.Add(this.txtPurpose); + this.Controls.Add(this.txtDosage); + this.Controls.Add(this.txtFrequency); + this.Controls.Add(this.txtIntake); + this.Controls.Add(this.txtName); + this.Controls.Add(this.txtMedID); + this.Controls.Add(this.lblDisPurpose); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnGO); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "frmPrescription"; + this.Text = "frmPrescription"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txtRxNum; + private System.Windows.Forms.TextBox txtPurpose; + private System.Windows.Forms.TextBox txtDosage; + private System.Windows.Forms.TextBox txtFrequency; + private System.Windows.Forms.TextBox txtIntake; + private System.Windows.Forms.TextBox txtName; + private System.Windows.Forms.TextBox txtMedID; + private System.Windows.Forms.Label lblDisPurpose; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnGO; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs new file mode 100644 index 0000000..1d8ba7e --- /dev/null +++ b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Louis__Pharmacy_CNSA212_FP +{ + public partial class frmPrescription : Form + { + public frmPrescription() + { + InitializeComponent(); + } + } +} diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.resx b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file From b363edb8e62542852a8ca8e66647bece51477248 Mon Sep 17 00:00:00 2001 From: EggMan20339 <99349302+EggMan20339@users.noreply.github.com> Date: Tue, 20 Feb 2024 11:28:32 -0500 Subject: [PATCH 3/3] Changed how frmPatient grabs the values from the textboxes --- .../frmInfo.Designer.cs | 2 +- Louis'-Pharmacy_CNSA212-FP/frmInfo.cs | 61 +- .../frmPatient.Designer.cs | 13 + Louis'-Pharmacy_CNSA212-FP/frmPatient.cs | 612 ++++++++---------- 4 files changed, 328 insertions(+), 360 deletions(-) diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs index 6dd53c7..c50d53e 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs @@ -628,7 +628,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.cmuMedicationDelete.Name = "cmuMedicationDelete"; this.cmuMedicationDelete.Size = new System.Drawing.Size(107, 22); this.cmuMedicationDelete.Text = "Delete"; - this.cmuMedicationDelete.Click += new System.EventHandler(this.cmuRxDelete_Click); + this.cmuMedicationDelete.Click += new System.EventHandler(this.cmuMedicationDelete_Click); // // tbpPhysician // diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs index 371ecff..60cbb3d 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs @@ -96,6 +96,20 @@ namespace Louis__Pharmacy_CNSA212_FP cmuPhysicianEdit_Click(sender, e); } + if (patientIsActive && e.KeyCode == Keys.Delete) + { + cmuPatientDelete_Click(sender, e); + } + if (physicianIsActive && e.KeyCode == Keys.Delete) + { + cmuPhysicianDelete_Click(sender, e); + } + if (medicationIsActive && e.KeyCode == Keys.Delete) + { + cmuMedicationDelete_Click(sender, e); + } + + // if data grid view is not focused, run the search function @@ -454,7 +468,13 @@ namespace Louis__Pharmacy_CNSA212_FP row = dgvPatient.SelectedRows[0]; string patid = ""; patid = (row.Cells[3].Value).ToString(); - PharmacyDataTier.DeletePatient(patid); + + DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete Patient: " + patid, + "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dialogResult == DialogResult.Yes) + { + PharmacyDataTier.DeletePatient(patid); + } btnPatientSearch_Click(sender, e); } @@ -503,18 +523,25 @@ namespace Louis__Pharmacy_CNSA212_FP row = dgvPhysician.SelectedRows[0]; string phyID = ""; phyID = (row.Cells[0].Value).ToString(); - PharmacyDataTier.DeletePhysician(phyID); - PhysicianReset(sender, e); + + DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete Physician: " + phyID, + "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dialogResult == DialogResult.Yes) + { + PharmacyDataTier.DeletePhysician(phyID); + } + + btnPhysicianSearch_Click(sender, e); } } - private void PhysicianReset(object sender, EventArgs e) - { - txtPhysicianFirst.Text = ""; - txtPhysicianLast.Text = ""; - txtPhysicianID.Text = ""; - dgvPhysician.Visible = false; - } + // private void PhysicianReset(object sender, EventArgs e) + // { + // txtPhysicianFirst.Text = ""; + // txtPhysicianLast.Text = ""; + // txtPhysicianID.Text = ""; + // dgvPhysician.Visible = false; + // } private void dgvPhysician_CellContentClick(object sender, DataGridViewCellEventArgs e) { @@ -552,9 +579,11 @@ namespace Louis__Pharmacy_CNSA212_FP } } - private void cmuRxDelete_Click(object sender, EventArgs e) + private void cmuMedicationDelete_Click(object sender, EventArgs e) { - + + + if (dgvPrescription.Rows.Count > 0) { @@ -563,7 +592,13 @@ namespace Louis__Pharmacy_CNSA212_FP row = dgvPrescription.SelectedRows[0]; string medID = ""; medID = (row.Cells[0].Value).ToString(); - PharmacyDataTier.DeleteMedication(medID); + + DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete medication: " + medID, + "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dialogResult == DialogResult.Yes) + { + PharmacyDataTier.DeleteMedication(medID); + } btnPrescriptionSearch_Click(sender, e); } diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPatient.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmPatient.Designer.cs index 000d9e1..cf7d04b 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmPatient.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmPatient.Designer.cs @@ -186,6 +186,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtPatientID.Name = "txtPatientID"; this.txtPatientID.Size = new System.Drawing.Size(100, 20); this.txtPatientID.TabIndex = 1; + this.txtPatientID.TextChanged += new System.EventHandler(this.txtPatientID_TextChanged); // // txtFname // @@ -193,6 +194,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtFname.Name = "txtFname"; this.txtFname.Size = new System.Drawing.Size(100, 20); this.txtFname.TabIndex = 2; + this.txtFname.TextChanged += new System.EventHandler(this.txtFname_TextChanged); // // txtLname // @@ -200,6 +202,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtLname.Name = "txtLname"; this.txtLname.Size = new System.Drawing.Size(100, 20); this.txtLname.TabIndex = 3; + this.txtLname.TextChanged += new System.EventHandler(this.txtLname_TextChanged); // // txtMidInit // @@ -207,6 +210,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtMidInit.Name = "txtMidInit"; this.txtMidInit.Size = new System.Drawing.Size(100, 20); this.txtMidInit.TabIndex = 4; + this.txtMidInit.TextChanged += new System.EventHandler(this.txtMidInit_TextChanged); // // txtWeight // @@ -214,6 +218,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtWeight.Name = "txtWeight"; this.txtWeight.Size = new System.Drawing.Size(100, 20); this.txtWeight.TabIndex = 5; + this.txtWeight.TextChanged += new System.EventHandler(this.txtWeight_TextChanged); // // txtHeightFt // @@ -221,6 +226,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtHeightFt.Name = "txtHeightFt"; this.txtHeightFt.Size = new System.Drawing.Size(100, 20); this.txtHeightFt.TabIndex = 6; + this.txtHeightFt.TextChanged += new System.EventHandler(this.txtHeightFt_TextChanged); // // txtHeightIn // @@ -228,6 +234,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtHeightIn.Name = "txtHeightIn"; this.txtHeightIn.Size = new System.Drawing.Size(100, 20); this.txtHeightIn.TabIndex = 7; + this.txtHeightIn.TextChanged += new System.EventHandler(this.txtHeightIn_TextChanged); // // txtDOB // @@ -235,6 +242,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtDOB.Name = "txtDOB"; this.txtDOB.Size = new System.Drawing.Size(100, 20); this.txtDOB.TabIndex = 8; + this.txtDOB.TextChanged += new System.EventHandler(this.txtDOB_TextChanged); // // txtCity // @@ -242,6 +250,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtCity.Name = "txtCity"; this.txtCity.Size = new System.Drawing.Size(100, 20); this.txtCity.TabIndex = 10; + this.txtCity.TextChanged += new System.EventHandler(this.txtCity_TextChanged); // // txtZip // @@ -249,6 +258,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtZip.Name = "txtZip"; this.txtZip.Size = new System.Drawing.Size(100, 20); this.txtZip.TabIndex = 11; + this.txtZip.TextChanged += new System.EventHandler(this.txtZip_TextChanged); // // txtState // @@ -256,6 +266,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtState.Name = "txtState"; this.txtState.Size = new System.Drawing.Size(100, 20); this.txtState.TabIndex = 12; + this.txtState.TextChanged += new System.EventHandler(this.txtState_TextChanged); // // txtPhone // @@ -263,6 +274,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.txtPhone.Name = "txtPhone"; this.txtPhone.Size = new System.Drawing.Size(100, 20); this.txtPhone.TabIndex = 13; + this.txtPhone.TextChanged += new System.EventHandler(this.txtPhone_TextChanged); // // lblDisPurpose // @@ -304,6 +316,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.cboGender.Name = "cboGender"; this.cboGender.Size = new System.Drawing.Size(100, 21); this.cboGender.TabIndex = 27; + this.cboGender.SelectedIndexChanged += new System.EventHandler(this.cboGender_SelectedIndexChanged); // // frmPatient // diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPatient.cs b/Louis'-Pharmacy_CNSA212-FP/frmPatient.cs index af8c4c6..f9eaaae 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmPatient.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmPatient.cs @@ -41,6 +41,8 @@ namespace Louis__Pharmacy_CNSA212_FP Close(); if (e.KeyCode == Keys.Enter) btnGO_Click(sender, e); + + } @@ -82,9 +84,9 @@ namespace Louis__Pharmacy_CNSA212_FP txtPhone.Text = ds.Tables[0].Rows[0]["PhoneNumber"].ToString(); } + ErrorProvider epLocal = new ErrorProvider(); private void btnGO_Click(object sender, EventArgs e) { - var epLocal = new ErrorProvider(); var Patient_id = txtPatientID.Text; var FirstName = txtFname.Text; @@ -92,369 +94,287 @@ namespace Louis__Pharmacy_CNSA212_FP var MiddleIntials = txtMidInit.Text; var City = txtCity.Text; - int lbs; - int Height_feet; - int Height_inches; - DateTime DOB; - string Gender; - short Zip; - string UsState; - string PhoneNumber; + int lbs = 0; + int Height_feet = 0; + int Height_inches = 0; + DateTime DOB = new DateTime(1753,1,1); + string Gender = ""; + short Zip = 0; + string UsState = ""; + string PhoneNumber= ""; var parseHasFailed = false; + int intLimit = 2147483647; - if (!isAdd) - try + + if (City.Length > 30) + { + epLocal.SetError(txtCity, "Invalid Value"); + parseHasFailed = true; + } + if (MiddleIntials.Length > 1) + { + epLocal.SetError(txtMidInit, "Invalid Value"); + parseHasFailed = true; + } + if (LastName.Length > 30) + { + epLocal.SetError(txtLname, "Invalid Value"); + parseHasFailed = true; + } + if (FirstName.Length > 30) + { + epLocal.SetError(txtFname, "Invalid Value"); + parseHasFailed = true; + } + + if (Patient_id.Length > 8) + { + epLocal.SetError(txtPatientID, "Invalid Value"); + parseHasFailed = true; + } + else + { + while (Patient_id.Length < 8) + { + Patient_id = "0" + Patient_id; + } + } + + + try + { + + if (txtPhone.Text.Length>0) + { + PhoneNumber = txtPhone.Text; + if (PhoneNumber.Length > 14) + { + throw new Exception(); + } + } + + } + catch (Exception exception) + { + epLocal.SetError(txtPhone, "Invalid value"); + parseHasFailed = true; + } + try + { + + if (txtState.Text.Length > 0) + { + UsState = txtState.Text.ToUpper(); + + if (UsState.Length > 2) + { + throw new Exception(); + } + } + + } + catch (Exception exception) + { + epLocal.SetError(txtState, "Invalid value"); + parseHasFailed = true; + } + + try + { + + if (txtZip.Text.Length > 0) + { + Zip = short.Parse(txtZip.Text); + + } + + } + catch (Exception exception) + { + epLocal.SetError(txtZip, "Invalid value"); + parseHasFailed = true; + } + + try + { + + Gender = cboGender.Text; + + if (Gender != "M" && Gender != "F") + { + throw new Exception(); + } + + } + catch (Exception exception) + { + epLocal.SetError(cboGender, "Invalid value"); + parseHasFailed = true; + } + try + { + + if (txtDOB.Text.Length > 0) + { + DOB = DateTime.Parse(txtDOB.Text); + } + + + } + catch (Exception exception) + { + epLocal.SetError(txtDOB, "Invalid value"); + parseHasFailed = true; + } + try + { + + if (txtHeightIn.Text.Length > 0) + { + Height_inches = int.Parse(txtHeightIn.Text); + if (Height_inches > 11 || Height_inches < 0) + { + throw new Exception(); + } + } + + } + catch (Exception exception) + { + epLocal.SetError(txtHeightIn, "Invalid value"); + parseHasFailed = true; + } + + + try + { + + if (txtHeightFt.Text.Length > 0) + { + Height_feet = int.Parse(txtHeightFt.Text); + if (Height_feet > 11 || Height_feet < 0) + { + throw new Exception(); + } + } + + } + catch (Exception exception) + { + epLocal.SetError(txtHeightFt, "Invalid value"); + parseHasFailed = true; + } + + try + { + + if (txtWeight.Text.Length > 0) { lbs = int.Parse(txtWeight.Text); - try + if (lbs > intLimit || lbs < 0) { - Height_feet = int.Parse(txtHeightFt.Text); - try - { - Height_inches = int.Parse(txtHeightIn.Text); - try - { - DOB = DateTime.Parse(txtDOB.Text); - try - { - Gender = cboGender.Text; - try - { - Zip = short.Parse(txtZip.Text); - try - { - UsState = txtState.Text; - try - { - PhoneNumber = txtPhone.Text; - - try - { - if (Patient_id.Length > 8) - { - epLocal.SetError(txtPatientID, "Error"); - throw new Exception(); - } - - while (Patient_id.Length < 8) Patient_id = "0" + Patient_id; - - if (FirstName.Length > 30) - { - epLocal.SetError(txtFname, "Error"); - throw new Exception(); - } - - if (LastName.Length > 30) - { - epLocal.SetError(txtLname, "Error"); - throw new Exception(); - } - - if (MiddleIntials.Length > 1) - { - epLocal.SetError(txtMidInit, "Error"); - throw new Exception(); - } - - MiddleIntials = MiddleIntials.ToUpper(); - - if (Zip > 65535) - { - epLocal.SetError(txtZip, "Error"); - throw new Exception(); - } - - if (City.Length > 30) - { - epLocal.SetError(txtCity, "Error"); - throw new Exception(); - } - - if (UsState.Length > 2) - { - epLocal.SetError(txtState, "Error"); - throw new Exception(); - } - - UsState = UsState.ToUpper(); - - if (lbs > 2147483647) - { - epLocal.SetError(txtWeight, "Error"); - throw new Exception(); - } - - if (Height_feet > 2147483647) - { - epLocal.SetError(txtHeightFt, "Error"); - throw new Exception(); - } - - if (Height_inches > 2147483647) - { - epLocal.SetError(txtHeightIn, "Error"); - throw new Exception(); - } - - if (PhoneNumber.Length > 14) - { - epLocal.SetError(txtPhone, "Error"); - throw new Exception(); - } - - if (Gender.Length > 1) - { - epLocal.SetError(cboGender, "Error"); - throw new Exception(); - } - - Gender = Gender.ToUpper(); - - PharmacyDataTier.UpdatePatient( - Patient_id, - FirstName, - LastName, - MiddleIntials, - lbs, - Height_feet, - Height_inches, - DOB, - Gender, - City, - Zip, - UsState, - PhoneNumber); - - - SourceForm.txtPatientID.Text = Patient_id; - SourceForm.btnPatientSearch_Click(SourceForm, e); - - Close(); - } - catch (Exception exception) - { - epLocal.SetError(btnGO, "Error Creating Patient"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtPhone, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtState, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtZip, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(cboGender, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtDOB, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtHeightIn, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtHeightFt, "Invalid Value"); + throw new Exception(); } } - catch (Exception ex) - { - epLocal.SetError(txtWeight, "Invalid Value"); - } - else if (isAdd) - try - { - lbs = int.Parse(txtWeight.Text); - try - { - Height_feet = int.Parse(txtHeightFt.Text); - try - { - Height_inches = int.Parse(txtHeightIn.Text); - try - { - DOB = DateTime.Parse(txtDOB.Text); - try - { - Gender = cboGender.Text; - try - { - Zip = short.Parse(txtZip.Text); - try - { - UsState = txtState.Text; - try - { - PhoneNumber = txtPhone.Text; - try - { - if (Patient_id.Length > 8) - { - epLocal.SetError(txtPatientID, "Error"); - throw new Exception(); - } - - while (Patient_id.Length < 8) Patient_id = "0" + Patient_id; - - if (FirstName.Length > 30) - { - epLocal.SetError(txtFname, "Error"); - throw new Exception(); - } - - if (LastName.Length > 30) - { - epLocal.SetError(txtLname, "Error"); - throw new Exception(); - } - - if (MiddleIntials.Length > 1) - { - epLocal.SetError(txtMidInit, "Error"); - throw new Exception(); - } - - MiddleIntials = MiddleIntials.ToUpper(); - - if (Zip > 65535) - { - epLocal.SetError(txtZip, "Error"); - throw new Exception(); - } - - if (City.Length > 30) - { - epLocal.SetError(txtCity, "Error"); - throw new Exception(); - } - - if (UsState.Length > 2) - { - epLocal.SetError(txtState, "Error"); - throw new Exception(); - } - - UsState = UsState.ToUpper(); - - if (lbs > 2147483647) - { - epLocal.SetError(txtWeight, "Error"); - throw new Exception(); - } - - if (Height_feet > 2147483647) - { - epLocal.SetError(txtHeightFt, "Error"); - throw new Exception(); - } - - if (Height_inches > 2147483647) - { - epLocal.SetError(txtHeightIn, "Error"); - throw new Exception(); - } - - if (PhoneNumber.Length > 14) - { - epLocal.SetError(txtPhone, "Error"); - throw new Exception(); - } - - if (Gender.Length > 1) - { - epLocal.SetError(cboGender, "Error"); - throw new Exception(); - } - - Gender = Gender.ToUpper(); - - PharmacyDataTier.CreatePatient( - Patient_id, - FirstName, - LastName, - MiddleIntials, - lbs, - Height_feet, - Height_inches, - DOB, - Gender, - City, - Zip, - UsState, - PhoneNumber); + } + catch (Exception exception) + { + epLocal.SetError(txtWeight, "Invalid value"); + parseHasFailed = true; + } - SourceForm.txtPatientID.Text = Patient_id; - SourceForm.btnPatientSearch_Click(SourceForm, e); + if (isAdd && !parseHasFailed) + { + PharmacyDataTier.CreatePatient(Patient_id, FirstName, LastName, MiddleIntials, lbs, Height_feet, Height_inches, DOB, Gender, City, Zip, UsState, PhoneNumber); + + SourceForm.txtPatientID.Text = Patient_id; + SourceForm.btnPatientSearch_Click(sender,e); + Close(); + } + else if (!isAdd && !parseHasFailed) + { + PharmacyDataTier.UpdatePatient(Patient_id, FirstName, LastName, MiddleIntials, lbs, Height_feet, Height_inches, DOB, Gender, City, Zip, UsState, PhoneNumber); + + SourceForm.txtPatientID.Text = Patient_id; + SourceForm.btnPatientSearch_Click(sender,e); + Close(); + } - Close(); - } - catch (Exception exception) - { - epLocal.SetError(btnGO, "Error Creating Patient"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtPhone, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtState, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtZip, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(cboGender, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtDOB, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtHeightIn, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtHeightFt, "Invalid Value"); - } - } - catch (Exception ex) - { - epLocal.SetError(txtWeight, "Invalid Value"); - } + } private void btnClose_Click(object sender, EventArgs e) { Close(); } + + private void txtPatientID_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtPatientID, ""); + } + + private void txtFname_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtFname, ""); + } + + private void txtLname_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtLname, ""); + } + + private void txtMidInit_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtMidInit, ""); + } + + private void txtWeight_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtWeight, ""); + } + + private void txtHeightFt_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtHeightFt, ""); + } + + private void txtHeightIn_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtHeightIn, ""); + } + + private void txtDOB_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtDOB, ""); + } + + private void txtCity_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtCity, ""); + } + + private void cboGender_SelectedIndexChanged(object sender, EventArgs e) + { + epLocal.SetError(cboGender, ""); + } + + private void txtZip_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtZip, ""); + } + + private void txtState_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtState, ""); + } + + private void txtPhone_TextChanged(object sender, EventArgs e) + { + epLocal.SetError(txtPhone, ""); + } } } \ No newline at end of file