private void rdbtodos_CheckedChanged(object sender, EventArgs e) { lblPesquisa.Visible = false; txtPesquisa.Visible = false; btnbuscar.Visible = false; Camadas.BLL.Cliente bllCliente = new Camadas.BLL.Cliente(); dgvClientes.DataSource = ""; dgvClientes.DataSource = bllCliente.Select(); }
private void btnbuscar_Click(object sender, EventArgs e) { Camadas.BLL.Cliente bllCli = new Camadas.BLL.Cliente(); List <Camadas.Model.Cliente> lstCliente = new List <Camadas.Model.Cliente>(); if (rdbcod.Checked) { lstCliente = bllCli.SelectById(Convert.ToInt32(txtPesquisa.Text)); } else if (rdbnome.Checked) { lstCliente = bllCli.SelectByNome(txtPesquisa.Text); } dgvClientes.DataSource = ""; dgvClientes.DataSource = lstCliente; }