示例#1
0
        private void InserirBoletosNaCompra(Compra compra, IList <Boleto> lbs)
        {
            IList <Boleto> bols = this.GetBoletos(compra.Id);
            IList <Boleto> b    = bols.Except(lbs).ToList();

            foreach (Boleto bR in b)
            {
                _iboletoService.Delete(bR);
            }
            if (lbs.Any(p => p.Id <= 0))
            {
                _iboletoService.InsertRange(lbs.Where(p => p.Id <= 0));
            }

            PagamentoDireto pd = _iPagamentoDiretoRepository.GetByCompra(compra.Id);

            if (pd != null)
            {
                _iPagamentoDiretoRepository.Delete(pd);
            }
        }
示例#2
0
        private void InserirPagamentoDiretoNaCompra(Compra compra)
        {
            IList <Boleto> bols = this.GetBoletos(compra.Id);

            foreach (Boleto bR in bols)
            {
                _iboletoService.Delete(bR);
            }

            PagamentoDireto pd = _iPagamentoDiretoRepository.GetByCompra(compra.Id);

            if (pd == null)
            {
                pd = new PagamentoDireto();
            }

            pd.Compra        = compra;
            pd.Data          = DateTime.Now;
            pd.DataPagamento = compra.Data;
            pd.Empresa       = compra.Empresa;
            pd.Valor         = compra.ValorTotal;
            _iPagamentoDiretoRepository.Update(pd);
        }