Ejemplo n.º 1
0
		public double EvaluateDouble(Report rpt, Row row)
		{
			bool bSave=true;
			IEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return double.NaN;

			ODouble v = GetValueDouble(rpt);
			if (v != null)
				return v.d;

			double sum=0;
			int count=0;
			double temp;
			foreach (Row r in re)
			{
				temp = _Expr.EvaluateDouble(rpt, r);
				if (temp.CompareTo(double.NaN) != 0)
				{
					sum += temp;
					count++;
				}
			}
			double result;
			if (count > 0)
				result = (sum/count);
			else
				result = double.NaN;

			if (bSave)
				SetValue(rpt, result);

			return result;
		}
Ejemplo n.º 2
0
		public string EvaluateString(Report rpt, Row row)
		{
			if (rpt == null || rpt.UserID == null)
				return Environment.UserName;
			else
				return rpt.UserID;
		}
Ejemplo n.º 3
0
		public int EvaluateInt32(Report rpt, Row row)
		{
			bool bSave=true;
			IEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return int.MinValue;

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

			int count;

			object currentValue = _Expr.Evaluate(rpt, row);
			int incr = currentValue == null? 0: 1;
			if (row == startrow)
			{
				// must be the start of a new group
				count = incr;
			}
			else
			{
				count = GetValue(rpt) + incr;
			}

			SetValue(rpt, count);
			return count;
		}
		public double EvaluateDouble(Report rpt, Row row)
		{
			bool bSave=true;
			RowEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return 0;

			int v = GetValue(rpt);
			if (v < 0)
			{
				object temp;
				int count = Math.Max(2, re.LastRow - re.FirstRow);
				Hashtable ht = new Hashtable(count);
				foreach (Row r in re)
				{
					temp = _Expr.Evaluate(rpt, r);
					if (temp != null)
					{
						object o = ht[temp];	// search for it
						if (o == null)			// if not found; add it to the hash table
						{
							ht.Add(temp, temp);
						}
					}
				}
				v = ht.Count;
				if (bSave)
					SetValue(rpt, v);
			}
			return (double) v;
		}
Ejemplo n.º 5
0
		internal DynamicExpression(Report rpt, ReportLink p, string expr, Row row)
		{
			_Source=expr;
			_Expr = null;
            _rl = p;
            _Type = DoParse(rpt);
		}
Ejemplo n.º 6
0
		public double EvaluateDouble(Report rpt, Row row)
		{
			bool bSave=true;
			IEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return 0;

			int v = GetValue(rpt);
			if (v < 0)
			{
				object temp;
				int count=0;
				foreach (Row r in re)
				{
					temp = _Expr.Evaluate(rpt, r);
					if (temp != null)
					{
						count++;
					}
				}
				v = count;

				if (bSave)
					SetValue(rpt, v);
			}
			return (double) v;
		}
Ejemplo n.º 7
0
		internal void RunPage(Pages pgs, Row row)
		{
			// Start each row in the same location
			//   e.g. if there are two embedded tables in cells they both start at same location
			Page savepg = pgs.CurrentPage;
			float savey = savepg.YOffset;
			Page maxpg = savepg;
			float maxy = savey;

			foreach (TableCell tc in _Items)
			{
				tc.RunPage(pgs, row);
				if (maxpg != pgs.CurrentPage)
				{	// a page break
					if (maxpg.PageNumber < pgs.CurrentPage.PageNumber)
					{
						maxpg = pgs.CurrentPage;
						maxy = maxpg.YOffset;
					}
				}
				else if (maxy > pgs.CurrentPage.YOffset)
				{
					// maxy = maxy;      TODO what was this meant to do
				}
				// restore the beginning start of the row
				pgs.CurrentPage = savepg;
				savepg.YOffset = savey;
			}
			pgs.CurrentPage = maxpg;
			savepg.YOffset = maxy;
			return ;
		}
		public double EvaluateDouble(Report rpt, Row row)
		{
			bool bSave=true;
			IEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return double.NaN;

			Row startrow=null;
			foreach (Row r in re)
			{
				startrow = r;			// We just want the first row
				break;
			}
			double currentValue = _Expr.EvaluateDouble(rpt, row);
			WorkClass wc = GetValue(rpt);
			if (row == startrow)
			{
				// must be the start of a new group
				wc.Value = currentValue;
				wc.Count = 1;
			}
			else
			{
				wc.Value = ((double) wc.Value + currentValue);
				wc.Count++;
			}

			return (double) wc.Value / wc.Count;
		}
		// 
		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;
		}
