I have the following code which is getting me one set of results and then another (resultsSetup
) which is exactly the same based on if a condition is met.
// use Linq to query the downtime data
var results = from t in this.MachineEvent.Transactions.OfType<Logic.DowntimeScrapTransaction>()
where t.TransactionType == Logic.Enums.MachineEventTransactionType.DowntimeScrapTransaction
group t by t.Reason.Group into grps
let totalDowntime = grps.Sum(g => g.DowntimeDuration.TotalMinutes)
orderby totalDowntime descending
select new { Key = grps.Key, values = grps, TotalDownTime = grps.Sum(g => g.DowntimeDuration.TotalMinutes) };
if (this.MachineEvent.MachineState == Logic.Enums.MachineState.Production)
{
var resultsSetup = from t in this.MachineEvent.GetSetupMachineEvent().Transactions.OfType<Logic.DowntimeScrapTransaction>()
where t.TransactionType == Logic.Enums.MachineEventTransactionType.DowntimeScrapTransaction
group t by t.Reason.Group into grps
let totalDowntime = grps.Sum(g => g.DowntimeDuration.TotalMinutes)
orderby totalDowntime descending
select new { Key = grps.Key, values = grps, TotalDownTime = grps.Sum(g => g.DowntimeDuration.TotalMinutes) };
results.Concat(resultsSetup);
results.Union(resultsSetup);
}
What I am trying to do is simply combine these two results together. As you can see I've tried the Concat
and Union
method which I am having no success with either.