worked on search form
This commit is contained in:
parent
cccdd96627
commit
3dcef0eb3e
@ -51,6 +51,42 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
myConn.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static DataSet PatientInfoSearch(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
// open connection
|
||||
myConn.Open();
|
||||
//clear any parameters
|
||||
cmdString.Parameters.Clear();
|
||||
// command
|
||||
cmdString.Connection = myConn;
|
||||
cmdString.CommandType = CommandType.StoredProcedure;
|
||||
cmdString.CommandTimeout = 1500;
|
||||
cmdString.CommandText = "PatientInfoSearch";
|
||||
// Define input parameter
|
||||
cmdString.Parameters.Add("@patientID", SqlDbType.VarChar, 6).Value = id;
|
||||
// adapter and dataset
|
||||
SqlDataAdapter aAdapter = new SqlDataAdapter();
|
||||
aAdapter.SelectCommand = cmdString;
|
||||
DataSet aDataSet = new DataSet();
|
||||
|
||||
// fill adapter
|
||||
aAdapter.Fill(aDataSet);
|
||||
|
||||
// return dataSet
|
||||
return aDataSet;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ArgumentException(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
myConn.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static DataSet PrescriptionInfoSearch(string rxID, string patientID)
|
||||
@ -130,6 +166,48 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
myConn.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static double GetNextPatientID()
|
||||
{
|
||||
try
|
||||
{
|
||||
// open connection
|
||||
myConn.Open();
|
||||
//clear any parameters
|
||||
cmdString.Parameters.Clear();
|
||||
// command
|
||||
cmdString.Connection = myConn;
|
||||
cmdString.CommandType = CommandType.StoredProcedure;
|
||||
cmdString.CommandTimeout = 1500;
|
||||
cmdString.CommandText = "GetNextPatientID";
|
||||
// Define input parameter
|
||||
cmdString.Parameters.Add("@TableName", SqlDbType.NVarChar, 128).Value = "PATIENT";
|
||||
|
||||
object result = cmdString.ExecuteScalar();
|
||||
double value = 0;
|
||||
try
|
||||
{
|
||||
value = Convert.ToDouble(result);
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show("Error Getting next Patient ID","ERROR",MessageBoxButtons.OK);
|
||||
}
|
||||
|
||||
|
||||
// return dataSet
|
||||
return value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ArgumentException(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
myConn.Close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
3
Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs
generated
3
Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs
generated
@ -265,9 +265,12 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
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.ContextMenuStrip = this.cmuPatient;
|
||||
this.dgvPatient.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgvPatient.Location = new System.Drawing.Point(3, 3);
|
||||
this.dgvPatient.MultiSelect = false;
|
||||
this.dgvPatient.Name = "dgvPatient";
|
||||
this.dgvPatient.ReadOnly = true;
|
||||
this.dgvPatient.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dgvPatient.Size = new System.Drawing.Size(652, 219);
|
||||
this.dgvPatient.TabIndex = 0;
|
||||
//
|
||||
|
@ -25,7 +25,10 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
|
||||
KeyPreview = true;
|
||||
KeyDown += frmInfo_KeyDown;
|
||||
|
||||
|
||||
cmuPatientEdit.Enabled = false;
|
||||
cmuPatientDelete.Enabled = false;
|
||||
|
||||
}
|
||||
|
||||
private void frmInfo_KeyDown(object sender, KeyEventArgs e)
|
||||
@ -134,6 +137,10 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
cmuPatientEdit.Enabled = dgvPatient.Rows.Count > 0;
|
||||
cmuPatientDelete.Enabled = dgvPatient.Rows.Count > 0;
|
||||
|
||||
|
||||
}
|
||||
@ -213,6 +220,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
|
||||
private void btnPhysicianSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
string fname = "";
|
||||
string lname = "";
|
||||
string phyID = "";;
|
||||
@ -295,25 +303,34 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void cmuPatientNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
frmPatientAdd PatientAdd = new frmPatientAdd(true);
|
||||
PatientAdd.MdiParent = MdiParent;
|
||||
PatientAdd.StartPosition = FormStartPosition.CenterScreen;
|
||||
PatientAdd.Show();
|
||||
PatientAdd.Focus();
|
||||
|
||||
frmPatientAdd PatientAdd = new frmPatientAdd(true);
|
||||
PatientAdd.MdiParent = MdiParent;
|
||||
PatientAdd.StartPosition = FormStartPosition.CenterScreen;
|
||||
PatientAdd.Show();
|
||||
PatientAdd.Focus();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void cmuPatientEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
frmPatientAdd PatientAdd = new frmPatientAdd(false);
|
||||
PatientAdd.MdiParent = MdiParent;
|
||||
PatientAdd.StartPosition = FormStartPosition.CenterScreen;
|
||||
PatientAdd.Show();
|
||||
PatientAdd.Focus();
|
||||
if (dgvPatient.Rows.Count > 0)
|
||||
{
|
||||
frmPatientAdd PatientAdd = new frmPatientAdd(false);
|
||||
PatientAdd.MdiParent = MdiParent;
|
||||
PatientAdd.StartPosition = FormStartPosition.CenterScreen;
|
||||
PatientAdd.Show();
|
||||
PatientAdd.Focus();
|
||||
Console.WriteLine( dgvPatient.SelectedRows.Count);
|
||||
DataGridViewRow row = dgvPatient.SelectedRows[1];
|
||||
PatientAdd.FillPatient(row.Cells[0].Value.ToString().Trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
39
Louis'-Pharmacy_CNSA212-FP/frmPatientAdd.Designer.cs
generated
39
Louis'-Pharmacy_CNSA212-FP/frmPatientAdd.Designer.cs
generated
@ -58,6 +58,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.txtState = new System.Windows.Forms.TextBox();
|
||||
this.txtPhone = new System.Windows.Forms.TextBox();
|
||||
this.lblDisPurpose = new System.Windows.Forms.Label();
|
||||
this.btnGO = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
@ -183,91 +184,91 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.txtPatientID.Location = new System.Drawing.Point(189, 74);
|
||||
this.txtPatientID.Name = "txtPatientID";
|
||||
this.txtPatientID.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtPatientID.TabIndex = 13;
|
||||
this.txtPatientID.TabIndex = 1;
|
||||
//
|
||||
// txtFname
|
||||
//
|
||||
this.txtFname.Location = new System.Drawing.Point(189, 97);
|
||||
this.txtFname.Name = "txtFname";
|
||||
this.txtFname.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtFname.TabIndex = 14;
|
||||
this.txtFname.TabIndex = 2;
|
||||
//
|
||||
// txtLname
|
||||
//
|
||||
this.txtLname.Location = new System.Drawing.Point(189, 120);
|
||||
this.txtLname.Name = "txtLname";
|
||||
this.txtLname.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtLname.TabIndex = 15;
|
||||
this.txtLname.TabIndex = 3;
|
||||
//
|
||||
// txtMidInit
|
||||
//
|
||||
this.txtMidInit.Location = new System.Drawing.Point(189, 143);
|
||||
this.txtMidInit.Name = "txtMidInit";
|
||||
this.txtMidInit.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtMidInit.TabIndex = 16;
|
||||
this.txtMidInit.TabIndex = 4;
|
||||
//
|
||||
// txtWeight
|
||||
//
|
||||
this.txtWeight.Location = new System.Drawing.Point(189, 166);
|
||||
this.txtWeight.Name = "txtWeight";
|
||||
this.txtWeight.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtWeight.TabIndex = 17;
|
||||
this.txtWeight.TabIndex = 5;
|
||||
//
|
||||
// txtHeightFt
|
||||
//
|
||||
this.txtHeightFt.Location = new System.Drawing.Point(189, 189);
|
||||
this.txtHeightFt.Name = "txtHeightFt";
|
||||
this.txtHeightFt.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtHeightFt.TabIndex = 18;
|
||||
this.txtHeightFt.TabIndex = 6;
|
||||
//
|
||||
// txtHeightIn
|
||||
//
|
||||
this.txtHeightIn.Location = new System.Drawing.Point(189, 212);
|
||||
this.txtHeightIn.Name = "txtHeightIn";
|
||||
this.txtHeightIn.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtHeightIn.TabIndex = 19;
|
||||
this.txtHeightIn.TabIndex = 7;
|
||||
//
|
||||
// txtDOB
|
||||
//
|
||||
this.txtDOB.Location = new System.Drawing.Point(189, 235);
|
||||
this.txtDOB.Name = "txtDOB";
|
||||
this.txtDOB.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtDOB.TabIndex = 20;
|
||||
this.txtDOB.TabIndex = 8;
|
||||
//
|
||||
// txtGender
|
||||
//
|
||||
this.txtGender.Location = new System.Drawing.Point(189, 258);
|
||||
this.txtGender.Name = "txtGender";
|
||||
this.txtGender.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtGender.TabIndex = 21;
|
||||
this.txtGender.TabIndex = 9;
|
||||
//
|
||||
// txtCity
|
||||
//
|
||||
this.txtCity.Location = new System.Drawing.Point(497, 74);
|
||||
this.txtCity.Name = "txtCity";
|
||||
this.txtCity.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtCity.TabIndex = 22;
|
||||
this.txtCity.TabIndex = 10;
|
||||
//
|
||||
// txtZip
|
||||
//
|
||||
this.txtZip.Location = new System.Drawing.Point(497, 97);
|
||||
this.txtZip.Name = "txtZip";
|
||||
this.txtZip.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtZip.TabIndex = 23;
|
||||
this.txtZip.TabIndex = 11;
|
||||
//
|
||||
// txtState
|
||||
//
|
||||
this.txtState.Location = new System.Drawing.Point(497, 120);
|
||||
this.txtState.Name = "txtState";
|
||||
this.txtState.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtState.TabIndex = 24;
|
||||
this.txtState.TabIndex = 12;
|
||||
//
|
||||
// txtPhone
|
||||
//
|
||||
this.txtPhone.Location = new System.Drawing.Point(497, 143);
|
||||
this.txtPhone.Name = "txtPhone";
|
||||
this.txtPhone.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtPhone.TabIndex = 25;
|
||||
this.txtPhone.TabIndex = 13;
|
||||
//
|
||||
// lblDisPurpose
|
||||
//
|
||||
@ -279,11 +280,21 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.lblDisPurpose.Text = "Patient";
|
||||
this.lblDisPurpose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// btnGO
|
||||
//
|
||||
this.btnGO.Location = new System.Drawing.Point(670, 389);
|
||||
this.btnGO.Name = "btnGO";
|
||||
this.btnGO.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnGO.TabIndex = 14;
|
||||
this.btnGO.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// frmPatientAdd
|
||||
//
|
||||
this.AcceptButton = this.btnGO;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.btnGO);
|
||||
this.Controls.Add(this.lblDisPurpose);
|
||||
this.Controls.Add(this.txtPhone);
|
||||
this.Controls.Add(this.txtState);
|
||||
@ -318,6 +329,8 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.PerformLayout();
|
||||
}
|
||||
|
||||
private System.Windows.Forms.Button btnGO;
|
||||
|
||||
private System.Windows.Forms.TextBox txtPatientID;
|
||||
private System.Windows.Forms.TextBox txtFname;
|
||||
private System.Windows.Forms.TextBox txtLname;
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Data;
|
||||
|
||||
|
||||
namespace Louis__Pharmacy_CNSA212_FP
|
||||
{
|
||||
@ -14,10 +16,12 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
if (isNew)
|
||||
{
|
||||
lblDisPurpose.Text = "Add Patient";
|
||||
btnGO.Text = "Create";
|
||||
}
|
||||
else
|
||||
{
|
||||
lblDisPurpose.Text = "Edit Patient";
|
||||
btnGO.Text = "Update";
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,20 +39,38 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
|
||||
if (isAdd)
|
||||
{
|
||||
|
||||
//Pull next Patient ID
|
||||
|
||||
double nextID = PharmacyDataTier.GetNextPatientID();
|
||||
txtPatientID.Text = nextID.ToString();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//Pull Current Info
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void FillPatient(string patID)
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
PharmacyDataTier data = new PharmacyDataTier();
|
||||
|
||||
ds = PharmacyDataTier.PatientInfoSearch(patID);
|
||||
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();
|
||||
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();
|
||||
txtDOB.Text = ds.Tables[0].Rows[0]["DOB"].ToString();
|
||||
txtGender.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
|
||||
txtCity.Text = ds.Tables[0].Rows[0]["City"].ToString();
|
||||
txtZip.Text = ds.Tables[0].Rows[0]["Zip"].ToString();
|
||||
txtState.Text = ds.Tables[0].Rows[0]["UsState"].ToString();
|
||||
txtPhone.Text = ds.Tables[0].Rows[0]["PhoneNumber"].ToString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user