public bool updateEstoqueComId(Estoque estoque) { try { LimparParametros(); AdicionaParametro("@Id", estoque.Codigo); AdicionaParametro("@Quantidade", Estoque.Quantidade); AdicionaParametro("@Operacao", estoque.Operacao); if ((ExecutaComando(CommandType.StoredProcedure, "[dbo].[_aspAlteraEstoquePorID]")) != null) { return true; } else { return false; } } catch (Exception Erro) { throw new Exception(Erro.Message); } }
private void ConfirmarOperacao(string MessageRight, string MessageError, string Certinho, string Erradinho) { try { int Quantidade = Convert.ToInt32(txt_Quantidade.Text); string Codigo = txt_CodigoDoProduto.Text; Estoque estoque = new Estoque(); Estoque.Quantidade = Quantidade; estoque.Operacao = lblParametroOperacao.Text; estoque.Codigo = txt_CodigoDoProduto.Text; if (rdb_ComCodigoDeBarra.Checked) { if (estoqueDao.updateEstoqueComCodigo(estoque)) { Message(Certinho, "Aviso"); ZerarLabel(); limparTxt(); FocoNoTxtEUmNaQuantidade(); } else { Message(Erradinho, "Aviso"); limparTxt(); ZerarLabel(); } } else if (rdb_SemCodigoDeBarra.Checked) { if (estoqueDao.updateEstoqueComId(estoque)) { Message(MessageRight, "Aviso"); ZerarLabel(); limparTxt(); } else { Message(MessageError, "Aviso"); limparTxt(); ZerarLabel(); } } } catch (Exception Erro) { Message("Erro Ao Carregar O Produto: " + Erro.Message, "Erro"); limparTxt(); ZerarLabel(); CarregaUmNaQuantidade(); } }