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");
            }
        }
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            //	{"patient":{"name":"lalo","last_name":"lalo","date_of_birth":"2010-02-02","address":"calle","phone":"456456","gender":"M","curp":"AAAA000000HAAAAA00","rfc":"AAAA000000000","email":"*****@*****.**"}}
            Patient pat = new Patient();

            pat.name          = txtNombrePa.Text;
            pat.last_name     = txtPrApellidoPa.Text + " " + txtSegApellidoPa.Text;
            pat.date_of_birth = txtFechaNacPa.Text;
            pat.address       = txtDomicilioPa.Text;
            pat.phone         = txtTelefonoPa.Text;
            pat.gender        = cmbSexoPa.SelectedItem.ToString();
            pat.curp          = txtCURPPa.Text;
            pat.rfc           = txtRFCPa.Text;
            pat.email         = txtCorreoPa.Text;
            Patient_Ctrl.CreatePatient(pat);
        }
Ejemplo n.º 3
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);
     }
 }