Exemplo n.º 1
0
        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(txtId_plan.Text))
            {
                var idPlan = txtId_plan.Text;
                parametros.Add("id_plan_prueba", idPlan);
            }

            if (!string.IsNullOrEmpty(cboProyecto.Text))
            {
                var idProyecto = cboProyecto.Text;
                parametros.Add("id_proyecto", idProyecto);
            }

            if (!string.IsNullOrEmpty(txtNombre.Text))
            {
                var nombre = txtNombre.Text;
                parametros.Add("nombre", nombre);
            }

            if (!string.IsNullOrEmpty(cboResp.Text))
            {
                var idResponsable = cboResp.Text;
                parametros.Add("id_responsable", idResponsable);
            }

            IList <Plan> listadoPlanes = planService.ConsultarPlanConFiltros(parametros);

            dgvPlanes.DataSource = listadoPlanes;

            if (dgvPlanes.Rows.Count == 0)
            {
                MessageBox.Show("No se encontraron coincidencias para el/los filtros ingresados", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }