示例#1
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            mgAlumno.Rows.Clear();
            ParienteComponent personaComponent = new ParienteComponent();

            List <Pariente> listaPersona = new List <Pariente>();

            listaPersona = personaComponent.buscar(txtBuscar.Text);
            int n = 0;

            foreach (var item in listaPersona)
            {
                n = mgAlumno.Rows.Add();
                mgAlumno.Rows[n].Cells[0].Value = item.Id;
                mgAlumno.Rows[n].Cells[1].Value = item.nombre;
                mgAlumno.Rows[n].Cells[2].Value = item.apellido;
                mgAlumno.Rows[n].Cells[3].Value = item.direccion;
                mgAlumno.Rows[n].Cells[4].Value = item.DNI;
                string fecha = item.fechaNacimiento.ToString().Substring(1, 10);
                mgAlumno.Rows[n].Cells[5].Value  = fecha;
                mgAlumno.Rows[n].Cells[6].Value  = item.parentesco;
                mgAlumno.Rows[n].Cells[7].Value  = item.autorizadoRetirar;
                mgAlumno.Rows[n].Cells[8].Value  = item.Id;
                mgAlumno.Rows[n].Cells[9].Value  = item.listaTelefono[0].codigo_Area;
                mgAlumno.Rows[n].Cells[10].Value = item.listaTelefono[0].numero;
                n++;
            }
        }