当前位置: 首页>>代码示例>>C#>>正文


C# CMSDataContext.PopulateTemporaryTag方法代码示例

本文整理汇总了C#中CmsData.CMSDataContext.PopulateTemporaryTag方法的典型用法代码示例。如果您正苦于以下问题:C# CMSDataContext.PopulateTemporaryTag方法的具体用法?C# CMSDataContext.PopulateTemporaryTag怎么用?C# CMSDataContext.PopulateTemporaryTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CmsData.CMSDataContext的用法示例。


在下文中一共展示了CMSDataContext.PopulateTemporaryTag方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:rossspoon,项目名称:bvcms,代码行数:20,代码来源:Expressions.cs

示例2: SavedQuery

        internal static Expression SavedQuery(ParameterExpression parm,
            CMSDataContext Db,
            string QueryIdDesc,
            CompareType op,
            bool tf)
        {
            var a = QueryIdDesc.SplitStr(":", 2);
            var qid = a[0].ToInt();
            var savedquery = Db.QueryBuilderClauses.SingleOrDefault(q =>
                q.QueryId == qid);
            if (savedquery == null)
                return AlwaysFalse(parm);

            var q2 = Db.PeopleQuery(qid).Select(pp => pp.PeopleId);
            var tag = Db.PopulateTemporaryTag(q2);

            Expression<Func<Person, bool>> pred = p => p.Tags.Any(t => t.Id == tag.Id);
            Expression expr = Expression.Invoke(pred, parm);
            return expr;
        }
开发者ID:rossspoon,项目名称:bvcms,代码行数:20,代码来源:Expressions.cs

示例3: ContributionAmount2

 internal static Expression ContributionAmount2(
     ParameterExpression parm, CMSDataContext Db,
     DateTime? start,
     DateTime? end,
     int fund,
     CompareType op,
     decimal amt)
 {
     if (Db.CurrentUser == null || Db.CurrentUser.Roles.All(rr => rr != "Finance"))
         return AlwaysFalse(parm);
     IQueryable<int> q = null;
     switch (op)
     {
         case CompareType.GreaterEqual:
             q = from c in Db.Contributions2(start, end, 0, false, false, true)
                 where fund == 0 || c.FundId == fund
                 group c by c.CreditGiverId into g
                 where g.Sum(cc => cc.Amount) >= amt
                 select g.Key ?? 0;
             break;
         case CompareType.Greater:
             q = from c in Db.Contributions2(start, end, 0, false, false, true)
                 where fund == 0 || c.FundId == fund
                 group c by c.CreditGiverId into g
                 where g.Sum(cc => cc.Amount) > amt
                 select g.Key ?? 0;
             break;
         case CompareType.LessEqual:
             q = from c in Db.Contributions2(start, end, 0, false, false, true)
                 where fund == 0 || c.FundId == fund
                 where c.Amount > 0
                 group c by c.CreditGiverId into g
                 where g.Sum(cc => cc.Amount) <= amt
                 select g.Key ?? 0;
             break;
         case CompareType.Less:
             q = from c in Db.Contributions2(start, end, 0, false, false, true)
                 where fund == 0 || c.FundId == fund
                 where c.Amount > 0
                 group c by c.CreditGiverId into g
                 where g.Sum(cc => cc.Amount) < amt
                 select g.Key ?? 0;
             break;
         case CompareType.Equal:
             q = from c in Db.Contributions2(start, end, 0, false, false, true)
                 where fund == 0 || c.FundId == fund
                 where c.Amount > 0
                 group c by c.CreditGiverId into g
                 where g.Sum(cc => cc.Amount) == amt
                 select g.Key ?? 0;
             break;
         case CompareType.NotEqual:
             q = from c in Db.Contributions2(start, end, 0, false, false, true)
                 where fund == 0 || c.FundId == fund
                 where c.Amount > 0
                 group c by c.CreditGiverId into g
                 where g.Sum(cc => cc.Amount) != amt
                 select g.Key ?? 0;
             break;
     }
     var tag = Db.PopulateTemporaryTag(q);
     Expression<Func<Person, bool>> pred = p => p.Tags.Any(t => t.Id == tag.Id);
     Expression expr = Expression.Invoke(pred, parm);
     return expr;
 }
开发者ID:rossspoon,项目名称:bvcms,代码行数:65,代码来源:Expressions.cs

示例4: RecentPledgeCount

        internal static Expression RecentPledgeCount(
            ParameterExpression parm, CMSDataContext Db,
            int days,
            int fund,
            CompareType op,
            int cnt)
        {
            if (Db.CurrentUser == null || Db.CurrentUser.Roles.All(rr => rr != "Finance"))
                return AlwaysFalse(parm);

            var now = DateTime.Now;
            var dt = now.AddDays(-days);
            IQueryable<int> q = null;
            switch (op)
            {
                case CompareType.Greater:
                    q = from c in Db.Contributions2(dt, now, 0, true, false, true)
                        where fund == 0 || c.FundId == fund
                        where c.PledgeAmount > 0
                        group c by c.CreditGiverId into g
                        where g.Count() > cnt
                        select g.Key ?? 0;
                    break;
                case CompareType.GreaterEqual:
                    q = from c in Db.Contributions2(dt, now, 0, true, false, true)
                        where fund == 0 || c.FundId == fund
                        where c.PledgeAmount > 0
                        group c by c.CreditGiverId into g
                        where g.Count() >= cnt
                        select g.Key ?? 0;
                    break;
                case CompareType.Less:
                    q = from c in Db.Contributions2(dt, now, 0, true, false, true)
                        where fund == 0 || c.FundId == fund
                        where c.PledgeAmount > 0
                        group c by c.CreditGiverId into g
                        where g.Count() < cnt
                        select g.Key ?? 0;
                    break;
                case CompareType.LessEqual:
                    q = from c in Db.Contributions2(dt, now, 0, true, false, true)
                        where fund == 0 || c.FundId == fund
                        where c.PledgeAmount > 0
                        group c by c.CreditGiverId into g
                        where g.Count() <= cnt
                        select g.Key ?? 0;
                    break;
                case CompareType.Equal:
                    if (cnt == 0) // special case, use different approach
                    {
                        q = from pid in Db.Pledges0(dt, now, fund, 0)
                            select pid.PeopleId;
                        Expression<Func<Person, bool>> pred0 = p => q.Contains(p.PeopleId);
                        Expression expr0 = Expression.Invoke(pred0, parm);
                        return expr0;
                    }
                    q = from c in Db.Contributions2(dt, now, 0, true, false, true)
                        where fund == 0 || c.FundId == fund
                        where c.PledgeAmount > 0
                        group c by c.CreditGiverId into g
                        where g.Count() == cnt
                        select g.Key ?? 0;
                    break;
                case CompareType.NotEqual:
                    q = from c in Db.Contributions2(dt, now, 0, true, false, true)
                        where fund == 0 || c.FundId == fund
                        where c.PledgeAmount > 0
                        group c by c.CreditGiverId into g
                        where g.Count() != cnt
                        select g.Key ?? 0;
                    break;
            }
            var tag = Db.PopulateTemporaryTag(q);
            Expression<Func<Person, bool>> pred = p => p.Tags.Any(t => t.Id == tag.Id);
            Expression expr = Expression.Invoke(pred, parm);
            return expr;
        }
开发者ID:rossspoon,项目名称:bvcms,代码行数:77,代码来源:Expressions.cs

