private void btnBuscar_Click(object sender, EventArgs e)
        {
            Patient        patient     = new Patient();
            List <Patient> allPatients = new List <Patient>();

            try
            {
                if (txtPaciente.Text == "")
                {
                    allPatients = Patient_Ctrl.GetAllPatients();
                    foreach (var item in allPatients)
                    {
                        lstPacientes.Items.Add(item.name + " " + item.last_name);
                    }
                }
                else
                {
                    patient = Patient_Ctrl.GetPatientById(int.Parse(txtPaciente.Text));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió un error en la búsqueda de los pacientes");
            }
        }
Beispiel #2
0
 private void lstPacientes_SelectedIndexChanged(object sender, EventArgs e)
 {
     try {
         actualPatient = new Patient();
         Appointment objAp = appointments.ElementAt <Appointment>(lstPacientes.SelectedIndex);
         actualPatient      = Patient_Ctrl.GetPatientById(objAp.patient_id);
         txtNombre.Text     = actualPatient.name;
         txtApellido.Text   = actualPatient.last_name;
         txtNacimiento.Text = actualPatient.date_of_birth.ToString();
         txtSexo.Text       = actualPatient.gender;
         txtRFC.Text        = actualPatient.rfc;
         txtDomicilio.Text  = actualPatient.address;
         txtCorreo.Text     = actualPatient.email;
         txtTelefono.Text   = actualPatient.phone;
         idHist.Text        = actualPatient.clinical_history_id.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }