Example #1
0
 private static IEnumerable <Message> ApplyOrFilter(MsgFilterObj filterObj)
 {
     return(filterObj.Messages.Where(msg => CheckUser(msg, filterObj.User) ||
                                     (filterObj.MessageText != null && filterObj.MessageText != string.Empty && msg.Text.Contains(filterObj.MessageText, StringComparison.OrdinalIgnoreCase)) ||
                                     (filterObj.StartTime != null && filterObj.StartTime <= msg.ReceivingTime) ||
                                     (filterObj.EndTime != null && filterObj.EndTime <= msg.ReceivingTime)));
 }
Example #2
0
 private static IEnumerable <Message> ApplyAndFilter(MsgFilterObj filterObj)
 {
     return(filterObj.Messages.Where(msg => CheckUser(msg, filterObj.User) &&
                                     (filterObj.MessageText == null || filterObj.MessageText == string.Empty || msg.Text.Contains(filterObj.MessageText, StringComparison.OrdinalIgnoreCase)) &&
                                     (filterObj.StartTime == null || filterObj.StartTime <= msg.ReceivingTime) &&
                                     (filterObj.EndTime == null || filterObj.EndTime >= msg.ReceivingTime)));
 }
Example #3
0
        public static IEnumerable <Message> ApplyFilter(MsgFilterObj filterObj)
        {
            if (filterObj.UseAndForCond)
            {
                return(ApplyAndFilter(filterObj));
            }

            return(ApplyOrFilter(filterObj));
        }