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))); }
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))); }
public static IEnumerable <Message> ApplyFilter(MsgFilterObj filterObj) { if (filterObj.UseAndForCond) { return(ApplyAndFilter(filterObj)); } return(ApplyOrFilter(filterObj)); }