Ejemplo n.º 1
0
        private void btnFiltrar_Click(object sender, EventArgs e)
        {
            List <Camadas.Model.Cliente> lstcliente = new List <Camadas.Model.Cliente>();

            Camadas.BLL.Cliente bllcliente = new Camadas.BLL.Cliente();

            if (rbdId.Checked)
            {
                if (txtPesquisa.Text != string.Empty)
                {
                    lstCliente = bllcliente.SelectById(Convert.ToInt32(txtPesquisa.Text));
                }
                else
                {
                    MessageBox.Show("ID vazio", "Pesquisa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else if (rbdNome.Checked)
            {
                lstCliente = bllcliente.SelectByNome(txtPesquisa.Text.Trim());
            }

            dgvClientes.DataSource = "";
            dgvClientes.DataSource = lstCliente;
        }