Ejemplo n.º 10
0
		public string EvaluateString(Report rpt, Row row)
		{
			if (rpt == null || rpt.ClientLanguage == null)
				return CultureInfo.CurrentCulture.ThreeLetterISOLanguageName;
			else
				return rpt.ClientLanguage;
		}
Ejemplo n.º 11
0
		// 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;
		}
Ejemplo n.º 12
0
		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 v = GetValue(rpt);
			object current_value = _Expr.Evaluate(rpt, row);
			if (row == startrow)
			{}
			else
			{
				if (current_value == null)
					return v;
				else if (v == null)
				{}
				else if (Filter.ApplyCompare(_tc, v, current_value) > 0)
				{}
				else
					return v;
			}
			SetValue(rpt, current_value);
			return current_value;
		}
Ejemplo n.º 13
0
		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;
		}
Ejemplo n.º 14
0
		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 || (current_value is double && double.IsNaN((double)current_value)))
						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;
		}
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
		internal void Run(IPresent ip, Row row)
		{
			foreach (TableRow t in _Items)
			{
				t.Run(ip, row);
			}
			return;
		}
Ejemplo n.º 17
0
		internal void Run(IPresent ip, Row row)
		{
			foreach (TableCell tc in _Items)
			{
				tc.Run(ip, row);
			}
			return ;
		}
Ejemplo n.º 18
0
		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;
		}
Ejemplo n.º 19
0
		// 
		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);
		}
Ejemplo n.º 20
0
		// 
		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);
		}
Ejemplo n.º 21
0
		internal bool Apply(Report rpt, Row datarow)
		{
			foreach (Filter f in _Items)
			{
				if (!f.FilterOperatorSingleRow)		// have to handle Top/Bottom in ApplyFinalFilters
					return true;
				if (!f.Apply(rpt, datarow))
					return false;
			}
			return true;
		}
		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;
		}
Ejemplo n.º 23
0
		override internal void RunPage(Pages pgs, Row row)
		{
			Report r = pgs.Report;
            bool bHidden = IsHidden(r, row);

			SetPagePositionBegin(pgs);
			PageLine pl = new PageLine();
            SetPagePositionAndStyle(r, pl, row);
            if (!bHidden)
			    pgs.CurrentPage.AddObject(pl);
			SetPagePositionEnd(pgs, pl.Y);
		}
Ejemplo n.º 24
0
		protected Row _row;					// row chart created on

		internal ChartBase(Report r, Row row, Chart c, MatrixCellEntry[,] m)
		{
			_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;
		}
Ejemplo n.º 25
0
		internal void RunPage(Pages pgs, Row row)
		{

			Page p = pgs.CurrentPage;
			if (p.YOffset + HeightOfRows(pgs, row) > pgs.BottomOfPage)
			{
				p = OwnerTable.RunPageNew(pgs, p);
				OwnerTable.RunPageHeader(pgs, row, false, null);
			}
			_TableRows.RunPage(pgs, row);

			return;
		}
Ejemplo n.º 26
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());
		}
Ejemplo n.º 27
0
		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);
		}
