diff --git a/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs b/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs index 31cb88a..28729aa 100644 --- a/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs +++ b/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs @@ -26,9 +26,9 @@ namespace Louis__Pharmacy_CNSA212_FP cmdString.Connection = myConn; cmdString.CommandType = CommandType.StoredProcedure; cmdString.CommandTimeout = 1500; - cmdString.CommandText = "PatientInfoSearch"; + cmdString.CommandText = "SearchPatients"; // Define input parameter - cmdString.Parameters.Add("@patientID", SqlDbType.VarChar, 6).Value = id; + cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 8).Value = id; cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 30).Value = lname; cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 30).Value = fname; // adapter and dataset @@ -64,9 +64,11 @@ namespace Louis__Pharmacy_CNSA212_FP cmdString.Connection = myConn; cmdString.CommandType = CommandType.StoredProcedure; cmdString.CommandTimeout = 1500; - cmdString.CommandText = "PatientInfoSearch"; + cmdString.CommandText = "SearchPatients"; // Define input parameter - cmdString.Parameters.Add("@patientID", SqlDbType.VarChar, 6).Value = id; + cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 8).Value = id; + cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 30).Value = ""; + cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 30).Value = ""; // adapter and dataset SqlDataAdapter aAdapter = new SqlDataAdapter(); aAdapter.SelectCommand = cmdString; diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs index 5c94ab7..c85db90 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs @@ -214,7 +214,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.splcPatient.Panel2.AutoScroll = true; this.splcPatient.Panel2.Controls.Add(this.dgvPatient); this.splcPatient.Size = new System.Drawing.Size(658, 415); - this.splcPatient.SplitterDistance = 185; + this.splcPatient.SplitterDistance = 184; this.splcPatient.TabIndex = 0; // // txtPatientID @@ -262,42 +262,25 @@ namespace Louis__Pharmacy_CNSA212_FP // this.dgvPatient.AllowUserToAddRows = false; this.dgvPatient.AllowUserToDeleteRows = false; - this.dgvPatient.AllowUserToOrderColumns = true; 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.Dock = System.Windows.Forms.DockStyle.Fill; this.dgvPatient.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.dgvPatient.Location = new System.Drawing.Point(3, 3); + this.dgvPatient.Location = new System.Drawing.Point(0, 0); 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(652, 219); + this.dgvPatient.Size = new System.Drawing.Size(658, 227); this.dgvPatient.TabIndex = 0; this.dgvPatient.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvPatient_CellContentClick); // // 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); // @@ -401,14 +384,7 @@ 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.RxNum_id, - this.numRefills, - this.pastNumRefills, - this.PrescribedBy, - this.Physician_id, - this.Medication_id, - this.Patient_id}); + this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.RxNum_id, this.numRefills, this.pastNumRefills, this.PrescribedBy, this.Physician_id, this.Medication_id, this.Patient_id }); this.dgvPrescription.ContextMenuStrip = this.cmuRx; this.dgvPrescription.Location = new System.Drawing.Point(3, 3); this.dgvPrescription.Name = "dgvPrescription"; @@ -475,10 +451,7 @@ namespace Louis__Pharmacy_CNSA212_FP // cmuRx // 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.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); // @@ -505,7 +478,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.tbpPhysician.Controls.Add(this.splcPhysician); this.tbpPhysician.Location = new System.Drawing.Point(4, 22); this.tbpPhysician.Name = "tbpPhysician"; - this.tbpPhysician.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); + this.tbpPhysician.Padding = new System.Windows.Forms.Padding(3); this.tbpPhysician.Size = new System.Drawing.Size(658, 415); this.tbpPhysician.TabIndex = 2; this.tbpPhysician.Text = "Physician Info"; @@ -583,18 +556,7 @@ 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(3, 3); this.dgvPhysician.Name = "dgvPhysician"; @@ -708,10 +670,7 @@ 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); // @@ -739,6 +698,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.pat_id.HeaderText = "Patient ID"; this.pat_id.MinimumWidth = 6; this.pat_id.Name = "pat_id"; + this.pat_id.ReadOnly = true; this.pat_id.Width = 125; // // FirstName @@ -747,6 +707,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.FirstName.HeaderText = "First Name"; this.FirstName.MinimumWidth = 6; this.FirstName.Name = "FirstName"; + this.FirstName.ReadOnly = true; this.FirstName.Width = 125; // // LastName @@ -755,6 +716,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.LastName.HeaderText = "Last Name"; this.LastName.MinimumWidth = 6; this.LastName.Name = "LastName"; + this.LastName.ReadOnly = true; this.LastName.Width = 125; // // MiddleInitials @@ -763,6 +725,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.MiddleInitials.HeaderText = "Middle Initial"; this.MiddleInitials.MinimumWidth = 6; this.MiddleInitials.Name = "MiddleInitials"; + this.MiddleInitials.ReadOnly = true; this.MiddleInitials.Width = 125; // // City @@ -771,6 +734,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.City.HeaderText = "City"; this.City.MinimumWidth = 6; this.City.Name = "City"; + this.City.ReadOnly = true; this.City.Width = 125; // // UsState @@ -779,6 +743,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.UsState.HeaderText = "State"; this.UsState.MinimumWidth = 6; this.UsState.Name = "UsState"; + this.UsState.ReadOnly = true; this.UsState.Width = 125; // // Zip @@ -787,6 +752,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.Zip.HeaderText = "Zip"; this.Zip.MinimumWidth = 6; this.Zip.Name = "Zip"; + this.Zip.ReadOnly = true; this.Zip.Width = 125; // // Ibs @@ -795,6 +761,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.Ibs.HeaderText = "Weight"; this.Ibs.MinimumWidth = 6; this.Ibs.Name = "Ibs"; + this.Ibs.ReadOnly = true; this.Ibs.Width = 125; // // Height_feet @@ -803,6 +770,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.Height_feet.HeaderText = "Height (Feet)"; this.Height_feet.MinimumWidth = 6; this.Height_feet.Name = "Height_feet"; + this.Height_feet.ReadOnly = true; this.Height_feet.Width = 125; // // Height_inches @@ -811,6 +779,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.Height_inches.HeaderText = "Height (inches)"; this.Height_inches.MinimumWidth = 6; this.Height_inches.Name = "Height_inches"; + this.Height_inches.ReadOnly = true; this.Height_inches.Width = 125; // // Ailment @@ -819,6 +788,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.Ailment.HeaderText = "Ailment"; this.Ailment.MinimumWidth = 6; this.Ailment.Name = "Ailment"; + this.Ailment.ReadOnly = true; this.Ailment.Width = 125; // // DOB @@ -830,6 +800,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.DOB.HeaderText = "DOB"; this.DOB.MinimumWidth = 6; this.DOB.Name = "DOB"; + this.DOB.ReadOnly = true; this.DOB.Width = 125; // // PhoneNumber @@ -838,6 +809,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.PhoneNumber.HeaderText = "Phone Number"; this.PhoneNumber.MinimumWidth = 6; this.PhoneNumber.Name = "PhoneNumber"; + this.PhoneNumber.ReadOnly = true; this.PhoneNumber.Width = 125; // // Gender @@ -846,6 +818,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.Gender.HeaderText = "Gender"; this.Gender.MinimumWidth = 6; this.Gender.Name = "Gender"; + this.Gender.ReadOnly = true; this.Gender.Width = 125; // // Medications @@ -854,6 +827,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.Medications.HeaderText = "Medications"; this.Medications.MinimumWidth = 6; this.Medications.Name = "Medications"; + this.Medications.ReadOnly = true; this.Medications.Width = 125; // // frmInfo @@ -863,7 +837,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.ClientSize = new System.Drawing.Size(737, 465); this.Controls.Add(this.tbcInfo); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "frmInfo"; this.Text = "Louis\' Pharmacy - View Patient / Prescription Info"; this.Load += new System.EventHandler(this.frmInfo_Load); @@ -893,7 +867,6 @@ namespace Louis__Pharmacy_CNSA212_FP ((System.ComponentModel.ISupportInitialize)(this.dgvPhysician)).EndInit(); this.cmuPhysician.ResumeLayout(false); this.ResumeLayout(false); - } private System.Windows.Forms.ContextMenuStrip cmuPatient; @@ -932,6 +905,21 @@ namespace Louis__Pharmacy_CNSA212_FP private System.Windows.Forms.TextBox txtPhysicianFirst; private System.Windows.Forms.DataGridView dgvPhysician; private System.Windows.Forms.DataGridView dgvPrescription; + private System.Windows.Forms.DataGridViewTextBoxColumn pat_id; + private System.Windows.Forms.DataGridViewTextBoxColumn FirstName; + private System.Windows.Forms.DataGridViewTextBoxColumn LastName; + private System.Windows.Forms.DataGridViewTextBoxColumn MiddleInitials; + private System.Windows.Forms.DataGridViewTextBoxColumn City; + private System.Windows.Forms.DataGridViewTextBoxColumn UsState; + private System.Windows.Forms.DataGridViewTextBoxColumn Zip; + private System.Windows.Forms.DataGridViewTextBoxColumn Ibs; + private System.Windows.Forms.DataGridViewTextBoxColumn Height_feet; + private System.Windows.Forms.DataGridViewTextBoxColumn Height_inches; + private System.Windows.Forms.DataGridViewTextBoxColumn Ailment; + private System.Windows.Forms.DataGridViewTextBoxColumn DOB; + private System.Windows.Forms.DataGridViewTextBoxColumn PhoneNumber; + private System.Windows.Forms.DataGridViewTextBoxColumn Gender; + private System.Windows.Forms.DataGridViewTextBoxColumn Medications; private System.Windows.Forms.DataGridViewTextBoxColumn RxNum_id; private System.Windows.Forms.DataGridViewTextBoxColumn numRefills; private System.Windows.Forms.DataGridViewTextBoxColumn pastNumRefills; @@ -954,20 +942,5 @@ namespace Louis__Pharmacy_CNSA212_FP private System.Windows.Forms.Label lblPhysicianID; private System.Windows.Forms.TextBox txtPatientID; private System.Windows.Forms.Label lblPatientID; - private System.Windows.Forms.DataGridViewTextBoxColumn pat_id; - private System.Windows.Forms.DataGridViewTextBoxColumn FirstName; - private System.Windows.Forms.DataGridViewTextBoxColumn LastName; - private System.Windows.Forms.DataGridViewTextBoxColumn MiddleInitials; - private System.Windows.Forms.DataGridViewTextBoxColumn City; - private System.Windows.Forms.DataGridViewTextBoxColumn UsState; - private System.Windows.Forms.DataGridViewTextBoxColumn Zip; - private System.Windows.Forms.DataGridViewTextBoxColumn Ibs; - private System.Windows.Forms.DataGridViewTextBoxColumn Height_feet; - private System.Windows.Forms.DataGridViewTextBoxColumn Height_inches; - private System.Windows.Forms.DataGridViewTextBoxColumn Ailment; - private System.Windows.Forms.DataGridViewTextBoxColumn DOB; - private System.Windows.Forms.DataGridViewTextBoxColumn PhoneNumber; - private System.Windows.Forms.DataGridViewTextBoxColumn Gender; - private System.Windows.Forms.DataGridViewTextBoxColumn Medications; } } \ No newline at end of file diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs index 2637339..c4ee6d1 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs @@ -13,8 +13,11 @@ namespace Louis__Pharmacy_CNSA212_FP { public partial class frmInfo : Form { + private ErrorProvider ep1 = new ErrorProvider(); + public DataSet ds = new DataSet(); + public frmInfo() { InitializeComponent(); @@ -60,7 +63,7 @@ namespace Louis__Pharmacy_CNSA212_FP string lname = ""; string id = ""; - DataSet ds = new DataSet(); + if (txtPatientFirst.Text.Length + txtPatientLast.Text.Length + txtPatientID.Text.Length > 0) { @@ -150,7 +153,6 @@ namespace Louis__Pharmacy_CNSA212_FP string rxID = ""; string patientID = ""; - DataSet ds = new DataSet(); if (txtPrescriptionPatID.Text.Length+txtRxNumber.Text.Length > 0) { @@ -225,7 +227,6 @@ namespace Louis__Pharmacy_CNSA212_FP string lname = ""; string phyID = "";; - DataSet ds = new DataSet(); if (txtPhysicianFirst.Text.Length+txtPhysicianLast.Text.Length+txtPhysicianID.Text.Length > 0) { @@ -320,13 +321,15 @@ namespace Louis__Pharmacy_CNSA212_FP private void cmuPatientEdit_Click(object sender, EventArgs e) { - string patid = ""; - if (dgvPatient.Rows.Count > 0) { + + dgvPatient.DataSource = ds.Tables[0]; // Console.WriteLine( dgvPatient.SelectedRows.Count); - DataGridViewRow row = dgvPatient.SelectedRows[0]; - patid = (row.Cells[0].Value).ToString(); + DataGridViewRow row = new DataGridViewRow(); + row = dgvPatient.SelectedRows[0]; + string patid = ""; + patid = (row.Cells[4].Value).ToString(); frmPatientAdd PatientAdd = new frmPatientAdd(false); PatientAdd.MdiParent = MdiParent; PatientAdd.StartPosition = FormStartPosition.CenterScreen; diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPatientAdd.cs b/Louis'-Pharmacy_CNSA212-FP/frmPatientAdd.cs index 7ec95db..d49b1ee 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmPatientAdd.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmPatientAdd.cs @@ -59,7 +59,7 @@ namespace Louis__Pharmacy_CNSA212_FP txtPatientID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString(); txtFname.Text = ds.Tables[0].Rows[0]["FirstName"].ToString(); txtLname.Text = ds.Tables[0].Rows[0]["LastName"].ToString(); - txtMidInit.Text = ds.Tables[0].Rows[0]["MiddleInitals"].ToString(); + txtMidInit.Text = ds.Tables[0].Rows[0]["MiddleIntials"].ToString(); txtWeight.Text = ds.Tables[0].Rows[0]["lbs"].ToString(); txtHeightFt.Text = ds.Tables[0].Rows[0]["Height_feet"].ToString(); txtHeightIn.Text = ds.Tables[0].Rows[0]["Height_inches"].ToString(); diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.Designer.cs index 1d6cbd8..a27b0bd 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.Designer.cs @@ -38,21 +38,31 @@ namespace Louis__Pharmacy_CNSA212_FP this.lblLastName = new System.Windows.Forms.Label(); this.lblRxNumber = new System.Windows.Forms.Label(); this.lblFirstName = new System.Windows.Forms.Label(); - this.txtRxNumber = new System.Windows.Forms.TextBox(); - this.txtLastName = new System.Windows.Forms.TextBox(); - this.txtFirstName = new System.Windows.Forms.TextBox(); + this.txtPatientRx = new System.Windows.Forms.TextBox(); + this.txtPatientLast = new System.Windows.Forms.TextBox(); + this.txtPatientFirst = new System.Windows.Forms.TextBox(); + this.ep1 = new System.Windows.Forms.ErrorProvider(this.components); + this.cmuPrescriptionEdit = new System.Windows.Forms.ToolStripMenuItem(); + this.cmuPrescriptionDelete = new System.Windows.Forms.ToolStripMenuItem(); + this.cmuPrescriptionAdd = new System.Windows.Forms.ToolStripMenuItem(); + this.contextMenuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvPrescriptions)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ep1)).BeginInit(); this.SuspendLayout(); // // contextMenuStrip1 // this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmuPrescriptionAdd, + this.cmuPrescriptionEdit, + this.cmuPrescriptionDelete}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); + this.contextMenuStrip1.Size = new System.Drawing.Size(123, 76); // // dgvPrescriptions // @@ -76,9 +86,9 @@ namespace Louis__Pharmacy_CNSA212_FP this.splitContainer1.Panel1.Controls.Add(this.lblLastName); this.splitContainer1.Panel1.Controls.Add(this.lblRxNumber); this.splitContainer1.Panel1.Controls.Add(this.lblFirstName); - this.splitContainer1.Panel1.Controls.Add(this.txtRxNumber); - this.splitContainer1.Panel1.Controls.Add(this.txtLastName); - this.splitContainer1.Panel1.Controls.Add(this.txtFirstName); + this.splitContainer1.Panel1.Controls.Add(this.txtPatientRx); + this.splitContainer1.Panel1.Controls.Add(this.txtPatientLast); + this.splitContainer1.Panel1.Controls.Add(this.txtPatientFirst); // // splitContainer1.Panel2 // @@ -123,26 +133,48 @@ namespace Louis__Pharmacy_CNSA212_FP this.lblFirstName.Text = "First Name:"; this.lblFirstName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // txtRxNumber + // txtPatientRx // - this.txtRxNumber.Location = new System.Drawing.Point(122, 154); - this.txtRxNumber.Name = "txtRxNumber"; - this.txtRxNumber.Size = new System.Drawing.Size(148, 22); - this.txtRxNumber.TabIndex = 2; + this.txtPatientRx.Location = new System.Drawing.Point(122, 154); + this.txtPatientRx.Name = "txtPatientRx"; + this.txtPatientRx.Size = new System.Drawing.Size(148, 22); + this.txtPatientRx.TabIndex = 2; // - // txtLastName + // txtPatientLast // - this.txtLastName.Location = new System.Drawing.Point(122, 101); - this.txtLastName.Name = "txtLastName"; - this.txtLastName.Size = new System.Drawing.Size(148, 22); - this.txtLastName.TabIndex = 1; + this.txtPatientLast.Location = new System.Drawing.Point(122, 101); + this.txtPatientLast.Name = "txtPatientLast"; + this.txtPatientLast.Size = new System.Drawing.Size(148, 22); + this.txtPatientLast.TabIndex = 1; // - // txtFirstName + // txtPatientFirst // - this.txtFirstName.Location = new System.Drawing.Point(122, 56); - this.txtFirstName.Name = "txtFirstName"; - this.txtFirstName.Size = new System.Drawing.Size(148, 22); - this.txtFirstName.TabIndex = 0; + this.txtPatientFirst.Location = new System.Drawing.Point(122, 56); + this.txtPatientFirst.Name = "txtPatientFirst"; + this.txtPatientFirst.Size = new System.Drawing.Size(148, 22); + this.txtPatientFirst.TabIndex = 0; + // + // ep1 + // + this.ep1.ContainerControl = this; + // + // cmuPrescriptionEdit + // + this.cmuPrescriptionEdit.Name = "cmuPrescriptionEdit"; + this.cmuPrescriptionEdit.Size = new System.Drawing.Size(122, 24); + this.cmuPrescriptionEdit.Text = "Edit"; + // + // cmuPrescriptionDelete + // + this.cmuPrescriptionDelete.Name = "cmuPrescriptionDelete"; + this.cmuPrescriptionDelete.Size = new System.Drawing.Size(122, 24); + this.cmuPrescriptionDelete.Text = "Delete"; + // + // cmuPrescriptionAdd + // + this.cmuPrescriptionAdd.Name = "cmuPrescriptionAdd"; + this.cmuPrescriptionAdd.Size = new System.Drawing.Size(122, 24); + this.cmuPrescriptionAdd.Text = "Add"; // // frmPrescription // @@ -154,12 +186,14 @@ namespace Louis__Pharmacy_CNSA212_FP this.Name = "frmPrescription"; this.Text = "Louis\' Pharmacy - Add / Update Prescription"; this.Load += new System.EventHandler(this.frmPrescription_Load); + this.contextMenuStrip1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dgvPrescriptions)).EndInit(); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.PerformLayout(); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.ep1)).EndInit(); this.ResumeLayout(false); } @@ -168,12 +202,16 @@ namespace Louis__Pharmacy_CNSA212_FP private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.DataGridView dgvPrescriptions; private System.Windows.Forms.SplitContainer splitContainer1; - private System.Windows.Forms.TextBox txtFirstName; - private System.Windows.Forms.TextBox txtRxNumber; - private System.Windows.Forms.TextBox txtLastName; + private System.Windows.Forms.TextBox txtPatientFirst; + private System.Windows.Forms.TextBox txtPatientRx; + private System.Windows.Forms.TextBox txtPatientLast; private System.Windows.Forms.Label lblFirstName; private System.Windows.Forms.Label lblLastName; private System.Windows.Forms.Label lblRxNumber; private System.Windows.Forms.Button btnSearch; + private System.Windows.Forms.ErrorProvider ep1; + private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionEdit; + private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionDelete; + private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionAdd; } } \ No newline at end of file diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs index 1e781d1..9c56b0f 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs @@ -19,6 +19,92 @@ namespace Louis__Pharmacy_CNSA212_FP private void btnPatientSearch_Click(object sender, EventArgs e) { + string fname = ""; + string lname = ""; + string id = ""; + + DataSet ds = new DataSet(); + + if (txtPatientFirst.Text.Length + txtPatientLast.Text.Length + txtPatientRx.Text.Length > 0) + { + + try + { + + fname = txtPatientFirst.Text; + + try + { + + lname = txtPatientLast.Text; + + try + { + + id = txtPatientRx.Text; + + try + { + + + ds = PharmacyDataTier.PatientInfoSearch(id, lname, fname); + + + if (ds.Tables[0].Rows.Count > 0) // There is a record. + { + dgvPrescriptions.Visible = true; + // Get data source. + dgvPrescriptions.DataSource = ds.Tables[0]; + dgvPrescriptions.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen; + + // Set the row and column header styles. + dgvPrescriptions.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; + dgvPrescriptions.ColumnHeadersDefaultCellStyle.BackColor = Color.Green; + } + else + { + dgvPrescriptions.Visible = false; // Hide the DataGridView if no results are found. + MessageBox.Show("No records found."); + } + + + } + catch (Exception exception) + { + + ep1.SetError(btnSearch, "Error Searching"); + + } + + + } + catch (Exception exception) + { + + ep1.SetError(txtPatientRx, "Invalid Value"); + + } + + } + catch (Exception exception) + { + + ep1.SetError(txtPatientLast, "Invalid Value"); + + } + + } + catch (Exception exception) + { + ep1.SetError(txtPatientFirst, "Invalid Value"); + } + + } + + + cmuPrescriptionEdit.Enabled = dgvPrescriptions.Rows.Count > 0; + cmuPrescriptionDelete.Enabled = dgvPrescriptions.Rows.Count > 0; + } @@ -56,5 +142,10 @@ namespace Louis__Pharmacy_CNSA212_FP } } + + private void addToolStripMenuItem_Click(object sender, EventArgs e) + { + + } } } diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.resx b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.resx index 4930298..3fe9862 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.resx +++ b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.resx @@ -120,6 +120,9 @@ 17, 17 + + 242, 16 + 65