Exemple #1
0
        private List <_Transacao> IncluirOrdemPagamentoItens(int idOrdemPagamento, int idObra, List <OrdemPagamentoItem> lstItens)
        {
            BIZObra bizObra = new BIZObra();
            List <ObraEtapaGastoRealizado> lstRealizados  = new List <ObraEtapaGastoRealizado>();
            BIZVeiculo                  bizVeiculo        = new BIZVeiculo();
            List <Abastecimento>        lstAbastecimentos = new List <Abastecimento>();
            List <_Transacao>           lstComandos       = new List <_Transacao>();
            Dictionary <string, string> lstParametros     = new Dictionary <string, string>();

            foreach (OrdemPagamentoItem itemOrdem in lstItens)
            {
                itemOrdem.idOrdemPagamento = idOrdemPagamento;
                lstParametros = this.MontarParametrosExecutarOrdemPagamentoItem(itemOrdem);

                lstComandos.Add(new _Transacao()
                {
                    nomeProcedure = "SP_ORDEMPAGAMENTOITENS_INCLUIR",
                    lstParametros = lstParametros
                });

                if (itemOrdem.idObraGastoRealizado != 0)
                {
                    lstRealizados.Add(new ObraEtapaGastoRealizado()
                    {
                        idObraEtapaGastoRealizado = itemOrdem.idObraGastoRealizado,
                        idObraEtapa   = idObra,
                        idUEN         = itemOrdem.idUEN,
                        idCentroCusto = itemOrdem.idCentroCusto,
                        idDespesa     = itemOrdem.idDespesa,
                        Valor         = itemOrdem.Valor,
                        Observacao    = string.Empty,
                        UnitTest      = itemOrdem.UnitTest
                    });

                    lstComandos.AddRange(bizObra.AtualizarGastosRealizadosOrdemPagamento(idOrdemPagamento, lstRealizados));
                }

                if (itemOrdem.idAbastecimento != 0)
                {
                    lstAbastecimentos.Add(new Abastecimento()
                    {
                        idAbastecimento = itemOrdem.idAbastecimento
                    });

                    lstComandos.AddRange(bizVeiculo.AtualizarAbastecimentosOrdemPagamento(idOrdemPagamento, lstAbastecimentos));
                }
            }

            return(lstComandos);
        }