Ejemplo n.º 29
0
 internal ChartBase(Report r, Row row, Chart c, MatrixCellEntry[,] m, Expression showTooltips, Expression showTooltipsX, Expression _ToolTipYFormat, Expression _ToolTipXFormat)
 {
     this._ChartDefn = c;
       this._row = row;
       this._DataDefn = m;
       this._bm = null;
       int width = this._ChartDefn.WidthCalc(r, null);
       int height = RSize.PixelsFromPoints(this._ChartDefn.HeightOrOwnerHeight);
       this.Layout = new ChartLayout(width, height);
       this._SeriesBrush = null;
       this._SeriesMarker = null;
       this._showToolTips = showTooltips.EvaluateBoolean(r, row);
       this._showToolTipsX = showTooltipsX.EvaluateBoolean(r, row);
       this._tooltipYFormat = _ToolTipYFormat.EvaluateString(r, row);
       this._tooltipXFormat = _ToolTipXFormat.EvaluateString(r, row);
 }
Ejemplo n.º 30
0
		// Evaluate is for interpretation  (and is relatively slow)
		public object Evaluate(Report rpt, Row row)
		{
			// get the results
			object[] argResults = new object[_Args.Length];
			int i=0;
            bool bNull = false;
			foreach(IExpr a  in _Args)
			{
				argResults[i] = a.Evaluate(rpt, row);
                if (argResults[i] == null)
                    bNull = true;
                i++;
			}
			Type[] argTypes;
            if (bNull)
            {
                // Need to put fake values in that match the types
                object[] tempResults = new object[argResults.Length];
                for (int ix = 0; ix < argResults.Length; ix++)
                {
                    tempResults[ix] =
                        argResults[ix] == null?
                            XmlUtil.GetConstFromTypeCode(_Args[ix].GetTypeCode()):
                            argResults[ix];

                }
                argTypes = Type.GetTypeArray(tempResults);
            }
            else
                argTypes = Type.GetTypeArray(argResults);

			// We can definitely optimize this by caching some info TODO

			// Get ready to call the function
			object returnVal;
			Type theClassType= Type.GetType(_Cls, true, true);
            MethodInfo mInfo = XmlUtil.GetMethod(theClassType, _Func, argTypes);
            if (mInfo == null)
            {
                throw new Exception(string.Format(Strings.FunctionSystem_Error_MethodNotFound, _Func, _Cls));
            }

            returnVal = mInfo.Invoke(theClassType, argResults);

			return returnVal;
		}
Ejemplo n.º 31
0
 // 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));
 }
Ejemplo n.º 32
0
        public decimal EvaluateDecimal(Report rpt, Row row)
        {
            double d = EvaluateDouble(rpt, row);

            return(Convert.ToDecimal(d));
        }
Ejemplo n.º 33
0
        public double EvaluateDouble(Report rpt, Row row)
        {
            string result = EvaluateString(rpt, row);

            return(Convert.ToDouble(result));
        }
Ejemplo n.º 34
0
        public string EvaluateString(Report rpt, Row row)
        {
            object result = Evaluate(rpt, row);

            return(Convert.ToString(result));
        }
Ejemplo n.º 35
0
 public string EvaluateString(Report rpt, Row row)
 {
     return(Convert.ToString(Evaluate(rpt, row)));
 }
Ejemplo n.º 36
0
 public double EvaluateDouble(Report rpt, Row row)
 {
     return(Convert.ToDouble(Evaluate(rpt, row)));
 }
Ejemplo n.º 37
0
        public bool EvaluateBoolean(Report rpt, Row row)
        {
            string result = EvaluateString(rpt, row);

            return(Convert.ToBoolean(result));
        }
Ejemplo n.º 38
0
 public int EvaluateInt32(Report rpt, Row row)
 {
     return(Convert.ToInt32(Evaluate(rpt, row)));
 }
Ejemplo n.º 39
0
        public string EvaluateString(Report rpt, Row row)
        {
            decimal result = EvaluateDecimal(rpt, row);

            return(result.ToString());
        }
Ejemplo n.º 40
0
 // Evaluate is for interpretation  (and is relatively slow)
 public object Evaluate(Report rpt, Row row)
 {
     return((object)EvaluateDouble(rpt, row));
 }
