public static Reentrega Processar(Rota rota) { _reentregaOcorrenciaXml = new Reentrega(); var entregas = rota.Entregas.Where(entrega => entrega.IdDevolvida == true && entrega.IdAcaoDevolucao == (short)TipoAcaoDevolucao.Reentrega ); foreach (var entrega in entregas) { if (entrega.MotivoDevolucao.IdGeraRemuneracaoReentrega) { _reentregaOcorrenciaXml.AdicionarItem(entrega.Cliente.CdClienteNegocio, entrega.MotivoDevolucao.CdMotivoDevolucaoNegocio); } } return(_reentregaOcorrenciaXml.Itens.Count() > 0 ? _reentregaOcorrenciaXml : null); }
private static void ReentregaOcorrenciaWS(Entities.Ocorrencia ocorrencia, DT_CUSTO_ADICIONAL_FRETE_HBSIS_RequestIntegracaoOcorrencia ocorrenciaWS) { var itens = new List <DT_CUSTO_ADICIONAL_FRETE_HBSIS_RequestIntegracaoOcorrenciaItensItem>(); Reentrega reentrega = (Reentrega)ocorrencia; ocorrenciaWS.Codigo = reentrega.Codigo; ocorrenciaWS.Nome = reentrega.Nome; ocorrenciaWS.Quantidade = reentrega.Quantidade.ToString(); ocorrenciaWS.Itens = InicializaItens(); foreach (var item in reentrega.Itens) { var ocorrenciaWsItem = InicializaItem(); ocorrenciaWsItem.CodigoCliente = item.CodigoClienteNegocio; ocorrenciaWsItem.Motivo = item.Motivo; itens.Add(ocorrenciaWsItem); } ocorrenciaWS.Itens.Item = itens.ToArray(); }