1
I have this Linq:
var resultado =
(
from pdv in db.T_PDV
from tarefa in db.T_TarefaParceiro.Where(trf => trf.CNPJ == pdv.CNPJ).DefaultIfEmpty()
from parceiro in db.T_OsParceiro.Where(prf => prf.IDTarefaParceiro == tarefa.IDTarefaParceiro)
from acao in db.T_Acao.Where(ac => ac.IDAcao == tarefa.IDAcao).DefaultIfEmpty()
from proxima in db.T_ProximaAcao.Where(pxm => pxm.IDAcao == acao.IDAcao).DefaultIfEmpty()
from info in db.T_InfoClientePdv.Where(inf => inf.CNPJ == pdv.CNPJ).DefaultIfEmpty()
from cliente in db.T_Cliente.Where(clie => clie.IDCliente == info.IDCliente).DefaultIfEmpty()
where pdv.CNPJ == "07599639000184"
select new
{
pdv.CNPJ,
pdv.DataCadastro,
cliente.NomeFantasia,
acao.Acao,
proxima.ProximaAcao,
parceiro.NumOs,
parceiro.DataVisita,
parceiro.DataAgendamento
})
.ToList()
.FirstOrDefault();
As I do in this Chapter, bring the result by the highest date. There is a field called DataVisita
and it is by this field that I must make a Max
, how I do?
worked out the proposed solution?
– user6026