private void txtDescricao_TextChanged(object sender, EventArgs e) { try { novoProduto = new RegraNegocio.ProdutoRegraNegocio(); DataTable dadosTabela = new DataTable(); string descricao = txtDescricao.Text; dadosTabela = novoProduto.PesquisarProdutoNome(descricao); if (dadosTabela.Rows.Count > 0) { gdvProduto.DataSource = dadosTabela; EstiloCoresLinha(); } else { gdvProduto.DataSource = null; } } catch (Exception) { MessageBox.Show("Error.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void PesquisarAll() { try { novoProduto = new RegraNegocio.ProdutoRegraNegocio(); DataTable dadosTabela = new DataTable(); dadosTabela = novoProduto.PesquisarAll(); gdvProduto.DataSource = dadosTabela; txtDescricao.Focus(); } catch (Exception) { MessageBox.Show("Error no Método PesquisarAll.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void PesquisarTotalProduto() { try { novoProduto = new RegraNegocio.ProdutoRegraNegocio(); DataTable dadosTabelaProduto = new DataTable(); dadosTabelaProduto = novoProduto.PesquisarTotalProduto(); qtdeProduto = Convert.ToInt32(dadosTabelaProduto.Rows[0]["QTDE"].ToString()); lblTotalProduto.Text = qtdeProduto.ToString(); } catch (Exception) { throw; } }
private void txtCodigoBarra_KeyUp(object sender, KeyEventArgs e) { try { novoProduto = new RegraNegocio.ProdutoRegraNegocio(); DataTable dadosTabela = new DataTable(); dadosTabela = novoProduto.PesquisaCodigoBarra(txtCodigoBarra.Text); if (dadosTabela.Rows.Count > 0) { gdvProduto.DataSource = dadosTabela; EstiloCoresLinha(); } else { if (MessageBox.Show("Não contém Produto cadastrado com esse Código de Barra.", "Inrformação", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { LimparCampos(); txtCodigoBarra.Focus(); } } if (e.KeyCode == Keys.Escape) { this.Close(); frmVendas._idProduto = 0; } if (e.KeyCode == Keys.Down) { gdvProduto.Focus(); } } catch (Exception) { MessageBox.Show("Error.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }