Criteria List

Criteria List

Old forum URL: forums.lhotka.net/forums/t/1625.aspx


tengtium posted on Sunday, October 29, 2006

i'm new to csla... is it possible that the list collection have a criteria like all object within the collection in date range...

guyroch replied on Monday, October 30, 2006

Can you be at bit more specific, I can't make out what you are asking :( so its hard to give you an answer.

Brian Criswell replied on Monday, October 30, 2006

Yes it can have a Criteria object as well.  Create the criteria the same as you would for an object and give it properties for min and max dates.  Then use the values to retrieve all items between those dates from your data source.

david.wendelken replied on Monday, October 30, 2006

 

Use SmartDates for the min and max values in the Criteria Class.

There is a boolean flag in the constructor that says whether to evaluate a null date as the earliest or latest possible date.  Start date needs the boolean set one way, end date the other.

#region Data Access

[Serializable()]

private class Criteria
{
   // defaults to earliest possible date.
   private SmartDate _dateFrom = new SmartDate("", true);
   // defaults to latest possible date.
   private SmartDate _dateTo = new SmartDate("", false);

   public SmartDate DateFrom
   {
      
get { return _dateFrom; }
   }

   public SmartDate DateTo
   {
      
get { return _dateTo; }
   }

   public Criteria()
   { }

   public Criteria(SmartDate dateFrom, SmartDate dateTo)
   {
      _dateFrom = dateFrom;
      _dateTo = dateTo;
   }
}

hth,

david

Copyright (c) Marimer LLC