internal DynamicExpression(Report rpt, ReportLink p, string expr, Row row)
 {
     _Source=expr;
     _Expr = null;
     _rl = p;
     _Type = DoParse(rpt);
 }
        public object Evaluate(Report rpt, Row row)
        {
            object v = null;
            if (row == null)
                return null;
            bool bSave=true;
            RowEnumerable re = this.GetDataScope(rpt, row, out bSave);
            if (re == null)
                return null;

            Row crow=null;
            bool bNext=false;
            foreach (Row r in re)
            {
                if (bNext)
                {
                    crow = r;
                    break;
                }
                if (r == row)
                    bNext = true;
            }
            if (crow != null)
                v = _Expr.Evaluate(rpt, crow);
            return v;
        }
        public object Evaluate(Report rpt, Row row)
        {
            bool bSave=true;
            IEnumerable re = this.GetDataScope(rpt, row, out bSave);
            if (re == null)
                return null;

            Row startrow=null;
            foreach (Row r in re)
            {
                startrow = r;			// We just want the first row
                break;
            }

            object current_value = _Expr.Evaluate(rpt, row);
            if (row == startrow)
            {}
            else
            {
                object v = GetValue(rpt);
                if (current_value == null)
                    return v;
                else if (v == null)
                {}	// use the current_value
                else if (Filter.ApplyCompare(_tc, v, current_value) < 0)
                {}	// use the current_value
                else
                    return v;
            }
            SetValue(rpt, current_value);
            return current_value;
        }
 // Evaluate is for interpretation  (and is relatively slow)
 public object Evaluate(Report rpt, Row row)
 {
     double d = EvaluateDouble(rpt, row);
     if (d.CompareTo(double.NaN) == 0)
         return null;
     return (object) d;
 }
        //
        public virtual object Evaluate(Report rpt, Row row)
        {
            if (row == null)
                return null;
            Field f;
            string field = _ArgExpr.EvaluateString(rpt, row);
            if (field == null)
                return null;
            f = _Fields[field] as Field;
            if (f == null)
                return null;

            object o;
            if (f.Value != null)
                o = f.Value.Evaluate(rpt, row);
            else
                o = row.Data[f.ColumnNumber];

            if (o == DBNull.Value)
                return null;

            if (f.RunType == TypeCode.String && o is char)	// work around; mono odbc driver confuses string and char
                o = Convert.ChangeType(o, TypeCode.String);

            return o;
        }
        public object Evaluate(Report rpt, Row row)
        {
            bool bSave=true;
            IEnumerable re = this.GetDataScope(rpt, row, out bSave);
            if (re == null)
                return null;

            object v = GetValue(rpt);
            if (v == null)
            {
                object max_value=null;
                object current_value;

                foreach (Row r in re)
                {
                    current_value = _Expr.Evaluate(rpt, r);
                    if (current_value == null)
                        continue;
                    else if (max_value == null)
                        max_value = current_value;
                    else if (Filter.ApplyCompare(_tc, max_value, current_value) < 0)
                        max_value = current_value;
                }
                v = max_value;
                if (bSave)
                    SetValue(rpt, v);
            }
            return v;
        }
        public decimal EvaluateDecimal(Report rpt, Row row)
        {
            double d = EvaluateDouble(rpt, row);
            if (d.CompareTo(double.NaN) == 0)
                return decimal.MinValue;

            return Convert.ToDecimal(d);
        }
        //
        public object Evaluate(Report rpt, Row row)
        {
            double di = _expr[0].EvaluateDouble(rpt, row);
            int i = (int) di;		// force it to integer; we'll accept truncation
            if (i >= _expr.Length || i <= 0)
                return null;

            return _expr[i].Evaluate(rpt, row);
        }
 public bool EvaluateBoolean(Report rpt, Row row)
 {
     object left = _lhs.Evaluate(rpt, row);
     object right = _rhs.Evaluate(rpt, row);
     if (Filter.ApplyCompare(_lhs.GetTypeCode(), left, right) > 0)
         return true;
     else
         return false;
 }
        //
        public virtual object Evaluate(Report rpt, Row row)
        {
            string o = _ArgExpr.EvaluateString(rpt, row);
            if (o == null)
                return null;
            ReportParameter rp = _Parameters[o] as ReportParameter;
            if (rp == null)
                return null;

            return rp.GetRuntimeValue(rpt);
        }
        public int EvaluateInt32(Report rpt, Row row)
        {
            bool bSave=true;
            RowEnumerable re = this.GetDataScope(rpt, row, out bSave);
            if (re == null)
                return 0;

            int count = re.LastRow - re.FirstRow + 1;

            return count;
        }
