Revert "worked on search form"

This reverts commit 3dcef0eb3e.
This commit is contained in:
Adam McCane 2024-02-15 12:23:00 -05:00
parent 3dcef0eb3e
commit cbef2d4b74
5 changed files with 31 additions and 164 deletions

View File

@ -51,42 +51,6 @@ 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)
@ -166,48 +130,6 @@ 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();
}
}
}
}

View File

@ -265,12 +265,9 @@ 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;
//

View File

@ -25,10 +25,7 @@ namespace Louis__Pharmacy_CNSA212_FP
KeyPreview = true;
KeyDown += frmInfo_KeyDown;
cmuPatientEdit.Enabled = false;
cmuPatientDelete.Enabled = false;
}
private void frmInfo_KeyDown(object sender, KeyEventArgs e)
@ -137,10 +134,6 @@ namespace Louis__Pharmacy_CNSA212_FP
}
}
cmuPatientEdit.Enabled = dgvPatient.Rows.Count > 0;
cmuPatientDelete.Enabled = dgvPatient.Rows.Count > 0;
}
@ -220,7 +213,6 @@ namespace Louis__Pharmacy_CNSA212_FP
private void btnPhysicianSearch_Click(object sender, EventArgs e)
{
string fname = "";
string lname = "";
string phyID = "";;
@ -303,34 +295,25 @@ 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)
{
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());
}
frmPatientAdd PatientAdd = new frmPatientAdd(false);
PatientAdd.MdiParent = MdiParent;
PatientAdd.StartPosition = FormStartPosition.CenterScreen;
PatientAdd.Show();
PatientAdd.Focus();
}
}
}

View File

@ -58,7 +58,6 @@ 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
@ -184,91 +183,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 = 1;
this.txtPatientID.TabIndex = 13;
//
// 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 = 2;
this.txtFname.TabIndex = 14;
//
// 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 = 3;
this.txtLname.TabIndex = 15;
//
// 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 = 4;
this.txtMidInit.TabIndex = 16;
//
// 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 = 5;
this.txtWeight.TabIndex = 17;
//
// 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 = 6;
this.txtHeightFt.TabIndex = 18;
//
// 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 = 7;
this.txtHeightIn.TabIndex = 19;
//
// 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 = 8;
this.txtDOB.TabIndex = 20;
//
// 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 = 9;
this.txtGender.TabIndex = 21;
//
// 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 = 10;
this.txtCity.TabIndex = 22;
//
// 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 = 11;
this.txtZip.TabIndex = 23;
//
// 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 = 12;
this.txtState.TabIndex = 24;
//
// 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 = 13;
this.txtPhone.TabIndex = 25;
//
// lblDisPurpose
//
@ -280,21 +279,11 @@ 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);
@ -329,8 +318,6 @@ 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;

View File

@ -1,7 +1,5 @@
using System;
using System.Windows.Forms;
using System.Data;
namespace Louis__Pharmacy_CNSA212_FP
{
@ -16,12 +14,10 @@ namespace Louis__Pharmacy_CNSA212_FP
if (isNew)
{
lblDisPurpose.Text = "Add Patient";
btnGO.Text = "Create";
}
else
{
lblDisPurpose.Text = "Edit Patient";
btnGO.Text = "Update";
}
}
@ -39,38 +35,20 @@ namespace Louis__Pharmacy_CNSA212_FP
if (isAdd)
{
double nextID = PharmacyDataTier.GetNextPatientID();
txtPatientID.Text = nextID.ToString();
//Pull next Patient ID
}
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();
}
}
}