private void buscarServico(int id) { Camadas.BLL.Servico bllServ = new Camadas.BLL.Servico(); List <Camadas.Model.Servico> listaServ = new List <Camadas.Model.Servico>(); listaServ = bllServ.SelectById(id); if (listaServ != null) { servico = listaServ[0]; } }
private void BtnPesquisar_Click(object sender, EventArgs e) { List <Camadas.Model.Servico> listaServico = new List <Camadas.Model.Servico>(); Camadas.BLL.Servico bllServico = new Camadas.BLL.Servico(); if (rdbTodos.Checked) { listaServico = bllServico.Select(); } else if (rdbId.Checked) { listaServico = bllServico.SelectById(Convert.ToInt32(txtPesquisa.Text)); } else if (rdbDescricao.Checked) { listaServico = bllServico.SelectByDescricao(txtPesquisa.Text.Trim()); } dgvServico.DataSource = ""; dgvServico.DataSource = listaServico; limpaCampos(); }