public PledgeInfo GetPledgeInfo()
{
var RRTypes = new int[] { 6, 7 };
var q = from c in DbUtil.Db.Contributions
where c.FundId == Setting.DonationFundId
where c.PeopleId == pid
where !RRTypes.Contains(c.ContributionTypeId)
group c by pid into g
select new PledgeInfo
{
Pledged = g.Where(c => c.ContributionTypeId == ContributionTypeCode.Pledge).Sum(c => c.ContributionAmount) ?? 0,
Given = g.Where(c => c.ContributionTypeId != ContributionTypeCode.Pledge).Sum(c => c.ContributionAmount) ?? 0,
};
return q.SingleOrDefault() ?? new PledgeInfo { Given = 0m, Pledged = 0m };
}