示例#12
0
        // Evaluate is for interpretation  (and is relatively slow)
        public object Evaluate(Report rpt, Row row)
        {
            bool result = _If.EvaluateBoolean(rpt, row);
            if (result)
                return _IfTrue.Evaluate(rpt, row);

            object o = _IfFalse.Evaluate(rpt, row);
            // We may need to convert IfFalse to same type as IfTrue
            if (_IfTrue.GetTypeCode() == _IfFalse.GetTypeCode())
                return o;

            return Convert.ChangeType(o, _IfTrue.GetTypeCode());
        }
        public double EvaluateDouble(Report rpt, Row row)
        {
            if (row == null || this._Scope == null)
                return 0;

            Grouping g = this._Scope as Grouping;
            if (g == null || g.ParentGroup == null)
                return 0;

            //			GroupEntry ge = row.R.CurrentGroups[g.Index];	// current group entry

            return row.Level;
        }
        //
        public virtual object Evaluate(Report rpt, Row row)
        {
            if (row == null)
                return null;
            Textbox tb;
            string t = _ArgExpr.EvaluateString(rpt, row);
            if (t == null)
                return null;
            tb = _ReportItems[t] as Textbox;
            if (tb == null)
                return null;

            return tb.Evaluate(rpt, row);
        }
示例#15
0
 internal ChartBase(Report r, Row row, Chart c, MatrixCellEntry[,] m, Expression showTooltips, Expression showTooltipsX, Expression _ToolTipYFormat, Expression _ToolTipXFormat)
 {
     _ChartDefn = c;
     _row = row;
     _DataDefn = m;
     _bm = null;
     int width = _ChartDefn.WidthCalc(r, null);
     int height = RSize.PixelsFromPoints(_ChartDefn.HeightOrOwnerHeight);
     Layout = new ChartLayout(width, height);
     _SeriesBrush = null;
     _SeriesMarker = null;
     _showToolTips = showTooltips.EvaluateBoolean(r, row);
     _showToolTipsX = showTooltipsX.EvaluateBoolean(r, row);
     _tooltipYFormat = _ToolTipYFormat.EvaluateString(r, row);
     _tooltipXFormat = _ToolTipXFormat.EvaluateString(r, row);
 }
        // Evaluate is for interpretation  (and is relatively slow)
        public override object Evaluate(Report rpt, Row row)
        {
            string v = base.EvaluateString(rpt, row);

            if (p.ValidValues == null)
                return v;

            string[] displayValues = p.ValidValues.DisplayValues(rpt);
            object[] dataValues = p.ValidValues.DataValues(rpt);

            for (int i=0; i < dataValues.Length; i++)
            {
                if (dataValues[i].ToString() == v)
                    return displayValues[i];
            }

            return v;
        }
        // Evaluate is for interpretation  (and is relatively slow)
        public object Evaluate(Report rpt, Row row)
        {
            bool result;
            for (int i=0; i < _expr.Length; i = i+2)
            {
                result = _expr[i].EvaluateBoolean(rpt, row);
                if (result)
                {
                    object o = _expr[i+1].Evaluate(rpt, row);
                    // We may need to convert to same type as first type
                    if (i == 0 || _tc == _expr[i+1].GetTypeCode())	// first typecode will always match
                        return o;

                    return Convert.ChangeType(o, _tc);
                }
            }

            return null;
        }
 //
 public virtual object Evaluate(Report rpt, Row row)
 {
     if (rpt == null)
         return null;
     string u = _ArgExpr.EvaluateString(rpt, row);
     if (u == null)
         return null;
     switch (u.ToLower())
     {
         case "userid":
             return rpt.UserID;
         case "language":
             return rpt.ClientLanguage == null?
                 CultureInfo.CurrentCulture.ThreeLetterISOLanguageName:
                 rpt.ClientLanguage;
         default:
             return null;
     }
 }
        public object Evaluate(Report rpt, Row row)
        {
            bool bSave=true;
            RowEnumerable re = this.GetDataScope(rpt, row, out bSave);
            if (re == null)
                return null;

            object v = GetValue(rpt);
            if (v == null)
            {
                Row saver=null;
                if (re.Data.Count > 0)
                    saver = re.Data[re.FirstRow] as Row;

                v = _Expr.Evaluate(rpt, saver);
                if (bSave)
                    SetValue(rpt, v);
            }
            return v;
        }
        // Evaluate is for interpretation  (and is relatively slow)
        public object Evaluate(Report rpt, Row row)
        {
            bool bSave = true;
            RowEnumerable re = this.GetDataScope(rpt, row, out bSave);
            if (re == null)
                return null;

            object v = GetValue(rpt);
            if (v == null)
            {
                object temp;
                ArrayList ar = new ArrayList(Math.Max(1,re.LastRow - re.FirstRow + 1));
                foreach (Row r in re)
                {
                    temp = _Expr.Evaluate(rpt, r);
                    ar.Add(temp);
                }

                v = ar;
                if (bSave)
                    SetValue(rpt, v);
            }
            return v;
        }
        public virtual int EvaluateInt32(Report rpt, Row row)
        {
            object rtv = Evaluate(rpt, row);
            if (rtv == null)
                return int.MinValue;

            switch (this.GetTypeCode())
            {
                case TypeCode.Double:
                    return Convert.ToInt32((double)rtv);
                case TypeCode.Decimal:
                    return Convert.ToInt32((decimal)rtv);
                case TypeCode.Object:
                    return int.MinValue;
                case TypeCode.Int32:
                    return (int)rtv;
                case TypeCode.Boolean:
                    return Convert.ToInt32((bool)rtv);
                case TypeCode.String:
                    return Convert.ToInt32((string)rtv);
                case TypeCode.DateTime:
                    return Convert.ToInt32((DateTime)rtv);
                default:
                    return int.MinValue;
            }
        }
        public virtual double EvaluateDouble(Report rpt, Row row)
        {
            object rtv = Evaluate(rpt, row);
            if (rtv == null)
                return Double.NaN;

            switch (this.GetTypeCode())
            {
                case TypeCode.Double:
                    return ((double) rtv);
                case TypeCode.Object:
                    return Double.NaN;
                case TypeCode.Int32:
                    return (double) ((int) rtv);
                case TypeCode.Boolean:
                    return Convert.ToDouble((bool) rtv);
                case TypeCode.String:
                    return Convert.ToDouble((string) rtv);
                case TypeCode.DateTime:
                    return Convert.ToDouble((DateTime) rtv);
                default:
                    return Double.NaN;
            }
        }
