Skip to content

Instantly share code, notes, and snippets.

@mterwoord
Created August 10, 2016 14:23
Show Gist options
  • Save mterwoord/32d3b6ae7e199ea2c401c5b2e5fb8a71 to your computer and use it in GitHub Desktop.
Save mterwoord/32d3b6ae7e199ea2c401c5b2e5fb8a71 to your computer and use it in GitHub Desktop.
Query.cs
return (from item in xRitInfoService.All
join xApos in xAnalyses.All
on new
{
item.Bonnummer,
AnalyseSource = AnalyseSourceEnum.Apos
} equals new
{
xApos.Bonnummer,
xApos.AnalyseSource
} into xAllApos
join xLab in xAnalyses.All
on new
{
item.Bonnummer,
AnalyseSource = AnalyseSourceEnum.Lab
} equals new
{
xLab.Bonnummer,
xLab.AnalyseSource
} into xAllLab
where item.TijdstipIn != null
&& item.Afgekeurd == afgekeurd
&& item.LeverancierId == mLeverancierId
select new RitDetailObj
{
Bonnummer = item.Bonnummer,
Datum = item.TijdstipIn.Value,
AposAs = xAllApos.Average(i => i.Ash),
AposNcw = xAllApos.Average(i => i.Ncw),
AposDS = xAllApos.Average(i => i.DrogeStof),
LabAs = xAllLab.Average(i => i.Ash),
LabNcw = xAllLab.Average(i => i.Ncw),
LabDS = xAllLab.Average(i => i.DrogeStof),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment