Exemplo n.º 1
0
 public IList <Beneficio> PorPedido(long idPedido)
 {
     return(DbExec.Uses("Oracle")
            .Execute("TKTSVC.TKT_SVC_SGP_PEDIDO_PKG.BENEFICIOS_ID_PEDIDO")
            .WithParam <long>("P_IDPEDIDO", idPedido)
            .GetResult(new InlineTransformer <Beneficio>()
                       .Property <long>(x => x.Id, "IDBENEFICIO")
                       .Property <string>(x => x.CodigoDepartamento, "CDDEPTO")
                       .Property <long>(x => x.PedidoId, "IDPEDIDO")
                       .Property <long>(x => x.UnidadeId, "IDUNIDADE")
                       .Property <string>(x => x.NomeBeneficiario, "NOMEBENEFICIARIO")
                       .Property <string>(x => x.NomeDepartamento, "NOMEDEPTO")
                       .Property <long?>(x => x.CPF, "CPF")
                       .Property <long?>(x => x.IdentificacaoBeneficiario, "NUMIDENTIDADE")
                       .Property <decimal?>(x => x.ValorBeneficio, "VALOR")
                       .HardCodedBooleanProperty <bool>(x => x.CPFSpecified, x => x.CPF != null)
                       .HardCodedBooleanProperty <bool>(x => x.IdentificacaoBeneficiarioSpecified, x => x.IdentificacaoBeneficiario != null)
                       .HardCodedProperty <bool>(x => x.IdSpecified, true)
                       .HardCodedProperty <bool>(x => x.PedidoIdSpecified, true)
                       .HardCodedProperty <bool>(x => x.UnidadeIdSpecified, true)
                       .HardCodedBooleanProperty <bool>(x => x.ValorBeneficioSpecified, x => x.ValorBeneficio != null)));
 }
Exemplo n.º 2
0
        public IList <PedidoPATDetalhado> PorNomeArquivo(string nomeArquivo)
        {
            IList <PedidoPATDetalhado> pedidos = new List <PedidoPATDetalhado>();

            var dtos = DbExec.Uses("Oracle")
                       .Execute("TKTSVC.TKT_SVC_SGP_PEDIDO_PKG.PEDIDO_NOME_ARQUIVO")
                       .WithParam <string>("P_NOMEARQUIVO", nomeArquivo)
                       .GetResult(new InlineTransformer <PedidoArquivoDto>()
                                  .Property <long>(x => x.Id, "IDPEDIDO")
                                  .Property <long>(x => x.IdCanalEntrada, "IDCANALENTRADA")
                                  .Property <DateTime?>(x => x.DataPedido, "DATAPEDIDO")
                                  .Property <DateTime?>(x => x.DataEntrega, "DATAENTREGA")
                                  .Property <string>(x => x.NumeroPedidoCliente, "NUMPEDIDOCLIENTE")
                                  .Property <string>(x => x.NumeroPedidoOrigem, "NUMPEDIDOORIGEM")
                                  .Property <string>(x => x.NumeroCarrinhoCompra, "NUMCARRINHOCOMPRA")
                                  .Property <string>(x => x.NumeroEnvio, "NUMENVIO")
                                  .Property <decimal?>(x => x.ValorTotal, "VALORTOTAL")

                                  //Dados do Arquivo
                                  .Property <long>(x => x.ArquivoId, "IDARQUIVO")
                                  .Property <string>(x => x.ArquivoNome, "NOMEARQUIVO")
                                  .Property <string>(x => x.ArquivoSistemaOrigem, "SISTEMAORIGEM")

                                  //Dados de Produto
                                  .Property <long>(x => x.ProdutoId, "IDPRODUTO")
                                  .Property <string>(x => x.ProdutoDescricao, "DESCPRODUTO")
                                  .Property <string>(x => x.ProdutoCodigoERP, "CODPRODUTOERP")


                                  //Dados de Contrato
                                  .Property <long>(x => x.ContratoId, "IDCONTRATO")
                                  .Property <string>(x => x.ContratoNumero, "NUMCONTRATO")

                                  //Dados de Cliente
                                  .Property <long>(x => x.ClienteId, "IDCLIENTE")
                                  .Property <string>(x => x.RazaoSocial, "RAZAOSOCIAL")
                                  .Property <string>(x => x.NomeFantasia, "NOMEFANTASIA")
                                  .Property <string>(x => x.Cnpj, "CNPJ")

                                  //Dados Status Pedido
                                  .Property <string>(x => x.DescricaoStatus, "STATUS")
                                  .Property <long>(x => x.StatusId, "IDSTATUS")
                                  );


            foreach (var dto in dtos)
            {
                PedidoPATDetalhado pedido = AutoMapper.Mapper.Map <PedidoPATDetalhado>(dto);

                pedido.Arquivo  = AutoMapper.Mapper.Map <Arquivo>(dto);
                pedido.Produto  = AutoMapper.Mapper.Map <ProdutoVO>(dto);
                pedido.Cliente  = AutoMapper.Mapper.Map <ClienteVO>(dto);
                pedido.Contrato = AutoMapper.Mapper.Map <ContratoClienteVO>(dto);
                pedido.Status   = AutoMapper.Mapper.Map <StatusPedido>(dto);

                pedido.NumeroPedido = NumeroPedido(dto);

                pedidos.Add(pedido);
            }

            return(pedidos);
        }