private void llenarDatos(string rut) { try { Biblioteca.Anfitrion anf = new Biblioteca.Anfitrion() { Id_tributario = rut }; if (anf.read()) { txtRut.Text = anf.Id_tributario; txtNombre.Text = anf.Nombre; cb_ciudad.SelectedIndex = anf.Id_Ciudad - 1; txtAPaterno.Text = anf.APaterno; txtAMaterno.Text = anf.AMaterno; txt_direccion.Text = anf.Direccion; txt_email.Text = anf.Email; txt_tel_hogar.Text = anf.Tel_hogar; txt_tel_movil.Text = anf.Tel_movil; dp_fecha_nac.Text = anf.Fecha_nac.ToString(); txt_cupos.Text = anf.Cupos_alojamiento.ToString(); } } catch (Exception ex) { lblMsj.Content = "Error: " + ex; } }
private void btnBuscar_Click(object sender, RoutedEventArgs e) { try { Biblioteca.Anfitrion anf = new Biblioteca.Anfitrion() { Id_tributario = txtRut.Text }; if (anf.read()) { txtNombre.Text = anf.Nombre; cb_ciudad.SelectedIndex = anf.Id_Ciudad - 1; txtAPaterno.Text = anf.APaterno; txtAMaterno.Text = anf.AMaterno; txt_direccion.Text = anf.Direccion; txt_email.Text = anf.Email; txt_tel_hogar.Text = anf.Tel_hogar; txt_tel_movil.Text = anf.Tel_movil; dp_fecha_nac.Text = anf.Fecha_nac.ToString(); txt_cupos.Text = anf.Cupos_alojamiento.ToString(); lblMsj.Content = "Anfitrion Encontrado."; } else { lblMsj.Content = "Anfitrion No Encontrado."; } } catch (Exception ex) { lblMsj.Content = "Error: " + ex; } }