Ejemplo n.º 41
0
 public bool EvaluateBoolean(Report rpt, Row row)
 {
     return(false);
 }
Ejemplo n.º 42
0
        public int EvaluateInt32(Report rpt, Row row)
        {
            decimal result = EvaluateDecimal(rpt, row);

            return(Convert.ToInt32(result));
        }
Ejemplo n.º 43
0
 // Evaluate is for interpretation  (and is relatively slow)
 public object Evaluate(Report rpt, Row row)
 {
     return(EvaluateString(rpt, row));
 }
Ejemplo n.º 44
0
 public bool EvaluateBoolean(Report rpt, Row row)
 {
     return(Convert.ToBoolean(Evaluate(rpt, row)));
 }
Ejemplo n.º 45
0
        public int EvaluateInt32(Report rpt, Row row)
        {
            double result = EvaluateDouble(rpt, row);

            return(Convert.ToInt32(result));
        }
Ejemplo n.º 46
0
 public DateTime EvaluateDateTime(Report rpt, Row row)
 {
     return(Convert.ToDateTime(Evaluate(rpt, row)));
 }
Ejemplo n.º 47
0
        public DateTime EvaluateDateTime(Report rpt, Row row)
        {
            string result = EvaluateString(rpt, row);

            return(Convert.ToDateTime(result));
        }
Ejemplo n.º 48
0
        public DateTime EvaluateDateTime(Report rpt, Row row)
        {
            object result = Evaluate(rpt, row);

            return(Convert.ToDateTime(result));
        }
Ejemplo n.º 49
0
 // Evaluate is for interpretation
 public object Evaluate(Report rpt, Row row)
 {
     return(rpt == null ? (int)0 : (int)rpt.PageNumber);
 }
Ejemplo n.º 50
0
        public decimal EvaluateDecimal(Report rpt, Row row)
        {
            string result = EvaluateString(rpt, row);

            return(Convert.ToDecimal(result));
        }
Ejemplo n.º 51
0
        public bool EvaluateBoolean(Report rpt, Row row)
        {
            decimal result = EvaluateDecimal(rpt, row);

            return(Convert.ToBoolean(result));
        }
Ejemplo n.º 52
0
        public string EvaluateString(Report rpt, Row row)
        {
            double result = EvaluateDouble(rpt, row);

            return(Convert.ToString(result));
        }
Ejemplo n.º 53
0
 public int EvaluateInt32(Report rpt, Row row)
 {
     return(rpt == null ? 0 : rpt.PageNumber);
 }
Ejemplo n.º 54
0
        public int EvaluateInt32(Report rpt, Row row)
        {
            object result = Evaluate(rpt, row);

            return(Convert.ToInt32(result));
        }
Ejemplo n.º 55
0
        public DateTime EvaluateDateTime(Report rpt, Row row)
        {
            decimal result = EvaluateDecimal(rpt, row);

            return(Convert.ToDateTime(result));
        }
Ejemplo n.º 56
0
 public double EvaluateDouble(Report rpt, Row row)
 {
     return(rpt == null? 0: rpt.PageNumber);
 }
Ejemplo n.º 57
0
        public double EvaluateDouble(Report rpt, Row row)
        {
            object result = Evaluate(rpt, row);

            return(Convert.ToDouble(result));
        }
Ejemplo n.º 58
0
 public decimal EvaluateDecimal(Report rpt, Row row)
 {
     return(Convert.ToDecimal(Evaluate(rpt, row)));
 }
Ejemplo n.º 59
0
        public decimal EvaluateDecimal(Report rpt, Row row)
        {
            object result = Evaluate(rpt, row);

            return(Convert.ToDecimal(result));
        }
Ejemplo n.º 60
0
        public double EvaluateDouble(Report rpt, Row row)
        {
            decimal result = EvaluateDecimal(rpt, row);

            return(Convert.ToDouble(result));
        }