Exemplo n.º 1
0
        public override linq.Expression <Func <IEvaluationContext, bool> > GetExpression()
        {
            var paramX     = linq.Expression.Parameter(typeof(IEvaluationContext), "x");
            var castOp     = linq.Expression.MakeUnary(linq.ExpressionType.Convert, paramX, typeof(PromotionEvaluationContext));
            var subTotal   = linq.Expression.Constant(SubTotal);
            var methodInfo = typeof(PromotionEvaluationContext).GetMethod("GetTotalWithExcludings");
            var methodCall = linq.Expression.Call(castOp, methodInfo, ExcludingCategoryIds.GetNewArrayExpression(),
                                                  ExcludingProductIds.GetNewArrayExpression(), ExcludingSkuIds.GetNewArrayExpression());

            var binaryOp = ExactlyLeast.IsExactly ? linq.Expression.Equal(methodCall, subTotal) : linq.Expression.GreaterThanOrEqual(methodCall, subTotal);

            var retVal = linq.Expression.Lambda <Func <IEvaluationContext, bool> >(binaryOp, paramX);

            return(retVal);
        }
        //public MatchingContains MatchCondition
        //{
        //	get
        //	{
        //		return _skuEl.MatchingContains;
        //	}
        //}

        //public string MatchConditionValue
        //{
        //	get
        //	{
        //		return _skuEl.MatchingContains.InputValue.ToString();
        //	}
        //	set
        //	{
        //		_skuEl.MatchingContains.InputValue = value;
        //	}
        //}


        public override linq.Expression <Func <IEvaluationContext, bool> > GetExpression()
        {
            var paramX     = linq.Expression.Parameter(typeof(IEvaluationContext), "x");
            var castOp     = linq.Expression.MakeUnary(linq.ExpressionType.Convert, paramX, typeof(PromotionEvaluationContext));
            var methodInfo = typeof(PromotionEvaluationContext).GetMethod("IsItemCodeContains");
            var methodCall = linq.Expression.Call(castOp, methodInfo, linq.Expression.Constant(SkuContains), ExcludingSkuIds.GetNewArrayExpression());

            var retVal = linq.Expression.Lambda <Func <IEvaluationContext, bool> >(methodCall, paramX);

            return(retVal);
        }
Exemplo n.º 3
0
        public override linq.Expression <Func <IEvaluationContext, bool> > GetExpression()
        {
            var paramX          = linq.Expression.Parameter(typeof(IEvaluationContext), "x");
            var castOp          = linq.Expression.MakeUnary(linq.ExpressionType.Convert, paramX, typeof(PromotionEvaluationContext));
            var lineItemTotal   = linq.Expression.Constant(LineItemTotal);
            var methodInfo      = typeof(PromotionEvaluationContext).GetMethod("IsAnyLineItemTotal");
            var equalsOrAtLeast = ExactlyLeast.IsExactly ? linq.Expression.Constant(true) : linq.Expression.Constant(false);
            var methodCall      = linq.Expression.Call(castOp, methodInfo, lineItemTotal, equalsOrAtLeast, ExcludingCategoryIds.GetNewArrayExpression(),
                                                       ExcludingProductIds.GetNewArrayExpression(), ExcludingSkuIds.GetNewArrayExpression());

            var retVal = linq.Expression.Lambda <Func <IEvaluationContext, bool> >(methodCall, paramX);

            return(retVal);
        }
        public override linq.Expression <Func <IEvaluationContext, bool> > GetExpression()
        {
            var paramX     = linq.Expression.Parameter(typeof(IEvaluationContext), "x");
            var castOp     = linq.Expression.MakeUnary(linq.ExpressionType.Convert, paramX, typeof(PromotionEvaluationContext));
            var methodInfo = typeof(PromotionEvaluationContext).GetMethod("GetItemsOfProductQuantity");
            var methodCall = linq.Expression.Call(castOp, methodInfo, linq.Expression.Constant(SelectedItemId), ExcludingSkuIds.GetNewArrayExpression());
            var numItem    = linq.Expression.Constant(NumItem);
            var binaryOp   = ExactlyLeast.IsExactly ? linq.Expression.Equal(methodCall, numItem) : linq.Expression.GreaterThanOrEqual(methodCall, numItem);

            var retVal = linq.Expression.Lambda <Func <IEvaluationContext, bool> >(binaryOp, paramX);

            return(retVal);
        }