Esempio n. 1
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            Dictionary <String, object> parametros = new Dictionary <String, object>();

            if (!string.IsNullOrEmpty(txtCalle.Text))
            {
                parametros.Add("calle", txtCalle.Text);
            }
            if (!string.IsNullOrEmpty(txtId.Text))
            {
                var id = Convert.ToInt32(txtId.Text);
                parametros.Add("idProveedor", id);
            }
            if (!string.IsNullOrEmpty(txtMail.Text))
            {
                parametros.Add("mail", txtMail.Text);
            }
            if (!string.IsNullOrEmpty(txtNumero.Text))
            {
                var numero = Convert.ToInt32(txtNumero.Text);
                parametros.Add("nro", numero);
            }
            if (!string.IsNullOrEmpty(txtRazonSocial.Text))
            {
                parametros.Add("razonSocial", txtRazonSocial.Text);
            }
            if (!string.IsNullOrEmpty(txtTelefono.Text))
            {
                var telefono = Convert.ToInt32(txtTelefono.Text);
                parametros.Add("telefono", telefono);
            }
            if (!string.IsNullOrEmpty(cboBarrio.Text))
            {
                var idBarrio = Convert.ToInt32(cboBarrio.SelectedValue);
                parametros.Add("idBarrio", idBarrio);
            }
            InitializeDataGridView();
            dgvProveedor.DataSource = oProveedorService.obtenerProveedoresConParametros(parametros);
            if (dgvProveedor.Rows.Count == 0)
            {
                MessageBox.Show("No se encontraron coincidencias para el/los filtros ingresados", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }