private void frmUpdatePerson_Load(object sender, EventArgs e)
 {
     lblNoFieldEmpty.Hide();
     encounterList             = new List <EncounterVO>();
     encounterList             = encounter.SetEncounterDataUsingPersonId(Int32.Parse(txtUpdatePersonId.Text));
     txtUpdateEncounterId.Text = encounterList[0].EncounterID.ToString();
     txtUpdatePhysician.Text   = encounterList[0].Physician;
     txtUpdateMedication.Text  = encounterList[0].Medication;
 }
Esempio n. 2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (accessLevel != 2)
            {
                btnAddPerson.Enabled = true;
            }
            grdPerson.DataSource    = null;
            grdEncounter.DataSource = null;
            List <PersonVO> _personVO = new List <PersonVO>();

            _personVO = person.SetPersonData(txtFirstName.Text, txtLastName.Text, cboSex.Text, txtDate.Text, txtVoterID.Text);
            DataTable personTable    = new DataTable();
            DataTable encounterTable = new DataTable();

            if (_personVO != null)
            {
                personTable.Columns.Add("PersonID", typeof(int));
                personTable.Columns.Add("First Name", typeof(string));
                personTable.Columns.Add("Last Name", typeof(string));
                personTable.Columns.Add("Sex", typeof(string));
                personTable.Columns.Add("Birth Date", typeof(string));
                personTable.Columns.Add("VoterID", typeof(string));
                encounterTable.Columns.Add("EncounterID", typeof(int));
                encounterTable.Columns.Add("Physician", typeof(string));
                encounterTable.Columns.Add("Medication", typeof(string));
                encounterTable.Columns.Add("PersonID", typeof(int));
                if (txtEncounterID.Text == string.Empty)
                {
                    foreach (PersonVO personObject in _personVO)
                    {
                        List <EncounterVO> _encounterVO = new List <EncounterVO>();
                        //code to fill person table with each object
                        personTable.Rows.Add(personObject.PersonID, personObject.FirstName, personObject.LastName, personObject.Sex, personObject.BirthDate, personObject.VoterID);
                        int personid = personObject.PersonID;
                        _encounterVO = encounter.SetEncounterDataUsingPersonId(personid);
                        if (_encounterVO != null)
                        {
                            foreach (EncounterVO encounterObject in _encounterVO)
                            {
                                //code to fill encounter table
                                encounterTable.Rows.Add(encounterObject.EncounterID, encounterObject.Physician, encounterObject.Medication, encounterObject.PersonID);
                            }
                            grdEncounter.DataSource = encounterTable;
                        }
                    }
                    grdPerson.DataSource = personTable;
                }
                else
                {
                    EncounterVO encounterVO = new EncounterVO();
                    PersonVO    personVO    = new PersonVO();
                    encounterVO = encounter.SetEncounterDataUsingEncounterId(Int32.Parse(txtEncounterID.Text));
                    if (encounterVO != null)
                    {
                        //code to fill encounter table
                        personVO = person.SetPersonDataUsingPersonId(encounterVO.PersonID);
                        encounterTable.Rows.Add(encounterVO.EncounterID, encounterVO.Physician, encounterVO.Medication, encounterVO.PersonID);
                        personTable.Rows.Add(personVO.PersonID, personVO.FirstName, personVO.LastName, personVO.Sex, personVO.BirthDate, personVO.VoterID);
                        grdEncounter.DataSource = encounterTable;
                        grdPerson.DataSource    = personTable;
                    }
                }
            }
            if (personTable.Rows.Count > 0)
            {
                lblNoPersonFound.Hide();
                btnAddEncounter.Enabled = true;
                if (accessLevel != 2)
                {
                    btnOK.Enabled = true;
                }
                if (accessLevel != 3)
                {
                    btnPreview.Enabled = true;
                }
            }
            else
            {
                lblNoPersonFound.Show();
            }

            if (encounterTable.Rows.Count > 0)
            {
                lblNoEncounterFound.Hide();
            }
            else
            {
                lblNoEncounterFound.Show();
            }
        }