Exemple #1
0
 /// <summary>
 /// Used to define extra where clause for derivative contract items search
 /// </summary>
 /// <param name="evaluationContext"></param>
 /// <returns></returns>
 protected virtual Expression <Func <DerivativeContractItemEntity, bool> > GetQueryPredicate(DerivativeContractInfoEvaluationContext evaluationContext)
 {
     if (!evaluationContext.StartDateRanges.IsNullOrEmpty())
     {
         var predicate = PredicateBuilder.False <DerivativeContractItemEntity>();
         predicate = PredicateBuilder.Or(predicate, ((Expression <Func <DerivativeContractItemEntity, DateTime?> >)(dci => dci.DerivativeContract.StartDate)).IsInRanges(evaluationContext.StartDateRanges));
         return(predicate.Expand());
     }
     if (!evaluationContext.EndDateRanges.IsNullOrEmpty())
     {
         var predicate = PredicateBuilder.False <DerivativeContractItemEntity>();
         predicate = PredicateBuilder.Or(predicate, ((Expression <Func <DerivativeContractItemEntity, DateTime?> >)(dci => dci.DerivativeContract.EndDate)).IsInRanges(evaluationContext.EndDateRanges));
         return(predicate.Expand());
     }
     return(PredicateBuilder.True <DerivativeContractItemEntity>());
 }
Exemple #2
0
 /// <summary>
 /// Used to define extra where clause for derivative contract items search
 /// </summary>
 /// <param name="startDateRange"></param>
 /// <param name="endDateRange"></param>
 /// <returns></returns>
 protected virtual Expression <Func <DerivativeContractItemEntity, bool> > GetEvaluationPredicate(DateTimeRange startDateRange, DateTimeRange endDateRange)
 {
     if (startDateRange != null || endDateRange != null)
     {
         var predicate = PredicateBuilder.False <DerivativeContractItemEntity>();
         if (startDateRange != null)
         {
             predicate = PredicateBuilder.Or(predicate, ((Expression <Func <DerivativeContractItemEntity, DateTime?> >)(dci => dci.DerivativeContract.StartDate)).IsInRange(startDateRange));
         }
         if (endDateRange != null)
         {
             predicate = PredicateBuilder.Or(predicate, ((Expression <Func <DerivativeContractItemEntity, DateTime?> >)(dci => dci.DerivativeContract.EndDate)).IsInRange(endDateRange));
         }
         return(predicate.Expand());
     }
     return(PredicateBuilder.True <DerivativeContractItemEntity>());
 }
 /// <summary>
 /// Used to define extra where clause for derivative contract items search
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 protected virtual Expression <Func <DerivativeContractItemEntity, bool> > GetQueryPredicate(DerivativeContractItemSearchCriteria criteria)
 {
     if (!criteria.StartDateRanges.IsNullOrEmpty() || !criteria.EndDateRanges.IsNullOrEmpty())
     {
         var predicate = PredicateBuilder.False <DerivativeContractItemEntity>();
         if (!criteria.StartDateRanges.IsNullOrEmpty())
         {
             predicate = PredicateBuilder.Or(predicate, ((Expression <Func <DerivativeContractItemEntity, DateTime?> >)(dci => dci.DerivativeContract.StartDate)).IsInRanges(criteria.StartDateRanges));
         }
         if (!criteria.EndDateRanges.IsNullOrEmpty())
         {
             predicate = PredicateBuilder.Or(predicate, ((Expression <Func <DerivativeContractItemEntity, DateTime?> >)(dci => dci.DerivativeContract.EndDate)).IsInRanges(criteria.EndDateRanges));
         }
         return(predicate.Expand());
     }
     return(PredicateBuilder.True <DerivativeContractItemEntity>());
 }