private void btnConsultar_Click(object sender, EventArgs e) { // Dictionary: Representa una colección de claves y valores. Dictionary <string, object> parametros = new Dictionary <string, object>(); if (!string.IsNullOrEmpty(txtIdCaso.Text)) { var idCaso = txtIdCaso.Text; parametros.Add("id_caso_prueba", idCaso); } if (!string.IsNullOrEmpty(txtIdPlan.Text)) { var idPlan = txtIdPlan.Text; parametros.Add("id_plan_prueba", idPlan); } if (!string.IsNullOrEmpty(txtTitulo.Text)) { var titulo = txtTitulo.Text; parametros.Add("titulo", titulo); } if (!string.IsNullOrEmpty(txtResponsable.Text)) { var idResponsable = txtResponsable.Text; parametros.Add("id_responsable", idResponsable); } if (!string.IsNullOrEmpty(txtDescripcion.Text)) { var descripcion = txtDescripcion.Text; parametros.Add("descripcion", descripcion); } IList <CasoPrueba> listadoCasos = casoPruebaService.ConsultarCasoPruebaConFiltros(parametros); dgvCasos.DataSource = listadoCasos; if (dgvCasos.Rows.Count == 0) { MessageBox.Show("No se encontraron coincidencias para el/los filtros ingresados", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } }