We are currently using k2 blackpearl 4.5 and do have plans to upgrade to the latest very soon, but before we can do that I have a problem to solve for this particular version. We are using SourceCode.Workflow.Client.Connection.OpenWorklist(WorklistCriteria) to find our items. The problem is that it does not behave in a way I expected. I do know that we have an item with the date, 2013/09/26 11:28:37 AM (originally stored as UTC), and I'm using 2013/09/26 11:28:38 AM UTC in a filter. This unfortunately does not return the item so I wrote a quick unit test to understand it a bit more.
WorklistCriteria criteria = new WorklistCriteria();
criteria.AddFilterField(WCLogical.And, WCField.ProcessData, "MyDateField", WCCompare.Less, new DateTime(2013, 09, 26, 11, 28, 38, DateTimeKind.Utc));
Worklist filteredItems = connection.OpenWorklist(criteria);
Worklist allItems = connection.OpenWorklist(new WorklistCriteria());
Assert.AreEqual(allItems.Count, filteredItems.Count);
The unit test resulted in a failure:
Expected: 1
But was: 0
When I change the 'WCCompare.Less' to 'WCCompare.Greater' it works but seems counter-intuitive.
What am I doing wrong?