private void btnBuscar_Click(object sender, EventArgs e) { try { string CPF; CPF = mTxtCPF.Text; Buscar_BLL bll = new Buscar_BLL(); CADASTRO_DTO obj = new CADASTRO_DTO(); obj = bll.Val_Busca((CPF)); txtNomeFun.Text = obj.nome; txtRgFunc.Text = obj.RG; cbbBancoFunc.Text = obj.banco; txtAgenciaFunc.Text = obj.agencia; txtContaFunc.Text = obj.conta; txtEndereco.Text = obj.endereco; txtCidade.Text = obj.cidade; txtBairro.Text = obj.bairro; CbEstado.Text = obj.estado; txtNumero.Text = obj.numero; mTxtTelefone.Text = obj.telefone; btnAlterarFunc.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Information); } /*try * { * CADASTRO_DTO obj = new CADASTRO_DTO(); * obj.CPF = mTxtCPF.Text; * string retorna; * retorna = Buscar_BLL.Val_Busca(obj); * if (retorna == "Funcionário encontrado!") * { * MessageBox.Show(retorna, "Funcionário encontrado!" + obj, MessageBoxButtons.OK, MessageBoxIcon.Information); * * * * } * else * { * MessageBox.Show(retorna, "Funcionário não foi encontrado", MessageBoxButtons.OK, MessageBoxIcon.Information); * } * } * catch (Exception ex) * { * throw new Exception(ex.Message); * * }*/ }
private void btnBuscarProd_Click_1(object sender, EventArgs e) { try { string Nome; Nome = txtNomeProd.Text; Buscar_BLL bll = new Buscar_BLL(); Prod_DTO produto = new Prod_DTO(); produto = bll.Validar_Busca_Produto((Nome)); txtNomeProd.Text = produto.nome; txtPreço.Text = produto.preco; txtTipo.Text = produto.tipo; txtUniMed.Text = produto.unid_medida; txtEstoque.Text = produto.estoque; btnAlterarProd.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Information); } }