private void cbPatient_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbPatient.SelectedIndex != 0)
            {
                PatientHistory objPatientHistory = new PatientHistory();
                objPatient.Firstname = cbPatient.SelectedItem.ToString().Split(' ')[0];
                objPatient.Lastname  = cbPatient.SelectedItem.ToString().Split(' ')[1];

                objPatientHistory.Patientid = objPatient.GetPatientId(objPatient);
                DataSet dsPatientHistory = objPatientHistory.GetPatientDetails(objPatientHistory);
                if (dsPatientHistory.Tables[0].Rows.Count > 0)
                {
                    lblFirstnameValue.Text      = dsPatientHistory.Tables[0].Rows[0]["PATIENT_NAME"].ToString();
                    lblAppartmentNoValue.Text   = dsPatientHistory.Tables[0].Rows[0]["ADDRESS_LINE_1"].ToString();
                    lblStreetNameValue.Text     = dsPatientHistory.Tables[0].Rows[0]["ADDRESS_LINE_2"].ToString();
                    lblCityValue.Text           = dsPatientHistory.Tables[0].Rows[0]["CITY"].ToString();
                    lblProvienceValue.Text      = dsPatientHistory.Tables[0].Rows[0]["PROVIENCE_DESCRIPTION"].ToString();
                    lblPostalCodeValue.Text     = dsPatientHistory.Tables[0].Rows[0]["POSTAL_CODE"].ToString();
                    lblDateofBirthValue.Text    = dsPatientHistory.Tables[0].Rows[0]["DOB"].ToString();
                    lblEmailValue.Text          = dsPatientHistory.Tables[0].Rows[0]["EMAIL"].ToString();
                    lblContactNoValue.Text      = dsPatientHistory.Tables[0].Rows[0]["CONTACT_NO"].ToString();
                    panelPatientDetails.Visible = true;
                    panelAppointment.Visible    = true;
                }
            }
            else
            {
                ClearPatientDetails();
            }
        }
Beispiel #2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (valid())
            {
                PatientHistory objPatientHistory = new PatientHistory();
                objPatient.Firstname = cbPatient.SelectedItem.ToString().Split(' ')[0];
                objPatient.Lastname  = cbPatient.SelectedItem.ToString().Split(' ')[1];

                objPatientHistory.Patientid = objPatient.GetPatientId(objPatient);
                DataSet dsPatientHistory = objPatientHistory.GetPatientDetails(objPatientHistory);
                //dgvPatientHistory.DataSource = dsPatientHistory.Tables[0];
                DataTable dtPatientHistory = new DataTable("PATIENT_HISTORY");
                dtPatientHistory.Columns.Add("APPOINTMENT_ID");
                dtPatientHistory.Columns.Add("APPOINTMENT_DATE");
                dtPatientHistory.Columns.Add("PROCEDURE_DESCRIPTION");
                dtPatientHistory.Columns.Add("PAID");

                for (int i = 0; i < dsPatientHistory.Tables[0].Rows.Count; i++)
                {
                    DataRow row = dtPatientHistory.NewRow();
                    row["APPOINTMENT_ID"]        = dsPatientHistory.Tables[0].Rows[i]["APPOINTMENT_ID"].ToString();
                    row["APPOINTMENT_DATE"]      = dsPatientHistory.Tables[0].Rows[i]["APPOINTMENT_DATE"].ToString();
                    row["PROCEDURE_DESCRIPTION"] = dsPatientHistory.Tables[0].Rows[i]["PROCEDURE_DESCRIPTION"].ToString();
                    row["PAID"] = dsPatientHistory.Tables[0].Rows[i]["PAID"].ToString();
                    dtPatientHistory.Rows.Add(row);
                }
                dgvPatientHistory.DataSource = dtPatientHistory;
            }
        }