private void Consultar() { string documento = null; string nombres = null; string apellidos = null; if (!string.IsNullOrEmpty(txtNumeroDocumento.Text)) { documento = txtNumeroDocumento.Text; } if (!string.IsNullOrEmpty(txtNombres.Text)) { nombres = txtNombres.Text; } if (!string.IsNullOrEmpty(txtApellidos.Text)) { apellidos = txtApellidos.Text; } ControlPaciente control = new ControlPaciente(); BindingList <Paciente> pacientes = control.ConsultarPacientes(documento, nombres, apellidos); this.Session["ListadoPacientes"] = pacientes; this.gvPacientes.DataSource = pacientes; this.gvPacientes.DataBind(); if (pacientes.Count > 0) { this.btnExportarExcel.Enabled = true; } else { this.btnExportarExcel.Enabled = false; } }
private void ConsultarPacientes() { long?numeroDocumento = null; if (!string.IsNullOrEmpty(txtNumeroDocumento.Text)) { numeroDocumento = long.Parse(txtNumeroDocumento.Text); } dgvPacientes.AutoGenerateColumns = false; dgvPacientes.DataSource = ControlPaciente.ConsultarPacientes(numeroDocumento, txtPrimerNombre.Text, txtSegundoNombre.Text, txtPrimerApellido.Text, txtSegundoApellido.Text); }