search work

This commit is contained in:
EggMan20339 2024-02-16 11:32:00 -05:00
parent 22bb09981a
commit 28286960c5
4 changed files with 478 additions and 544 deletions

View File

@ -26,9 +26,9 @@ namespace Louis__Pharmacy_CNSA212_FP
cmdString.Connection = myConn; cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure; cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500; cmdString.CommandTimeout = 1500;
cmdString.CommandText = "PatientInfoSearch"; cmdString.CommandText = "SearchPatients";
// Define input parameter // 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("@lname", SqlDbType.VarChar, 30).Value = lname;
cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 30).Value = fname; cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 30).Value = fname;
// adapter and dataset // adapter and dataset
@ -64,9 +64,11 @@ namespace Louis__Pharmacy_CNSA212_FP
cmdString.Connection = myConn; cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure; cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500; cmdString.CommandTimeout = 1500;
cmdString.CommandText = "PatientInfoSearch"; cmdString.CommandText = "SearchPatients";
// Define input parameter // 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 // adapter and dataset
SqlDataAdapter aAdapter = new SqlDataAdapter(); SqlDataAdapter aAdapter = new SqlDataAdapter();
aAdapter.SelectCommand = cmdString; aAdapter.SelectCommand = cmdString;

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,11 @@ namespace Louis__Pharmacy_CNSA212_FP
{ {
public partial class frmInfo : Form public partial class frmInfo : Form
{ {
private ErrorProvider ep1 = new ErrorProvider(); private ErrorProvider ep1 = new ErrorProvider();
public DataSet ds = new DataSet();
public frmInfo() public frmInfo()
{ {
InitializeComponent(); InitializeComponent();
@ -60,7 +63,7 @@ namespace Louis__Pharmacy_CNSA212_FP
string lname = ""; string lname = "";
string id = ""; string id = "";
DataSet ds = new DataSet();
if (txtPatientFirst.Text.Length + txtPatientLast.Text.Length + txtPatientID.Text.Length > 0) if (txtPatientFirst.Text.Length + txtPatientLast.Text.Length + txtPatientID.Text.Length > 0)
{ {
@ -150,7 +153,6 @@ namespace Louis__Pharmacy_CNSA212_FP
string rxID = ""; string rxID = "";
string patientID = ""; string patientID = "";
DataSet ds = new DataSet();
if (txtPrescriptionPatID.Text.Length+txtRxNumber.Text.Length > 0) if (txtPrescriptionPatID.Text.Length+txtRxNumber.Text.Length > 0)
{ {
@ -225,7 +227,6 @@ namespace Louis__Pharmacy_CNSA212_FP
string lname = ""; string lname = "";
string phyID = "";; string phyID = "";;
DataSet ds = new DataSet();
if (txtPhysicianFirst.Text.Length+txtPhysicianLast.Text.Length+txtPhysicianID.Text.Length > 0) if (txtPhysicianFirst.Text.Length+txtPhysicianLast.Text.Length+txtPhysicianID.Text.Length > 0)
{ {
@ -322,10 +323,13 @@ namespace Louis__Pharmacy_CNSA212_FP
{ {
if (dgvPatient.Rows.Count > 0) if (dgvPatient.Rows.Count > 0)
{ {
dgvPatient.DataSource = ds.Tables[0];
// Console.WriteLine( dgvPatient.SelectedRows.Count); // Console.WriteLine( dgvPatient.SelectedRows.Count);
DataGridViewRow row = dgvPatient.SelectedRows[0]; DataGridViewRow row = new DataGridViewRow();
row = dgvPatient.SelectedRows[0];
string patid = ""; string patid = "";
patid = (row.Cells[0].Value).ToString(); patid = (row.Cells[4].Value).ToString();
frmPatientAdd PatientAdd = new frmPatientAdd(false); frmPatientAdd PatientAdd = new frmPatientAdd(false);
PatientAdd.MdiParent = MdiParent; PatientAdd.MdiParent = MdiParent;
PatientAdd.StartPosition = FormStartPosition.CenterScreen; PatientAdd.StartPosition = FormStartPosition.CenterScreen;

View File

@ -59,7 +59,7 @@ namespace Louis__Pharmacy_CNSA212_FP
txtPatientID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString(); txtPatientID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString();
txtFname.Text = ds.Tables[0].Rows[0]["FirstName"].ToString(); txtFname.Text = ds.Tables[0].Rows[0]["FirstName"].ToString();
txtLname.Text = ds.Tables[0].Rows[0]["LastName"].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(); txtWeight.Text = ds.Tables[0].Rows[0]["lbs"].ToString();
txtHeightFt.Text = ds.Tables[0].Rows[0]["Height_feet"].ToString(); txtHeightFt.Text = ds.Tables[0].Rows[0]["Height_feet"].ToString();
txtHeightIn.Text = ds.Tables[0].Rows[0]["Height_inches"].ToString(); txtHeightIn.Text = ds.Tables[0].Rows[0]["Height_inches"].ToString();