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 + ","; } } }
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); } } }
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 SaveToken_Click(object sender, EventArgs e) { if (txtResult.Text.Length > 0 && txtTokenAlias.Text.Length >0) { BPTokens bp = new BPTokens(); BEQuickReports ds = new BEQuickReports(); BEQuickReports.tbl_TokensRow row = ds.tbl_Tokens.Newtbl_TokensRow(); row.TokenAlias = txtTokenAlias.Text; row.TokenColumns = txtResult.Text; row.TokenCategoryID = Convert.ToInt32(ddlCategories.SelectedValue); row.QuickReportID = Convert.ToInt32(ddlTables.SelectedItem.Value); ds.tbl_Tokens.Rows.Add(row); bp.Update(ds); } else { lblError2.Visible = true; } }