private void txtBuscarProduto_Click(object sender, EventArgs e) { if (txtProduto.Text != "") { ProdutoS produtoSimples = new ProdutoS(); produtoSimples.id = Convert.ToInt32(txtProduto.Text); if (produtoSimples.BuscarProduto() == true) { txtProduto.Text = produtoSimples.id.ToString(); txtNomeProduto.Text = produtoSimples.nome; txtProdutoPrecoCusto.Text = produtoSimples.precoc; txtProdutoPrecoVenda.Text = produtoSimples.precov; txtQuantidade.Enabled = true; btnAdicionar.Enabled = true; btnRemover.Enabled = true; } else { MessageBox.Show("Nenhum produto encontrado"); } } else { MessageBox.Show("Digite um id de Produto válido!"); } }
private void btBuscaPS_Click(object sender, EventArgs e) { if (txtBuscaId.Text != "") { ProdutoS produtoSimples = new ProdutoS(); produtoSimples.id = Convert.ToInt32(txtBuscaId.Text); if (produtoSimples.BuscarProduto() == true) { txtId.Text = produtoSimples.id.ToString(); txtNome.Text = produtoSimples.nome; txtPrecoC.Text = produtoSimples.precoc; txtPrecoV.Text = produtoSimples.precov; txtNome.Enabled = true; txtPrecoC.Enabled = true; txtPrecoV.Enabled = true; btnSalvar.Enabled = true; btnExcluir.Enabled = true; } else { MessageBox.Show("Nenhum produto encontrado"); } } else { MessageBox.Show("Digite um id válido!"); } }