diff --git a/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs b/Louis'-Pharmacy_CNSA212-FP/PharmacyDataTier.cs index 8555b67..2c335c7 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();