public Token(BEQuickReports.tbl_TokensRow row, string companyColumnAlias)
		{
			_TokenID = row.TokenID;
			_TokenAlias = row.TokenAlias.Replace('_',' '); //.Replace added, part of bug fix 20090603 - hs;
			_CompanyColumnAlias = companyColumnAlias;
			_DataType = (QuickReport.DataTypes) row.DataTypeID;
			_TokenType = QuickReport.TokenTypes.Regular;
		}
		public Token(BEQuickReports.tbl_GeneratedReportTokensRow row, string companyColumnAlias)
		{
			_TokenID = row.TokenID;
			_TokenAlias = row.TokenAlias.Replace('_',' '); //.Replace added, part of bug fix 20090603 - hs;
			_CompanyColumnAlias = companyColumnAlias;
			_Hidden = (row.TokenType == Convert.ToInt32(QuickReport.TokenTypes.Hidden));
			_TokenOrder = row.TokenOrder;
			switch(row.TokenSort)
			{
				case 0:
				{
					SortBy = false;
					SortDirection = "asc";
					break;
				}
				case 1:
				{
					SortBy = true;
					SortDirection = "asc";
					break;
				}
				case 2:
				{
					SortBy = true;
					SortDirection = "desc";
					break;
				}
			}
			_DataType = (QuickReport.DataTypes) row.DataTypeID;
			_TokenType = (QuickReport.TokenTypes) row.TokenType;
			if (! row.IsTokenFilterNull())
			{
				_Function = row.TokenFilter;
				string Expression = row.TokenFilterExpression.Replace("'","").Replace(" AND ","|");
			
				switch(_DataType)
				{
					case QuickReport.DataTypes.DateTime:
					{
						if (Function == "between")
						{
							DateFrom = Convert.ToDateTime(Expression.Split('|')[0]);
							DateTo = Convert.ToDateTime(Expression.Split('|')[1]);
						}
						else
						{
							SingleDate = Convert.ToDateTime(Expression);
						}
						break;
					}
					case QuickReport.DataTypes.Boolean:
					{
						ActiveValue = Expression;
						break;
					}
					case QuickReport.DataTypes.Integer:
					case QuickReport.DataTypes.String:
					{
						if (Function == "between")
						{
							strFrom = Expression.Split('|')[0];
							strTo = Expression.Split('|')[1];
						}
						else
						{
							SingleText = Expression;
						}
						break;		
					}
				}
			}
		}
		public Token(DataGridItem dgi)
		{
			_TokenID = Convert.ToInt32(((Label) dgi.FindControl("lblTokenID")).Text);
			_TokenAlias = ((Label) dgi.FindControl("lblTokenName")).Text;
			_Hidden = ! ((CheckBox) dgi.FindControl("chkHidden")).Checked;
			_DataType = (QuickReport.DataTypes) Convert.ToInt32(((Label) dgi.FindControl("lblDataTypeID")).Text);
			_TokenType = (QuickReport.TokenTypes) Convert.ToInt32(((Label) dgi.FindControl("lblTokenTypeID")).Text);
			_Function = ((DropDownList) dgi.FindControl("ddlFunction")).SelectedValue;
			SortBy = ((CheckBox) dgi.FindControl("chkColumnSort")).Checked;
			SortDirection = ((DropDownList) dgi.FindControl("ddlColumnSortDirection")).SelectedValue;
			SingleDate = ((CalendarPopup) dgi.FindControl("dtParameter")).SelectedDate;
			DateFrom = ((CalendarPopup) dgi.FindControl("dtParameterFrom")).SelectedDate;
			DateTo = ((CalendarPopup) dgi.FindControl("dtParameterTo")).SelectedDate;
			SingleText = ((TextBox) dgi.FindControl("txtExpression")).Text;
			strFrom = ((TextBox) dgi.FindControl("txtFrom")).Text;
			strTo = ((TextBox) dgi.FindControl("txtTo")).Text;
			ActiveValue = ((RadioButtonList) dgi.FindControl("lstActive")).SelectedValue;
			_TokenOrder = Convert.ToInt32(((Label) dgi.FindControl("lblTokenOrder")).Text);
		}