protected void FillSelectedTokens()
		{
			if (GeneratedReportID > 0)
			{
				ddlSelectedTokens.Items.Clear();
				BPTokens bpTokens = new BPTokens();
				BEQuickReports dsTokens = new BEQuickReports();
				BPCompanyAliases bpAliases = new BPCompanyAliases();
				Hashtable aliases = bpAliases.SelectColumnMappings(CompanyID);

				dsTokens = bpTokens.SelectByGeneratedReportID(GeneratedReportID);

				ListItem item;
				foreach (BEQuickReports.tbl_TokensRow row in dsTokens.tbl_Tokens)
				{
					item = new ListItem();
					item.Value = row.TokenID.ToString().Replace('_',' ');
					if (!row.LookupAlias)
					{
						item.Text = row.TokenAlias.Replace('_',' '); //.Replace added, part of bug fix 20090603 - hs
					}
					else
					{
						string columnName = row.TokenColumns.Replace("|","");
						if (aliases.Count > 0 && aliases.ContainsKey(columnName) && aliases[columnName].ToString()!="")
						{
							item.Text = aliases[columnName].ToString();	
						}
						else
						{
							item.Text = row.TokenAlias.Replace('_',' ');
						}
					}
					ddlSelectedTokens.Items.Add(item);
					SelectedTokens.Value += item.Value + ",";
				}
			}
		}
		protected void FillAvailableTokens()
		{
			ddlAvailableTokens.Items.Clear();
			if (ddlTokenCategories.SelectedValue != "0")
			{
				BPTokens bpTokens = new BPTokens();
				BEQuickReports dsTokens = new BEQuickReports();
				BPCompanyAliases bpAliases = new BPCompanyAliases();
				Hashtable aliases = bpAliases.SelectColumnMappings(CompanyID);

				dsTokens = bpTokens.SelectByTokenCategoryID(Convert.ToInt32(ddlTokenCategories.SelectedValue));

				ListItem item;
				foreach (BEQuickReports.tbl_TokensRow row in dsTokens.tbl_Tokens)
				{
					item = new ListItem();
					item.Value = row.TokenID.ToString();
					if (!row.LookupAlias)
					{
						item.Text = row.TokenAlias.Replace('_',' ');
						ddlAvailableTokens.Items.Add(item);
					}
					else
					{
						string columnName = row.TokenColumns.Replace("|","");
						if (aliases.Count > 0 && aliases.ContainsKey(columnName) && aliases[columnName].ToString()!="")
						{
							item.Text = aliases[columnName].ToString();	
							ddlAvailableTokens.Items.Add(item);
						}
						else if (! columnName.StartsWith("ExtraColumn"))
						{
							item.Text = row.TokenAlias.Replace('_',' ');
							ddlAvailableTokens.Items.Add(item);
						}
					}
				}
			}
		}
		private void FillTextBoxes()
		{
			if (GeneratedReportID != 0)
			{
				BPCompanyAliases bpAliases = new BPCompanyAliases();
				Hashtable aliases = bpAliases.SelectColumnMappings(CompanyID);

				BPGeneratedReports bp = new BPGeneratedReports();
				BPGeneratedReportTokens bpGRT = new BPGeneratedReportTokens();
				BEQuickReports ds = new BEQuickReports();
				ds = bp.SelectByID(GeneratedReportID);
				ds.Merge(bpGRT.SelectByGeneratedReportID(GeneratedReportID));
				BEQuickReports.tbl_GeneratedReportsRow report = ds.tbl_GeneratedReports.FindByGeneratedReportID(GeneratedReportID);
				txtReportAlias.Text = report.GeneratedReportName;
				if (ddlVisibility.Items.FindByValue(Convert.ToInt32(report.GeneralReport).ToString()) != null)
				{
					ddlVisibility.SelectedValue = Convert.ToInt32(report.GeneralReport).ToString();
				}
				QuickReportID = report.QuickReportID;
				GeneratedReportType = (QuickReport.GeneratedReportTypes) report.GeneratedReportType;
				gridDataSource.Fill(ds.tbl_GeneratedReportTokens, aliases);
			}
		}
		private void UpdateDataSource()
		{
			string CompanyColumnAlias = "";
			BPCompanyAliases bpAliases = new BPCompanyAliases();
			Hashtable aliases = bpAliases.SelectColumnMappings(CompanyID);

			BPTokens bp = new BPTokens();
			BEQuickReports ds = bp.SelectByQuickReportID(QuickReportID);
			foreach (BEQuickReports.tbl_TokensRow row in ds.tbl_Tokens.Rows)
			{
				if (row.LookupAlias)
				{
					string columnName = row.TokenColumns.Replace("|","");
					if (aliases.Count > 0 && aliases.ContainsKey(columnName) && aliases[columnName].ToString()!="")
					{
						CompanyColumnAlias = aliases[columnName].ToString();	
					}
					else if (! columnName.StartsWith("ExtraColumn"))
					{
						CompanyColumnAlias = row.TokenAlias.Replace('_',' ');
					}
				}
				else
					CompanyColumnAlias = ""; //bug fix 20090603 - hs

//				else
//				{
//					CompanyColumnAlias = row.TokenAlias.Replace('_', ' ');
//				}

				if (gridDataSource.GetTokenByTokenID(row.TokenID) == null)
				{
					if (SelectedTokensList.Contains(row.TokenID))
					{
						gridDataSource.Add(row, CompanyColumnAlias);
					}
				}
				else if (! SelectedTokensList.Contains(row.TokenID))
				{
					gridDataSource.Remove(row);
				}
			}
		}
Beispiel #5
0
		private void ChangeColumnNames()
		{
			BPCompanyAliases bp = new BPCompanyAliases();
			Hashtable ht = bp.SelectColumnMappings(GlobalCompanyID);
			if (ht.Count > 0)
			{
				foreach (GridColumn column in dgOrders.Levels[1].Columns)
				{
					if (ht.ContainsKey(column.DataField) && ht[column.DataField] != null && ht[column.DataField].ToString() != "")
					{
						column.HeadingText = ht[column.DataField].ToString();
					}
				}
			}
		}