public DocumentoEntradaService(DataContext db, IConfiguration configuration)
 {
     this.db                  = db;
     this.configuration       = configuration;
     this.connString          = configuration.GetConnectionString("sage_db");
     this.saldoEstoqueService = new SaldoEstoqueService(db, configuration);
     this.contaReceberService = new ContaReceberService(db, configuration);
 }
Example #2
0
        private void SaidaItemsEstoque(string Numero, string Loja)
        {
            var saldoEstoqueService = new SaldoEstoqueService(db, configuration);

            try
            {
                db.PedidoVendaItem
                .Where(e => e.NumeroVenda == Numero && e.Loja == Loja && e.RowDeleted != "T")
                .ToList()
                .ForEach(item => {
                    saldoEstoqueService.SaidaItem(item.Codigo, item.Loja, (int)item.Quantidade);
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        private void EntradaItemsEstoque(string Numero, string Loja)
        {
            var saldoEstoqueService = new SaldoEstoqueService(db, configuration);

            try
            {
                using (var tr = db.Database.BeginTransaction())
                {
                    db.PedidoVendaItem
                    .Where(e => e.NumeroVenda == Numero && e.Loja == Loja && e.RowDeleted != "T")
                    .ToList()
                    .ForEach(item => {
                        saldoEstoqueService.EntradaItem(item.Codigo, item.Loja, (int)item.Quantidade);
                    });
                    tr.Commit();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }