From 1f1de3e6d56938940416294a625ade877604b5d8 Mon Sep 17 00:00:00 2001 From: Noah Date: Tue, 20 Feb 2024 13:12:40 -0500 Subject: [PATCH] Update frmInfo and PharmacyDataTier --- .../PharmacyDataTier.cs | 45 ++- .../frmInfo.Designer.cs | 322 ++++++++++++------ Louis'-Pharmacy_CNSA212-FP/frmInfo.cs | 174 +++++++--- Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs | 4 +- 4 files changed, 380 insertions(+), 165 deletions(-) diff --git a/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs b/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs index 9f8fafb..91f5b79 100644 --- a/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs +++ b/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs @@ -492,7 +492,7 @@ namespace Louis__Pharmacy_CNSA212_FP } - public static DataSet PrescriptionInfoSearch(string rxID, string patientID, string medID, string physID) + public static DataSet PrescriptionInfoSearch(string rxID, string patID, string medID, string physID) { try { @@ -507,7 +507,7 @@ namespace Louis__Pharmacy_CNSA212_FP cmdString.CommandText = "PerscriptionInfoSearch"; // Define input parameter cmdString.Parameters.Add("@rxID", SqlDbType.VarChar, 11).Value = rxID; - cmdString.Parameters.Add("@patientID", SqlDbType.VarChar, 8).Value = patientID; + cmdString.Parameters.Add("@patientID", SqlDbType.VarChar, 8).Value = patID; cmdString.Parameters.Add("@physicianID", SqlDbType.VarChar, 8).Value = physID; cmdString.Parameters.Add("@medID", SqlDbType.VarChar, 8).Value = medID; // adapter and dataset @@ -851,6 +851,47 @@ namespace Louis__Pharmacy_CNSA212_FP } } + public static double GetNextRxNum() + { + try + { + // open connection + myConn.Open(); + //clear any parameters + cmdString.Parameters.Clear(); + // command + cmdString.Connection = myConn; + cmdString.CommandType = CommandType.StoredProcedure; + cmdString.CommandTimeout = 1500; + cmdString.CommandText = "GetNextRxNum"; + + object result = cmdString.ExecuteScalar(); + double value = 0; + try + { + value = Convert.ToDouble(result); + + } + catch (Exception e) + { + MessageBox.Show("Error Getting next Rx Number", "ERROR", MessageBoxButtons.OK); + } + + + // return dataSet + return value; + } + catch (Exception ex) + { + throw new ArgumentException(ex.Message); + } + finally + { + myConn.Close(); + } + } + + public static DataSet RefillSearch(DateTime date, string id) { try diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs index c50d53e..46b507c 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs @@ -156,36 +156,40 @@ namespace Louis__Pharmacy_CNSA212_FP // lblPatientFirst // lblPatientFirst.AutoSize = true; - lblPatientFirst.Location = new System.Drawing.Point(20, 28); + lblPatientFirst.Location = new System.Drawing.Point(27, 34); + lblPatientFirst.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); lblPatientFirst.Name = "lblPatientFirst"; - lblPatientFirst.Size = new System.Drawing.Size(60, 13); + lblPatientFirst.Size = new System.Drawing.Size(80, 17); lblPatientFirst.TabIndex = 4; lblPatientFirst.Text = "First Name:"; // // lblPatientLast // lblPatientLast.AutoSize = true; - lblPatientLast.Location = new System.Drawing.Point(20, 69); + lblPatientLast.Location = new System.Drawing.Point(27, 85); + lblPatientLast.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); lblPatientLast.Name = "lblPatientLast"; - lblPatientLast.Size = new System.Drawing.Size(61, 13); + lblPatientLast.Size = new System.Drawing.Size(80, 17); lblPatientLast.TabIndex = 5; lblPatientLast.Text = "Last Name:"; // // lblPhysicianFirst // lblPhysicianFirst.AutoSize = true; - lblPhysicianFirst.Location = new System.Drawing.Point(24, 26); + lblPhysicianFirst.Location = new System.Drawing.Point(32, 32); + lblPhysicianFirst.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); lblPhysicianFirst.Name = "lblPhysicianFirst"; - lblPhysicianFirst.Size = new System.Drawing.Size(60, 13); + lblPhysicianFirst.Size = new System.Drawing.Size(80, 17); lblPhysicianFirst.TabIndex = 4; lblPhysicianFirst.Text = "First Name:"; // // lblPhysicianLast // lblPhysicianLast.AutoSize = true; - lblPhysicianLast.Location = new System.Drawing.Point(23, 70); + lblPhysicianLast.Location = new System.Drawing.Point(31, 86); + lblPhysicianLast.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); lblPhysicianLast.Name = "lblPhysicianLast"; - lblPhysicianLast.Size = new System.Drawing.Size(61, 13); + lblPhysicianLast.Size = new System.Drawing.Size(80, 17); lblPhysicianLast.TabIndex = 5; lblPhysicianLast.Text = "Last Name:"; // @@ -195,18 +199,20 @@ namespace Louis__Pharmacy_CNSA212_FP 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.Location = new System.Drawing.Point(16, 15); + this.tbcInfo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tbcInfo.Name = "tbcInfo"; this.tbcInfo.SelectedIndex = 0; - this.tbcInfo.Size = new System.Drawing.Size(741, 510); + this.tbcInfo.Size = new System.Drawing.Size(988, 628); this.tbcInfo.TabIndex = 999999; // // tbpPatient // this.tbpPatient.Controls.Add(this.splcPatient); - this.tbpPatient.Location = new System.Drawing.Point(4, 22); + this.tbpPatient.Location = new System.Drawing.Point(4, 25); + this.tbpPatient.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tbpPatient.Name = "tbpPatient"; - this.tbpPatient.Size = new System.Drawing.Size(733, 484); + this.tbpPatient.Size = new System.Drawing.Size(980, 599); this.tbpPatient.TabIndex = 3; this.tbpPatient.Text = "Patients"; this.tbpPatient.UseVisualStyleBackColor = true; @@ -215,6 +221,7 @@ namespace Louis__Pharmacy_CNSA212_FP // this.splcPatient.Dock = System.Windows.Forms.DockStyle.Fill; this.splcPatient.Location = new System.Drawing.Point(0, 0); + this.splcPatient.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.splcPatient.Name = "splcPatient"; this.splcPatient.Orientation = System.Windows.Forms.Orientation.Horizontal; // @@ -233,46 +240,52 @@ namespace Louis__Pharmacy_CNSA212_FP // this.splcPatient.Panel2.AutoScroll = true; this.splcPatient.Panel2.Controls.Add(this.dgvPatient); - this.splcPatient.Size = new System.Drawing.Size(733, 484); - this.splcPatient.SplitterDistance = 211; + this.splcPatient.Size = new System.Drawing.Size(980, 599); + this.splcPatient.SplitterDistance = 261; + this.splcPatient.SplitterWidth = 5; this.splcPatient.TabIndex = 0; // // txtPatientID // - this.txtPatientID.Location = new System.Drawing.Point(86, 109); + this.txtPatientID.Location = new System.Drawing.Point(115, 134); + this.txtPatientID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtPatientID.Name = "txtPatientID"; - this.txtPatientID.Size = new System.Drawing.Size(100, 20); + this.txtPatientID.Size = new System.Drawing.Size(132, 22); this.txtPatientID.TabIndex = 3; // // lblPatientID // this.lblPatientID.AutoSize = true; - this.lblPatientID.Location = new System.Drawing.Point(23, 109); + this.lblPatientID.Location = new System.Drawing.Point(31, 134); + this.lblPatientID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblPatientID.Name = "lblPatientID"; - this.lblPatientID.Size = new System.Drawing.Size(57, 13); + this.lblPatientID.Size = new System.Drawing.Size(73, 17); this.lblPatientID.TabIndex = 7; this.lblPatientID.Text = "Patient ID:"; // // txtPatientLast // - this.txtPatientLast.Location = new System.Drawing.Point(87, 66); + this.txtPatientLast.Location = new System.Drawing.Point(116, 81); + this.txtPatientLast.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtPatientLast.Name = "txtPatientLast"; - this.txtPatientLast.Size = new System.Drawing.Size(100, 20); + this.txtPatientLast.Size = new System.Drawing.Size(132, 22); this.txtPatientLast.TabIndex = 2; // // txtPatientFirst // - this.txtPatientFirst.Location = new System.Drawing.Point(86, 25); + this.txtPatientFirst.Location = new System.Drawing.Point(115, 31); + this.txtPatientFirst.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtPatientFirst.Name = "txtPatientFirst"; - this.txtPatientFirst.Size = new System.Drawing.Size(100, 20); + this.txtPatientFirst.Size = new System.Drawing.Size(132, 22); this.txtPatientFirst.TabIndex = 1; // // btnPatientSearch // this.btnPatientSearch.BackColor = System.Drawing.Color.Transparent; - this.btnPatientSearch.Location = new System.Drawing.Point(23, 150); + this.btnPatientSearch.Location = new System.Drawing.Point(31, 185); + this.btnPatientSearch.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnPatientSearch.Name = "btnPatientSearch"; - this.btnPatientSearch.Size = new System.Drawing.Size(75, 23); + this.btnPatientSearch.Size = new System.Drawing.Size(100, 28); this.btnPatientSearch.TabIndex = 4; this.btnPatientSearch.Text = "Search"; this.btnPatientSearch.UseVisualStyleBackColor = false; @@ -283,16 +296,32 @@ namespace Louis__Pharmacy_CNSA212_FP this.dgvPatient.AllowUserToAddRows = false; this.dgvPatient.AllowUserToDeleteRows = false; this.dgvPatient.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvPatient.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.pat_id, this.FirstName, this.LastName, this.MiddleInitials, this.City, this.UsState, this.Zip, this.Ibs, this.Height_feet, this.Height_inches, this.Ailment, this.DOB, this.PhoneNumber, this.Gender, this.Medications }); + this.dgvPatient.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.pat_id, + this.FirstName, + this.LastName, + this.MiddleInitials, + this.City, + this.UsState, + this.Zip, + this.Ibs, + this.Height_feet, + this.Height_inches, + this.Ailment, + this.DOB, + this.PhoneNumber, + this.Gender, + this.Medications}); this.dgvPatient.ContextMenuStrip = this.cmuPatient; this.dgvPatient.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgvPatient.Location = new System.Drawing.Point(0, 0); + this.dgvPatient.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dgvPatient.MultiSelect = false; this.dgvPatient.Name = "dgvPatient"; this.dgvPatient.ReadOnly = true; this.dgvPatient.RowHeadersWidth = 51; this.dgvPatient.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgvPatient.Size = new System.Drawing.Size(733, 267); + this.dgvPatient.Size = new System.Drawing.Size(977, 329); this.dgvPatient.TabIndex = 0; this.dgvPatient.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvPatient_CellContentClick); // @@ -437,37 +466,41 @@ namespace Louis__Pharmacy_CNSA212_FP // cmuPatient // this.cmuPatient.ImageScalingSize = new System.Drawing.Size(20, 20); - this.cmuPatient.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPatientNew, this.cmuPatientEdit, this.cmuPatientDelete }); + this.cmuPatient.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmuPatientNew, + this.cmuPatientEdit, + this.cmuPatientDelete}); this.cmuPatient.Name = "contextMenuStrip1"; - this.cmuPatient.Size = new System.Drawing.Size(108, 70); + this.cmuPatient.Size = new System.Drawing.Size(123, 76); // // cmuPatientNew // this.cmuPatientNew.Name = "cmuPatientNew"; - this.cmuPatientNew.Size = new System.Drawing.Size(107, 22); + this.cmuPatientNew.Size = new System.Drawing.Size(122, 24); this.cmuPatientNew.Text = "New"; this.cmuPatientNew.Click += new System.EventHandler(this.cmuPatientNew_Click); // // cmuPatientEdit // this.cmuPatientEdit.Name = "cmuPatientEdit"; - this.cmuPatientEdit.Size = new System.Drawing.Size(107, 22); + this.cmuPatientEdit.Size = new System.Drawing.Size(122, 24); this.cmuPatientEdit.Text = "Edit"; this.cmuPatientEdit.Click += new System.EventHandler(this.cmuPatientEdit_Click); // // cmuPatientDelete // this.cmuPatientDelete.Name = "cmuPatientDelete"; - this.cmuPatientDelete.Size = new System.Drawing.Size(107, 22); + this.cmuPatientDelete.Size = new System.Drawing.Size(122, 24); this.cmuPatientDelete.Text = "Delete"; this.cmuPatientDelete.Click += new System.EventHandler(this.cmuPatientDelete_Click); // // tbpMedication // this.tbpMedication.Controls.Add(this.splcPrescription); - this.tbpMedication.Location = new System.Drawing.Point(4, 22); + this.tbpMedication.Location = new System.Drawing.Point(4, 25); + this.tbpMedication.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tbpMedication.Name = "tbpMedication"; - this.tbpMedication.Size = new System.Drawing.Size(733, 484); + this.tbpMedication.Size = new System.Drawing.Size(980, 599); this.tbpMedication.TabIndex = 4; this.tbpMedication.Text = "Medications"; this.tbpMedication.UseVisualStyleBackColor = true; @@ -476,6 +509,7 @@ namespace Louis__Pharmacy_CNSA212_FP // this.splcPrescription.Dock = System.Windows.Forms.DockStyle.Fill; this.splcPrescription.Location = new System.Drawing.Point(0, 0); + this.splcPrescription.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.splcPrescription.Name = "splcPrescription"; this.splcPrescription.Orientation = System.Windows.Forms.Orientation.Horizontal; // @@ -490,50 +524,53 @@ namespace Louis__Pharmacy_CNSA212_FP // splcPrescription.Panel2 // this.splcPrescription.Panel2.Controls.Add(this.dgvPrescription); - this.splcPrescription.Size = new System.Drawing.Size(733, 484); - this.splcPrescription.SplitterDistance = 242; + this.splcPrescription.Size = new System.Drawing.Size(980, 599); + this.splcPrescription.SplitterDistance = 299; + this.splcPrescription.SplitterWidth = 5; this.splcPrescription.TabIndex = 0; // // btnMedicationSearch // - this.btnMedicationSearch.Location = new System.Drawing.Point(64, 117); + this.btnMedicationSearch.Location = new System.Drawing.Point(85, 144); + this.btnMedicationSearch.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnMedicationSearch.Name = "btnMedicationSearch"; - this.btnMedicationSearch.Size = new System.Drawing.Size(75, 23); + this.btnMedicationSearch.Size = new System.Drawing.Size(100, 28); this.btnMedicationSearch.TabIndex = 4; this.btnMedicationSearch.Text = "Search"; this.btnMedicationSearch.UseVisualStyleBackColor = true; - this.btnMedicationSearch.Click += new System.EventHandler(this.btnPrescriptionSearch_Click); // // txtPrescriptionPatID // - this.txtPrescriptionPatID.Location = new System.Drawing.Point(184, 74); + this.txtPrescriptionPatID.Location = new System.Drawing.Point(245, 91); + this.txtPrescriptionPatID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtPrescriptionPatID.Name = "txtPrescriptionPatID"; - this.txtPrescriptionPatID.Size = new System.Drawing.Size(100, 20); + this.txtPrescriptionPatID.Size = new System.Drawing.Size(132, 22); this.txtPrescriptionPatID.TabIndex = 3; // // txtRxNumber // - this.txtRxNumber.Location = new System.Drawing.Point(184, 51); + this.txtRxNumber.Location = new System.Drawing.Point(245, 63); + this.txtRxNumber.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtRxNumber.Name = "txtRxNumber"; - this.txtRxNumber.Size = new System.Drawing.Size(100, 20); + this.txtRxNumber.Size = new System.Drawing.Size(132, 22); this.txtRxNumber.TabIndex = 2; // // lblPrescriptionPatID // this.lblPrescriptionPatID.AutoSize = true; - this.lblPrescriptionPatID.Location = new System.Drawing.Point(61, 74); + this.lblPrescriptionPatID.Location = new System.Drawing.Point(81, 91); + this.lblPrescriptionPatID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblPrescriptionPatID.Name = "lblPrescriptionPatID"; - this.lblPrescriptionPatID.Size = new System.Drawing.Size(93, 13); + this.lblPrescriptionPatID.Size = new System.Drawing.Size(121, 17); this.lblPrescriptionPatID.TabIndex = 1; this.lblPrescriptionPatID.Text = "Medication Name:"; // // lblDisMedicationNum // this.lblDisMedicationNum.AutoSize = true; - this.lblDisMedicationNum.Location = new System.Drawing.Point(61, 51); - this.lblDisMedicationNum.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblDisMedicationNum.Location = new System.Drawing.Point(81, 63); this.lblDisMedicationNum.Name = "lblDisMedicationNum"; - this.lblDisMedicationNum.Size = new System.Drawing.Size(76, 13); + this.lblDisMedicationNum.Size = new System.Drawing.Size(97, 17); this.lblDisMedicationNum.TabIndex = 0; this.lblDisMedicationNum.Text = "Medication ID:"; this.lblDisMedicationNum.Click += new System.EventHandler(this.lblDisMedicationNum_Click); @@ -543,100 +580,126 @@ namespace Louis__Pharmacy_CNSA212_FP this.dgvPrescription.AllowUserToAddRows = false; 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.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.cmuMedication; - this.dgvPrescription.Location = new System.Drawing.Point(3, 3); + this.dgvPrescription.Location = new System.Drawing.Point(4, 4); + this.dgvPrescription.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dgvPrescription.Name = "dgvPrescription"; this.dgvPrescription.ReadOnly = true; this.dgvPrescription.RowHeadersWidth = 51; this.dgvPrescription.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgvPrescription.Size = new System.Drawing.Size(730, 237); + this.dgvPrescription.Size = new System.Drawing.Size(973, 292); this.dgvPrescription.TabIndex = 0; // // Medication_id // this.Medication_id.DataPropertyName = "Medication_id"; this.Medication_id.HeaderText = "Medication ID"; + this.Medication_id.MinimumWidth = 6; this.Medication_id.Name = "Medication_id"; this.Medication_id.ReadOnly = true; + this.Medication_id.Width = 125; // // MedicationName // this.MedicationName.DataPropertyName = "MedicationName"; this.MedicationName.HeaderText = "Name"; + this.MedicationName.MinimumWidth = 6; this.MedicationName.Name = "MedicationName"; this.MedicationName.ReadOnly = true; + this.MedicationName.Width = 125; // // IntakeMethod // this.IntakeMethod.DataPropertyName = "IntakeMethod"; this.IntakeMethod.HeaderText = "Intake Method"; + this.IntakeMethod.MinimumWidth = 6; this.IntakeMethod.Name = "IntakeMethod"; this.IntakeMethod.ReadOnly = true; + this.IntakeMethod.Width = 125; // // Frequency // this.Frequency.DataPropertyName = "Frequency"; this.Frequency.HeaderText = "Frequency"; + this.Frequency.MinimumWidth = 6; this.Frequency.Name = "Frequency"; this.Frequency.ReadOnly = true; + this.Frequency.Width = 125; // // Dosage // this.Dosage.DataPropertyName = "Dosage"; this.Dosage.HeaderText = "Dosage"; + this.Dosage.MinimumWidth = 6; this.Dosage.Name = "Dosage"; this.Dosage.ReadOnly = true; + this.Dosage.Width = 125; // // Purpose // this.Purpose.DataPropertyName = "Purpose"; this.Purpose.HeaderText = "Purpose"; + this.Purpose.MinimumWidth = 6; this.Purpose.Name = "Purpose"; this.Purpose.ReadOnly = true; + this.Purpose.Width = 125; // // RxNum // this.RxNum.DataPropertyName = "RxNum"; this.RxNum.HeaderText = "Rx Number"; + this.RxNum.MinimumWidth = 6; this.RxNum.Name = "RxNum"; this.RxNum.ReadOnly = true; + this.RxNum.Width = 125; // // cmuMedication // 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.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); + this.cmuMedication.Size = new System.Drawing.Size(123, 76); // // cmuMedicationNew // this.cmuMedicationNew.Name = "cmuMedicationNew"; - this.cmuMedicationNew.Size = new System.Drawing.Size(107, 22); + this.cmuMedicationNew.Size = new System.Drawing.Size(122, 24); this.cmuMedicationNew.Text = "New"; this.cmuMedicationNew.Click += new System.EventHandler(this.cmuRxNew_Click); // // cmuMedicationEdit // this.cmuMedicationEdit.Name = "cmuMedicationEdit"; - this.cmuMedicationEdit.Size = new System.Drawing.Size(107, 22); + this.cmuMedicationEdit.Size = new System.Drawing.Size(122, 24); this.cmuMedicationEdit.Text = "Edit"; this.cmuMedicationEdit.Click += new System.EventHandler(this.cmuRxEdit_Click); // // cmuMedicationDelete // this.cmuMedicationDelete.Name = "cmuMedicationDelete"; - this.cmuMedicationDelete.Size = new System.Drawing.Size(107, 22); + this.cmuMedicationDelete.Size = new System.Drawing.Size(122, 24); this.cmuMedicationDelete.Text = "Delete"; this.cmuMedicationDelete.Click += new System.EventHandler(this.cmuMedicationDelete_Click); // // tbpPhysician // this.tbpPhysician.Controls.Add(this.splcPhysician); - this.tbpPhysician.Location = new System.Drawing.Point(4, 22); + this.tbpPhysician.Location = new System.Drawing.Point(4, 25); + this.tbpPhysician.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tbpPhysician.Name = "tbpPhysician"; - this.tbpPhysician.Padding = new System.Windows.Forms.Padding(3); - this.tbpPhysician.Size = new System.Drawing.Size(733, 484); + this.tbpPhysician.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbpPhysician.Size = new System.Drawing.Size(980, 599); this.tbpPhysician.TabIndex = 2; this.tbpPhysician.Text = "Physicians"; this.tbpPhysician.UseVisualStyleBackColor = true; @@ -644,7 +707,8 @@ namespace Louis__Pharmacy_CNSA212_FP // splcPhysician // this.splcPhysician.Dock = System.Windows.Forms.DockStyle.Fill; - this.splcPhysician.Location = new System.Drawing.Point(3, 3); + this.splcPhysician.Location = new System.Drawing.Point(4, 4); + this.splcPhysician.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.splcPhysician.Name = "splcPhysician"; this.splcPhysician.Orientation = System.Windows.Forms.Orientation.Horizontal; // @@ -665,45 +729,51 @@ 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 = 195; + this.splcPhysician.Size = new System.Drawing.Size(972, 591); + this.splcPhysician.SplitterDistance = 241; + this.splcPhysician.SplitterWidth = 5; this.splcPhysician.TabIndex = 0; // // txtPhysicianID // - this.txtPhysicianID.Location = new System.Drawing.Point(99, 111); + this.txtPhysicianID.Location = new System.Drawing.Point(132, 137); + this.txtPhysicianID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtPhysicianID.Name = "txtPhysicianID"; - this.txtPhysicianID.Size = new System.Drawing.Size(100, 20); + this.txtPhysicianID.Size = new System.Drawing.Size(132, 22); this.txtPhysicianID.TabIndex = 3; // // lblPhysicianID // this.lblPhysicianID.AutoSize = true; - this.lblPhysicianID.Location = new System.Drawing.Point(24, 111); + this.lblPhysicianID.Location = new System.Drawing.Point(32, 137); + this.lblPhysicianID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblPhysicianID.Name = "lblPhysicianID"; - this.lblPhysicianID.Size = new System.Drawing.Size(69, 13); + this.lblPhysicianID.Size = new System.Drawing.Size(89, 17); this.lblPhysicianID.TabIndex = 7; this.lblPhysicianID.Text = "Physician ID:"; // // txtPhysicianLast // - this.txtPhysicianLast.Location = new System.Drawing.Point(99, 67); + this.txtPhysicianLast.Location = new System.Drawing.Point(132, 82); + this.txtPhysicianLast.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtPhysicianLast.Name = "txtPhysicianLast"; - this.txtPhysicianLast.Size = new System.Drawing.Size(100, 20); + this.txtPhysicianLast.Size = new System.Drawing.Size(132, 22); this.txtPhysicianLast.TabIndex = 2; // // txtPhysicianFirst // - this.txtPhysicianFirst.Location = new System.Drawing.Point(99, 23); + this.txtPhysicianFirst.Location = new System.Drawing.Point(132, 28); + this.txtPhysicianFirst.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtPhysicianFirst.Name = "txtPhysicianFirst"; - this.txtPhysicianFirst.Size = new System.Drawing.Size(100, 20); + this.txtPhysicianFirst.Size = new System.Drawing.Size(132, 22); this.txtPhysicianFirst.TabIndex = 1; // // btnPhysicianSearch // - this.btnPhysicianSearch.Location = new System.Drawing.Point(45, 146); + this.btnPhysicianSearch.Location = new System.Drawing.Point(60, 180); + this.btnPhysicianSearch.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnPhysicianSearch.Name = "btnPhysicianSearch"; - this.btnPhysicianSearch.Size = new System.Drawing.Size(75, 23); + this.btnPhysicianSearch.Size = new System.Drawing.Size(100, 28); this.btnPhysicianSearch.TabIndex = 4; this.btnPhysicianSearch.Text = "Search"; this.btnPhysicianSearch.UseVisualStyleBackColor = true; @@ -714,14 +784,26 @@ namespace Louis__Pharmacy_CNSA212_FP this.dgvPhysician.AllowUserToAddRows = false; this.dgvPhysician.AllowUserToDeleteRows = false; 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.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, 3); + this.dgvPhysician.Location = new System.Drawing.Point(0, 4); + this.dgvPhysician.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 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, 260); + this.dgvPhysician.Size = new System.Drawing.Size(969, 320); this.dgvPhysician.TabIndex = 0; this.dgvPhysician.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvPhysician_CellContentClick_1); // @@ -830,28 +912,31 @@ namespace Louis__Pharmacy_CNSA212_FP // cmuPhysician // this.cmuPhysician.ImageScalingSize = new System.Drawing.Size(20, 20); - this.cmuPhysician.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPhysicianNew, this.cmuPhysicianEdit, this.cmuPhysicianDelete }); + this.cmuPhysician.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmuPhysicianNew, + this.cmuPhysicianEdit, + this.cmuPhysicianDelete}); this.cmuPhysician.Name = "cmuPhysician"; - this.cmuPhysician.Size = new System.Drawing.Size(108, 70); + this.cmuPhysician.Size = new System.Drawing.Size(123, 76); // // cmuPhysicianNew // this.cmuPhysicianNew.Name = "cmuPhysicianNew"; - this.cmuPhysicianNew.Size = new System.Drawing.Size(107, 22); + this.cmuPhysicianNew.Size = new System.Drawing.Size(122, 24); this.cmuPhysicianNew.Text = "New"; this.cmuPhysicianNew.Click += new System.EventHandler(this.cmuPhysicianNew_Click); // // cmuPhysicianEdit // this.cmuPhysicianEdit.Name = "cmuPhysicianEdit"; - this.cmuPhysicianEdit.Size = new System.Drawing.Size(107, 22); + this.cmuPhysicianEdit.Size = new System.Drawing.Size(122, 24); this.cmuPhysicianEdit.Text = "Edit"; this.cmuPhysicianEdit.Click += new System.EventHandler(this.cmuPhysicianEdit_Click); // // cmuPhysicianDelete // this.cmuPhysicianDelete.Name = "cmuPhysicianDelete"; - this.cmuPhysicianDelete.Size = new System.Drawing.Size(107, 22); + this.cmuPhysicianDelete.Size = new System.Drawing.Size(122, 24); this.cmuPhysicianDelete.Text = "Delete"; this.cmuPhysicianDelete.Click += new System.EventHandler(this.cmuPhysicianDelete_Click); // @@ -867,83 +952,93 @@ namespace Louis__Pharmacy_CNSA212_FP 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.Location = new System.Drawing.Point(4, 25); + this.tbcInfoPrescriptions.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tbcInfoPrescriptions.Name = "tbcInfoPrescriptions"; - this.tbcInfoPrescriptions.Padding = new System.Windows.Forms.Padding(3); - this.tbcInfoPrescriptions.Size = new System.Drawing.Size(733, 484); + this.tbcInfoPrescriptions.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbcInfoPrescriptions.Size = new System.Drawing.Size(980, 599); this.tbcInfoPrescriptions.TabIndex = 5; this.tbcInfoPrescriptions.Text = "Prescriptions"; this.tbcInfoPrescriptions.UseVisualStyleBackColor = true; // // txtRxPatientID // - this.txtRxPatientID.Location = new System.Drawing.Point(138, 121); + this.txtRxPatientID.Location = new System.Drawing.Point(184, 149); + this.txtRxPatientID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtRxPatientID.Name = "txtRxPatientID"; - this.txtRxPatientID.Size = new System.Drawing.Size(124, 20); + this.txtRxPatientID.Size = new System.Drawing.Size(164, 22); this.txtRxPatientID.TabIndex = 9; // // txtRxMedicationID // - this.txtRxMedicationID.Location = new System.Drawing.Point(138, 98); + this.txtRxMedicationID.Location = new System.Drawing.Point(184, 121); + this.txtRxMedicationID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtRxMedicationID.Name = "txtRxMedicationID"; - this.txtRxMedicationID.Size = new System.Drawing.Size(124, 20); + this.txtRxMedicationID.Size = new System.Drawing.Size(164, 22); this.txtRxMedicationID.TabIndex = 8; // // txtRxPhysicianID // - this.txtRxPhysicianID.Location = new System.Drawing.Point(138, 75); + this.txtRxPhysicianID.Location = new System.Drawing.Point(184, 92); + this.txtRxPhysicianID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtRxPhysicianID.Name = "txtRxPhysicianID"; - this.txtRxPhysicianID.Size = new System.Drawing.Size(124, 20); + this.txtRxPhysicianID.Size = new System.Drawing.Size(164, 22); this.txtRxPhysicianID.TabIndex = 7; // // txtRxPrescriptionID // - this.txtRxPrescriptionID.Location = new System.Drawing.Point(138, 52); + this.txtRxPrescriptionID.Location = new System.Drawing.Point(184, 64); + this.txtRxPrescriptionID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtRxPrescriptionID.Name = "txtRxPrescriptionID"; - this.txtRxPrescriptionID.Size = new System.Drawing.Size(124, 20); + this.txtRxPrescriptionID.Size = new System.Drawing.Size(164, 22); this.txtRxPrescriptionID.TabIndex = 6; // // label4 // - this.label4.Location = new System.Drawing.Point(32, 73); + this.label4.Location = new System.Drawing.Point(43, 90); + this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(100, 23); + this.label4.Size = new System.Drawing.Size(133, 28); 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.Location = new System.Drawing.Point(43, 118); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(100, 23); + this.label3.Size = new System.Drawing.Size(133, 28); 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.Location = new System.Drawing.Point(43, 146); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(100, 23); + this.label2.Size = new System.Drawing.Size(133, 28); 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.Location = new System.Drawing.Point(43, 62); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(100, 23); + this.label1.Size = new System.Drawing.Size(133, 28); 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.Location = new System.Drawing.Point(43, 229); + this.btnRxSearch.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnRxSearch.Name = "btnRxSearch"; - this.btnRxSearch.Size = new System.Drawing.Size(75, 23); + this.btnRxSearch.Size = new System.Drawing.Size(100, 28); this.btnRxSearch.TabIndex = 1; this.btnRxSearch.Text = "Search"; this.btnRxSearch.UseVisualStyleBackColor = true; @@ -952,46 +1047,52 @@ namespace Louis__Pharmacy_CNSA212_FP // dgvRx // this.dgvRx.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvRx.Location = new System.Drawing.Point(0, 236); + this.dgvRx.Location = new System.Drawing.Point(0, 290); + this.dgvRx.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dgvRx.Name = "dgvRx"; + this.dgvRx.RowHeadersWidth = 51; this.dgvRx.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgvRx.Size = new System.Drawing.Size(730, 248); + this.dgvRx.Size = new System.Drawing.Size(973, 305); this.dgvRx.TabIndex = 0; // // cmuPrescription // - this.cmuPrescription.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPrescriptionNew, this.cmuPrescriptionEdit, this.cmuPrescriptionDelete }); + this.cmuPrescription.ImageScalingSize = new System.Drawing.Size(20, 20); + 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); + this.cmuPrescription.Size = new System.Drawing.Size(123, 76); // // cmuPrescriptionNew // this.cmuPrescriptionNew.Name = "cmuPrescriptionNew"; - this.cmuPrescriptionNew.Size = new System.Drawing.Size(107, 22); + this.cmuPrescriptionNew.Size = new System.Drawing.Size(122, 24); this.cmuPrescriptionNew.Text = "New"; // // cmuPrescriptionEdit // this.cmuPrescriptionEdit.Name = "cmuPrescriptionEdit"; - this.cmuPrescriptionEdit.Size = new System.Drawing.Size(107, 22); + this.cmuPrescriptionEdit.Size = new System.Drawing.Size(122, 24); 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.Size = new System.Drawing.Size(122, 24); this.cmuPrescriptionDelete.Text = "Delete"; this.cmuPrescriptionDelete.Click += new System.EventHandler(this.cmuPrescriptionDelete_Click); // // frmInfo // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(777, 575); + this.ClientSize = new System.Drawing.Size(1036, 708); this.Controls.Add(this.tbcInfo); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(2); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "frmInfo"; this.Text = "Louis\' Pharmacy - View Patient / Prescription Info"; this.Load += new System.EventHandler(this.frmInfo_Load); @@ -1025,6 +1126,7 @@ namespace Louis__Pharmacy_CNSA212_FP ((System.ComponentModel.ISupportInitialize)(this.dgvRx)).EndInit(); this.cmuPrescription.ResumeLayout(false); this.ResumeLayout(false); + } private System.Windows.Forms.TextBox txtRxPhysicianID; diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs index 60cbb3d..f98aa09 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs @@ -242,84 +242,86 @@ namespace Louis__Pharmacy_CNSA212_FP } - public void btnPrescriptionSearch_Click(object sender, EventArgs e) - { - string medID = ""; - string medicationName = ""; + //public void btnPrescriptionSearch_Click(object sender, EventArgs e) + //{ + // string medID = ""; + // string medicationName = ""; - if (txtPrescriptionPatID.Text.Length+txtRxNumber.Text.Length > 0) - { + // if (txtPrescriptionPatID.Text.Length+txtRxNumber.Text.Length > 0) + // { - try - { + // try + // { - medicationName = txtPrescriptionPatID.Text; + // medicationName = txtPrescriptionPatID.Text; - try - { + // try + // { - medID = txtRxNumber.Text; + // medID = txtRxNumber.Text; - try - { + // try + // { - ds = PharmacyDataTier.MedicationInfoSearch(medID,medicationName); + // ds = PharmacyDataTier.MedicationInfoSearch(medID,medicationName); - if (ds.Tables[0].Rows.Count > 0) // There is a record. - { - dgvPrescription.Visible = true; - // Get data source. - dgvPrescription.DataSource = ds.Tables[0]; - dgvPrescription.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen; + // if (ds.Tables[0].Rows.Count > 0) // There is a record. + // { + // dgvPrescription.Visible = true; + // // Get data source. + // dgvPrescription.DataSource = ds.Tables[0]; + // dgvPrescription.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen; - // Set the row and column header styles. - dgvPrescription.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; - dgvPrescription.ColumnHeadersDefaultCellStyle.BackColor = Color.Green; - } - else - { - dgvPatient.Visible = false; // Hide the DataGridView if no results are found. - MessageBox.Show("No records found."); - } + // // Set the row and column header styles. + // dgvPrescription.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; + // dgvPrescription.ColumnHeadersDefaultCellStyle.BackColor = Color.Green; + // } + // else + // { + // dgvPatient.Visible = false; // Hide the DataGridView if no results are found. + // MessageBox.Show("No records found."); + // } - } - catch (Exception exception) - { + // } + // catch (Exception exception) + // { - ep1.SetError(btnMedicationSearch, "Error Searching"); + // ep1.SetError(btnMedicationSearch, "Error Searching"); - } + // } - } - catch (Exception exception) - { + // } + // catch (Exception exception) + // { - ep1.SetError(txtRxNumber, "Invalid Value"); + // ep1.SetError(txtRxNumber, "Invalid Value"); - } + // } - } - catch (Exception exception) - { + // } + // catch (Exception exception) + // { - ep1.SetError(txtPrescriptionPatID, "Invalid Value"); + // ep1.SetError(txtPrescriptionPatID, "Invalid Value"); - } - } + // } + // } - cmuMedicationEdit.Enabled = dgvPrescription.Rows.Count > 0; - cmuMedicationDelete.Enabled = dgvPrescription.Rows.Count > 0; + // cmuMedicationEdit.Enabled = dgvPrescription.Rows.Count > 0; + // cmuMedicationDelete.Enabled = dgvPrescription.Rows.Count > 0; - dgvPrescription.Focus(); + // dgvPrescription.Focus(); + + //} + - } public void btnPhysicianSearch_Click(object sender, EventArgs e) { @@ -631,7 +633,77 @@ namespace Louis__Pharmacy_CNSA212_FP private void btnRxSearch_Click(object sender, EventArgs e) { - + string rxNum = ""; + string physID = ""; + string medID = ""; + string patID = ""; + + + if (txtPrescriptionPatID.Text.Length + txtRxNumber.Text.Length > 0) + { + + try + { + + medID = txtRxNum.Text; + + try + { + + + ds = PharmacyDataTier.MedicationInfoSearch(medID, medicationName); + + + if (ds.Tables[0].Rows.Count > 0) // There is a record. + { + dgvPrescription.Visible = true; + // Get data source. + dgvPrescription.DataSource = ds.Tables[0]; + dgvPrescription.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen; + + // Set the row and column header styles. + dgvPrescription.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; + dgvPrescription.ColumnHeadersDefaultCellStyle.BackColor = Color.Green; + } + else + { + dgvPatient.Visible = false; // Hide the DataGridView if no results are found. + MessageBox.Show("No records found."); + } + + + } + catch (Exception exception) + { + + ep1.SetError(btnMedicationSearch, "Error Searching"); + + } + + + } + catch (Exception exception) + { + + ep1.SetError(txtRxNumber, "Invalid Value"); + + } + + } + catch (Exception exception) + { + + ep1.SetError(txtPrescriptionPatID, "Invalid Value"); + + } + } + + + cmuMedicationEdit.Enabled = dgvPrescription.Rows.Count > 0; + cmuMedicationDelete.Enabled = dgvPrescription.Rows.Count > 0; + + dgvPrescription.Focus(); + } } } diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs index 4f35ee8..89fe9eb 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs @@ -51,12 +51,12 @@ namespace Louis__Pharmacy_CNSA212_FP if (e.KeyCode == Keys.Enter) btnGO_Click(sender, e); } - public void FillPrescription(string rxID) + public void FillPrescription(string rxID, string medID, string physID, string patID) { var ds = new DataSet(); var data = new PharmacyDataTier(); - ds = PharmacyDataTier.PrescriptionInfoSearch(rxID); + ds = PharmacyDataTier.PrescriptionInfoSearch(rxID,medID,physID,patID); txtRxNum.Text = ds.Tables[0].Rows[0]["RxNum"].ToString(); txtPatID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString(); txtMedID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString();