private static HqlProjectionQuery BuildSentQuery(Notebox notebox, INoteboxQueryContext nqc, bool countQuery) { var query = GetBaseQuery(nqc, countQuery, "n", typeof(Note), SentItemProjection, SentItemsJoins); var or = new HqlOr(); foreach (var criteria in notebox.GetInvariantCriteria(nqc)) { var and = new HqlAnd(); // for sent items, IsAcknowledged means fully acknowledged (all readers have acknowledged) and.Conditions.Add(new HqlCondition("n.IsFullyAcknowledged = ?", criteria.IsAcknowledged)); if (criteria.SentByMe) { and.Conditions.Add(new HqlCondition("n.Author = ?", nqc.Staff)); } or.Conditions.Add(and); } query.Conditions.Add(or); query.Conditions.Add(new HqlCondition("n.HasPostings = ?", true)); if (!countQuery) { query.Sorts.AddRange(SentItemOrdering); } return(query); }
private static HqlProjectionQuery BuildInboxQuery(Notebox notebox, INoteboxQueryContext nqc, bool countQuery) { var query = GetBaseQuery(nqc, countQuery, "np", typeof(NotePosting), InboxItemProjection, InboxItemsJoins); var or = new HqlOr(); foreach (var criteria in notebox.GetInvariantCriteria(nqc)) { var and = new HqlAnd(); and.Conditions.Add(new HqlCondition("np.IsAcknowledged = ?", criteria.IsAcknowledged)); if (criteria.SentToMe) { and.Conditions.Add(new HqlCondition("np.Recipient = ?", nqc.Staff)); } if (criteria.SentToGroupIncludingMe) { and.Conditions.Add(new HqlCondition("np.Recipient = ?", nqc.StaffGroup)); } or.Conditions.Add(and); } query.Conditions.Add(or); //query.Conditions.Add(ConditionMostRecentNote); if (!countQuery) { query.Sorts.AddRange(InboxItemOrdering); } return(query); }
private static HqlProjectionQuery BuildSentQuery(Notebox notebox, INoteboxQueryContext nqc, bool countQuery) { var query = GetBaseQuery(nqc, countQuery, "n", typeof(Note), SentItemProjection, SentItemsJoins); var or = new HqlOr(); foreach (var criteria in notebox.GetInvariantCriteria(nqc)) { var and = new HqlAnd(); // for sent items, IsAcknowledged means fully acknowledged (all readers have acknowledged) and.Conditions.Add(new HqlCondition("n.IsFullyAcknowledged = ?", criteria.IsAcknowledged)); if (criteria.SentByMe) and.Conditions.Add(new HqlCondition("n.Author = ?", nqc.Staff)); or.Conditions.Add(and); } query.Conditions.Add(or); query.Conditions.Add(new HqlCondition("n.HasPostings = ?", true)); if (!countQuery) query.Sorts.AddRange(SentItemOrdering); return query; }
private static HqlProjectionQuery BuildInboxQuery(Notebox notebox, INoteboxQueryContext nqc, bool countQuery) { var query = GetBaseQuery(nqc, countQuery, "np", typeof(NotePosting), InboxItemProjection, InboxItemsJoins); var or = new HqlOr(); foreach (var criteria in notebox.GetInvariantCriteria(nqc)) { var and = new HqlAnd(); and.Conditions.Add(new HqlCondition("np.IsAcknowledged = ?", criteria.IsAcknowledged)); if (criteria.SentToMe) and.Conditions.Add(new HqlCondition("np.Recipient = ?", nqc.Staff)); if (criteria.SentToGroupIncludingMe) and.Conditions.Add(new HqlCondition("np.Recipient = ?", nqc.StaffGroup)); or.Conditions.Add(and); } query.Conditions.Add(or); //query.Conditions.Add(ConditionMostRecentNote); if (!countQuery) query.Sorts.AddRange(InboxItemOrdering); return query; }
public int CountSentItems(Notebox notebox, INoteboxQueryContext nqc) { var query = BuildSentQuery(notebox, nqc, true); return DoQueryCount(query); }
public IList GetSentItems(Notebox notebox, INoteboxQueryContext nqc) { var query = BuildSentQuery(notebox, nqc, false); return DoQuery(query); }
public int CountSentItems(Notebox notebox, INoteboxQueryContext nqc) { var query = BuildSentQuery(notebox, nqc, true); return(DoQueryCount(query)); }
public IList GetSentItems(Notebox notebox, INoteboxQueryContext nqc) { var query = BuildSentQuery(notebox, nqc, false); return(DoQuery(query)); }