Thursday

linq sum example / csharp


var activefees = from af in invoice.AccountFees
where af.StatusID == EnumStatusType.Open
select af;
return activefees.Sum(af => af.Amount);

// or more complicated with condition
decimal am = 0;
foreach (XAttribute v in rs.RuleAccountFeesToBill(customer_id)){
long f = long.Parse(v.Value);
am += activefees.Sum(acf => acf.AccountFeeSubType.AccountFeeType.FeeTypeID == f ? acf.Amount : 0 );
}


more...

No comments:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...