Ejemplo n.º 1
0
 private object GetPredicateValue(TodoQueryPredicate predicate)
 {
     if (predicate.Operand == QueryOperand.Important)
     {
         return(predicate.BoolValue ?? false);
     }
     else if (predicate.Operand == QueryOperand.DueDate)
     {
         return(ResolveTargetDate(predicate));
     }
     else if (predicate.Operand == QueryOperand.Done)
     {
         return(predicate.BoolValue ?? false);
     }
     else
     {
         throw new InvalidOperationException("Invalid operand.");
     }
 }
Ejemplo n.º 2
0
 private DateTime?ResolveTargetDate(TodoQueryPredicate predicate)
 {
     if (!predicate.RelativeDateValue.HasValue)
     {
         if (!predicate.AbsoluteDateValue.HasValue)
         {
             return(null);
         }
         else
         {
             return(predicate.AbsoluteDateValue.Value.Date);
         }
     }
     else
     {
         DateTime date = DateTime.UtcNow;
         date = new DateTime(date.Year, date.Month, date.Day + predicate.RelativeDateValue.Value);
         DateTime.SpecifyKind(date, DateTimeKind.Utc);
         return(date.Date);
     }
 }