示例#23
0
 public decimal EvaluateDecimal(Report rpt, Row row)
 {
     return(decimal.MinValue);
 }
示例#24
0
 public int EvaluateInt32(Report rpt, Row row)
 {
     return(int.MinValue);
 }
 public string EvaluateString(Report rpt, Row row)
 {
     object result = Evaluate(rpt, row);
     return Convert.ToString(result);
 }
 // Evaluate is for interpretation  (and is relatively slow)
 public virtual object Evaluate(Report rpt, Row row)
 {
     return this.p.MultiValue? EvaluateMV(rpt, row): p.GetRuntimeValue(rpt);
 }
        public DateTime EvaluateDateTime(Report rpt, Row row)
        {
            object result = Evaluate(rpt, row);

            return(Convert.ToDateTime(result));
        }
示例#28
0
 public double EvaluateDouble(Report rpt, Row row)
 {
     return(Double.NaN);
 }
 public DateTime EvaluateDateTime(Report rpt, Row row)
 {
     object result = Evaluate(rpt, row);
     return Convert.ToDateTime(result);
 }
        public virtual string EvaluateString(Report rpt, Row row)
        {
            object rtv = this.p.MultiValue ? EvaluateMV(rpt, row) : p.GetRuntimeValue(rpt);
            //            object rtv = Evaluate(rpt, row);
            if (rtv == null)
                return null;

            return rtv.ToString();
        }
        private object EvaluateMV(Report rpt, Row row)
        {
            ArrayList ar = p.GetRuntimeValues(rpt);

            object va = this._arg == null ? null : _arg.Evaluate(rpt, row);

            switch(_type)
            {
                case ReportParameterMethodEnum.Value:
                    return ar;
                case ReportParameterMethodEnum.Contains:
                    return ar.Contains(va);
                case ReportParameterMethodEnum.BinarySearch:
                    return ar.BinarySearch(va);
                case ReportParameterMethodEnum.Count:
                    return ar.Count;
                case ReportParameterMethodEnum.IndexOf:
                    return ar.IndexOf(va);
                case ReportParameterMethodEnum.LastIndexOf:
                    return ar.LastIndexOf(va);
                case ReportParameterMethodEnum.Index:
                    int i = Convert.ToInt32(va);
                    return ar[i];
                default:
                    throw new Exception("Internal error: unknown Report Parameter method");
            }
        }
示例#32
0
 public bool EvaluateBoolean(Report rpt, Row row)
 {
     return(!_rhs.EvaluateBoolean(rpt, row));
 }
 public int EvaluateInt32(Report rpt, Row row)
 {
     object result = Evaluate(rpt, row);
     return Convert.ToInt32(result);
 }
示例#34
0
 public DateTime EvaluateDateTime(Report rpt, Row row)
 {
     return(DateTime.MinValue);
 }
 // Evaluate is for interpretation  (and is relatively slow)
 public object Evaluate(Report rpt, Row row)
 {
     return _tc==TypeCode.Decimal? (object) EvaluateDecimal(rpt, row): (object) EvaluateDouble(rpt, row);
 }
示例#36
0
        public string EvaluateString(Report rpt, Row row)
        {
            bool result = EvaluateBoolean(rpt, row);

            return(result.ToString());
        }
        public decimal EvaluateDecimal(Report rpt, Row row)
        {
            bool bSave;
            IEnumerable re = this.GetDataScope(rpt, row, out bSave);
            if (re == null)
                return decimal.MinValue;

            Row startrow=null;
            foreach (Row r in re)
            {
                startrow = r;			// We just want the first row
                break;
            }

            WorkClass wc = GetValue(rpt);
            decimal currentValue = _Expr.EvaluateDecimal(rpt, row);
            if (row == startrow)
            {
                // must be the start of a new group
                wc.Value = currentValue;
            }
            else
                wc.Value = ((decimal) wc.Value + currentValue);

            return (decimal) wc.Value;
        }
示例#38
0
 // Evaluate is for interpretation  (and is relatively slow)
 public object Evaluate(Report rpt, Row row)
 {
     return(EvaluateBoolean(rpt, row));
 }