示例5: RecentNewVisitCount

        internal static Expression RecentNewVisitCount(
            ParameterExpression parm,
            CMSDataContext Db,
            int? progid,
            int? divid,
            int? org,
            int orgtype,
            string days0,
            int days,
            CompareType op,
            int cnt)
        {
            var dt1 = DateTime.Today.AddDays(-(days0.ToInt2() ?? 365));
            var dt2 = DateTime.Today.AddDays(-days);

            IQueryable<int> q = null;
            switch (op)
            {
                case CompareType.Greater:
                    q = from p in Db.People
                        let g = from a in p.Attends
                                where org == 0 || a.Meeting.OrganizationId == org
                                where divid == 0 || a.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                where progid == 0 || a.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                where a.AttendanceFlag
                                where a.MeetingDate >= dt1
                                select a
                        where !g.Any(aa => aa.MeetingDate < dt2)
                        where g.Count(aa => aa.MeetingDate > dt2) > cnt
                        select p.PeopleId;
                    break;
                case CompareType.GreaterEqual:
                    q = from p in Db.People
                        let g = from a in p.Attends
                                where org == 0 || a.Meeting.OrganizationId == org
                                where divid == 0 || a.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                where progid == 0 || a.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                where a.AttendanceFlag
                                where a.MeetingDate >= dt1
                                select a
                        where !g.Any(aa => aa.MeetingDate < dt2)
                        where g.Count(aa => aa.MeetingDate > dt2) >= cnt
                        select p.PeopleId;
                    break;
                case CompareType.Less:
                    q = from p in Db.People
                        let g = from a in p.Attends
                                where org == 0 || a.Meeting.OrganizationId == org
                                where divid == 0 || a.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                where progid == 0 || a.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                where a.AttendanceFlag
                                where a.MeetingDate >= dt1
                                select a
                        where !g.Any(aa => aa.MeetingDate < dt2)
                        where g.Count(aa => aa.MeetingDate > dt2) < cnt
                        select p.PeopleId;
                    break;
                case CompareType.LessEqual:
                    q = from p in Db.People
                        let g = from a in p.Attends
                                where org == 0 || a.Meeting.OrganizationId == org
                                where divid == 0 || a.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                where progid == 0 || a.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                where a.AttendanceFlag
                                where a.MeetingDate >= dt1
                                select a
                        where !g.Any(aa => aa.MeetingDate < dt2)
                        where g.Count(aa => aa.MeetingDate > dt2) <= cnt
                        select p.PeopleId;
                    break;
                case CompareType.Equal:
                    q = from p in Db.People
                        let g = from a in p.Attends
                                where org == 0 || a.Meeting.OrganizationId == org
                                where divid == 0 || a.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                where progid == 0 || a.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                where a.AttendanceFlag
                                where a.MeetingDate >= dt1
                                select a
                        where !g.Any(aa => aa.MeetingDate < dt2)
                        where g.Count(aa => aa.MeetingDate > dt2) == cnt
                        select p.PeopleId;
                    break;
                case CompareType.NotEqual:
                    q = from p in Db.People
                        let g = from a in p.Attends
                                where org == 0 || a.Meeting.OrganizationId == org
                                where divid == 0 || a.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                where progid == 0 || a.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                where a.AttendanceFlag
                                where a.MeetingDate >= dt1
                                select a
                        where !g.Any(aa => aa.MeetingDate < dt2)
                        where g.Count(aa => aa.MeetingDate > dt2) != cnt
                        select p.PeopleId;
                    break;
            }
            var tag = Db.PopulateTemporaryTag(q);
            Expression<Func<Person, bool>> pred = p => p.Tags.Any(t => t.Id == tag.Id);
            Expression expr = Expression.Invoke(pred, parm);
//.........这里部分代码省略.........
开发者ID:rossspoon,项目名称:bvcms,代码行数:101,代码来源:Expressions.cs

示例6: 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;
 }
开发者ID:rossspoon,项目名称:bvcms,代码行数:14,代码来源:Expressions.cs

示例7: RecentFirstTimeGiver

        internal static Expression RecentFirstTimeGiver(
            ParameterExpression parm, CMSDataContext Db,
            int days,
            int fund,
            CompareType op,
            bool tf)
        {
            if (Db.CurrentUser == null || Db.CurrentUser.Roles.All(rr => rr != "Finance"))
                return AlwaysFalse(parm);

            var q = from f in Db.FirstTimeGivers(days, fund)
                    select f.PeopleId;

            var tag = Db.PopulateTemporaryTag(q);
            Expression<Func<Person, bool>> pred = p => p.Tags.Any(t => t.Id == tag.Id);
            Expression expr = Expression.Invoke(pred, parm);
            return expr;
        }
开发者ID:rossspoon,项目名称:bvcms,代码行数:18,代码来源:Expressions.cs

