Esempio n. 1
0
        public virtual string EvaluateFormula(string formula, BaseRecord dataSourceForEvaluate, string format)
        {
            Data.BaseFormulaEvaluator e = new Data.BaseFormulaEvaluator();

            // All variables referred to in the formula are expected to be
            // properties of the DataSource.  For example, referring to
            // UnitPrice as a variable will refer to DataSource.UnitPrice
            e.DataSource = dataSourceForEvaluate;

            Object resultObj = e.Evaluate(formula);

            if (resultObj == null)
            {
                return("");
            }
            return(resultObj.ToString());
        }
        public virtual string EvaluateFormula(string formula, BaseRecord  dataSourceForEvaluate, string format)
        {
            Data.BaseFormulaEvaluator e = new Data.BaseFormulaEvaluator();

            // All variables referred to in the formula are expected to be
            // properties of the DataSource.  For example, referring to
            // UnitPrice as a variable will refer to DataSource.UnitPrice
            e.DataSource = dataSourceForEvaluate;

            Object resultObj = e.Evaluate(formula);
            if(resultObj == null)
            return "";
            return resultObj.ToString();
        }