Ejemplo n.º 1
0
        public decimal CalculateBasePrice(Calculation calculation)
        {
            var(paramDefinitions, values) = calculation.ToCalculationParams();

            return((decimal) new Interpreter()
                   .Parse(BasePriceFormula, paramDefinitions.ToArray())
                   .Invoke(values.ToArray()));
        }
        public bool Applies(Calculation calculation)
        {
            if (IsNullOrEmpty(ApplyIfFormula))
            {
                return(true);
            }

            var(paramDefinitions, values) = calculation.ToCalculationParams();
            return((bool)new Interpreter()
                   .Parse(ApplyIfFormula, paramDefinitions.ToArray())
                   .Invoke(values.ToArray()));
        }