示例8: AttendPctHistory

        internal static Expression AttendPctHistory(
           ParameterExpression parm, CMSDataContext Db,
           int? progid,
           int? divid,
           int? org,
           DateTime? start,
           DateTime? end,
           CompareType op,
           double pct)
        {
            if (!end.HasValue)
                end = start.Value;
            end = end.Value.AddDays(1);
            // note: this only works for members because visitors do not have att%
            var now = DateTime.Now;

            var q = from p in Db.People
                    let m = from et in p.EnrollmentTransactions
                            where et.TransactionTypeId <= 3 // things that start a change
                            where et.TransactionStatus == false
                            where et.TransactionDate < end // transaction starts <= looked for end
                            where (et.Pending ?? false) == false
                            where (et.NextTranChangeDate ?? now) >= start // transaction ends >= looked for start
                            where org == 0 || et.OrganizationId == org
                            where divid == 0 || et.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                            where progid == 0 || et.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                            select et
                    where m.Any()
                    select p;
            IQueryable<int> q2 = null;

            switch (op)
            {
                case CompareType.Greater:
                    q2 = from p in q
                         let g = from a in p.Attends
                                 where a.MeetingDate >= start
                                 where a.MeetingDate < end
                                 where org == 0 || a.Meeting.OrganizationId == org
                                 where divid == 0 || a.Meeting.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                 where progid == 0 || a.Meeting.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                 select a
                         let n = g.Count(aa => aa.EffAttendFlag == true)
                         let d = g.Count(aa => aa.EffAttendFlag != null)
                         where (d == 0 ? 0d : n * 100.0 / d) > pct
                         select p.PeopleId;
                    break;
                case CompareType.GreaterEqual:
                    q2 = from p in q
                         let g = from a in p.Attends
                                 where a.MeetingDate >= start
                                 where a.MeetingDate < end
                                 where org == 0 || a.Meeting.OrganizationId == org
                                 where divid == 0 || a.Meeting.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                 where progid == 0 || a.Meeting.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                 select a
                         let n = g.Count(aa => aa.EffAttendFlag == true)
                         let d = g.Count(aa => aa.EffAttendFlag != null)
                         where (d == 0 ? 0d : n * 100.0 / d) >= pct
                         select p.PeopleId;
                    break;
                case CompareType.Less:
                    q2 = from p in q
                         let g = from a in p.Attends
                                 where a.MeetingDate >= start
                                 where a.MeetingDate < end
                                 where org == 0 || a.Meeting.OrganizationId == org
                                 where divid == 0 || a.Meeting.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                 where progid == 0 || a.Meeting.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                 select a
                         let n = g.Count(aa => aa.EffAttendFlag == true)
                         let d = g.Count(aa => aa.EffAttendFlag != null)
                         where (d == 0 ? 0d : n * 100.0 / d) < pct
                         select p.PeopleId;
                    break;
                case CompareType.LessEqual:
                    q2 = from p in q
                         let g = from a in p.Attends
                                 where a.MeetingDate >= start
                                 where a.MeetingDate < end
                                 where org == 0 || a.Meeting.OrganizationId == org
                                 where divid == 0 || a.Meeting.Organization.DivOrgs.Any(dg => dg.DivId == divid)
                                 where progid == 0 || a.Meeting.Organization.DivOrgs.Any(dg => dg.Division.ProgDivs.Any(pg => pg.ProgId == progid))
                                 select a
                         let n = g.Count(aa => aa.EffAttendFlag == true)
                         let d = g.Count(aa => aa.EffAttendFlag != null)
                         where (d == 0 ? 0d : n * 100.0 / d) <= pct
                         select p.PeopleId;
                    break;
                case CompareType.NotEqual:
                case CompareType.Equal:
                    return AlwaysFalse(parm);
            }

            var tag = Db.PopulateTemporaryTag(q2);
            Expression<Func<Person, bool>> pred = p => p.Tags.Any(t => t.Id == tag.Id);

            Expression expr = Expression.Invoke(pred, parm);
            return expr;
        }
开发者ID:rossspoon,项目名称:bvcms,代码行数:100,代码来源:Expressions.cs


注:本文中的CmsData.CMSDataContext.PopulateTemporaryTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。