Enumerate Cahed objects

Hello everybody,

today I want to share how to enumerate cahed objects according to some type. 

Imagine you have following declaration:

public PXSelectJoin<PRTran> PaySlipDetails;

And that you need to enumerate them as list of PRTran's in some special way.

In my case I used following instruction:

var prTrans = PaySlipDetails.Cache.Cached.Cast<PRTran>().ToList().Where(a => a.IsDeleted.HasValue && !a.IsDeleted.Value).ToList();// we have list of all undeleted pr trans

var sumOtherAdj = prTrans.Where(a => a.EarningType == EarningType.OA.GetEnumDescription() || a.EarningType == EarningType.OD.GetEnumDescription()).Sum(a => a.TotalAmount);

No Comments

Add a Comment