Made Patient Search funtional
This commit is contained in:
parent
d257715541
commit
f6c2540b76
@ -13,7 +13,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
static SqlConnection myConn = new SqlConnection(connString);
|
||||
static System.Data.SqlClient.SqlCommand cmdString = new System.Data.SqlClient.SqlCommand();
|
||||
|
||||
public DataSet GetStudents(string studid, string lname, DateTime dob)
|
||||
public static DataSet PatientInfoSearch(string id, string lname, string fname)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -25,11 +25,11 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
cmdString.Connection = myConn;
|
||||
cmdString.CommandType = CommandType.StoredProcedure;
|
||||
cmdString.CommandTimeout = 1500;
|
||||
cmdString.CommandText = "SearchStudent";
|
||||
cmdString.CommandText = "PatientInfoSearch";
|
||||
// Define input parameter
|
||||
cmdString.Parameters.Add("@studentid", SqlDbType.VarChar, 6).Value = studid;
|
||||
cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 25).Value = lname;
|
||||
cmdString.Parameters.Add("@dob", SqlDbType.Date).Value = dob;
|
||||
cmdString.Parameters.Add("@patientID", SqlDbType.VarChar, 6).Value = id;
|
||||
cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 30).Value = lname;
|
||||
cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 30).Value = fname;
|
||||
// adapter and dataset
|
||||
SqlDataAdapter aAdapter = new SqlDataAdapter();
|
||||
aAdapter.SelectCommand = cmdString;
|
||||
|
41
Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs
generated
41
Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs
generated
@ -240,28 +240,14 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.btnPatientSearch.TabIndex = 4;
|
||||
this.btnPatientSearch.Text = "Search";
|
||||
this.btnPatientSearch.UseVisualStyleBackColor = false;
|
||||
this.btnPatientSearch.Click += new System.EventHandler(this.btnPatientSearch_Click);
|
||||
//
|
||||
// dgvPatient
|
||||
//
|
||||
this.dgvPatient.AllowUserToAddRows = false;
|
||||
this.dgvPatient.AllowUserToDeleteRows = false;
|
||||
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.Location = new System.Drawing.Point(3, 3);
|
||||
this.dgvPatient.Name = "dgvPatient";
|
||||
this.dgvPatient.ReadOnly = true;
|
||||
@ -455,14 +441,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.Location = new System.Drawing.Point(3, 3);
|
||||
this.dgvPrescription.Name = "dgvPrescription";
|
||||
this.dgvPrescription.Size = new System.Drawing.Size(652, 195);
|
||||
@ -592,18 +571,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.Location = new System.Drawing.Point(3, 3);
|
||||
this.dgvPhysician.Name = "dgvPhysician";
|
||||
this.dgvPhysician.ReadOnly = true;
|
||||
@ -724,7 +692,6 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.splcPhysician.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvPhysician)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -8,10 +8,13 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace Louis__Pharmacy_CNSA212_FP
|
||||
{
|
||||
public partial class frmInfo : Form
|
||||
{
|
||||
private ErrorProvider ep1 = new ErrorProvider();
|
||||
|
||||
public frmInfo()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -30,6 +33,93 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
private void pATIENTBindingNavigatorSaveItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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 + txtPatientID.Text.Length > 0)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
fname = txtPatientFirst.Text;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
lname = txtPatientLast.Text;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
id = txtPatientID.Text;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
ds = PharmacyDataTier.PatientInfoSearch(id,lname,fname);
|
||||
|
||||
|
||||
if (ds.Tables[0].Rows.Count > 0) // There is a record.
|
||||
{
|
||||
dgvPatient.Visible = true;
|
||||
// Get data source.
|
||||
dgvPatient.DataSource = ds.Tables[0];
|
||||
dgvPatient.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
|
||||
|
||||
// Set the row and column header styles.
|
||||
dgvPatient.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
|
||||
dgvPatient.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
|
||||
}
|
||||
else
|
||||
{
|
||||
dgvPatient.Visible = false; // Hide the DataGridView if no results are found.
|
||||
MessageBox.Show("No records found.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
||||
ep1.SetError(btnPatientSearch, "Error Searching");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
||||
ep1.SetError(txtPatientID, "Invalid Value");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
||||
ep1.SetError(txtPatientLast, "Invalid Value");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ep1.SetError(txtPatientFirst, "Invalid Value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user