本文整理汇总了C#中CmsData.CMSDataContext.GivingCurrentPercentOfFormer方法的典型用法代码示例。如果您正苦于以下问题:C# CMSDataContext.GivingCurrentPercentOfFormer方法的具体用法?C# CMSDataContext.GivingCurrentPercentOfFormer怎么用?C# CMSDataContext.GivingCurrentPercentOfFormer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmsData.CMSDataContext
的用法示例。
在下文中一共展示了CMSDataContext.GivingCurrentPercentOfFormer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContributionChange
internal static Expression ContributionChange(
ParameterExpression parm, CMSDataContext Db,
DateTime? dt1,
DateTime? dt2,
CompareType op,
double pct)
{
if (Db.CurrentUser == null || Db.CurrentUser.Roles.All(rr => rr != "Finance"))
return AlwaysFalse(parm);
var q = Db.GivingCurrentPercentOfFormer(dt1, dt2,
op == CompareType.Greater ? ">" :
op == CompareType.GreaterEqual ? ">=" :
op == CompareType.Less ? "<" :
op == CompareType.LessEqual ? "<=" :
op == CompareType.Equal ? "=" : "<>", pct);
var tag = Db.PopulateTemporaryTag(q.Select(pp => pp.Pid));
Expression<Func<Person, bool>> pred = p => p.Tags.Any(t => t.Id == tag.Id);
Expression expr = Expression.Invoke(pred, parm);
return expr;
}
示例2: RecentGivingAsPctOfPrevious
internal static Expression RecentGivingAsPctOfPrevious(
ParameterExpression parm, CMSDataContext Db,
int Days,
CompareType op,
double pct)
{
var dt1 = DateTime.Today.AddDays(-Days * 2);
var dt2 = DateTime.Today.AddDays(-Days);
var q = Db.GivingCurrentPercentOfFormer(dt1, dt2, op == CompareType.Greater ? ">" : "<=", pct);
var tag = Db.PopulateTemporaryTag(q.Select(pp => pp.Pid));
Expression<Func<Person, bool>> pred = p => p.Tags.Any(t => t.Id == tag.Id);
Expression expr = Expression.Invoke(pred, parm);
return expr;
}