private void btnDelete_Click(object sender, EventArgs e) { BEQuickReports ds = new BEQuickReports(); BPGeneratedReports bpMain = new BPGeneratedReports(); BPGeneratedReportTokens bpTokens = new BPGeneratedReportTokens(); ds = bpMain.SelectByID(GeneratedReportID); ds.Merge(bpTokens.SelectByGeneratedReportID(GeneratedReportID)); ds.Relations.Add("Rel1",ds.tbl_GeneratedReports.Columns["GeneratedReportID"],ds.tbl_GeneratedReportTokens.Columns["GeneratedReportID"]); ds.EnforceConstraints = true; ds.tbl_GeneratedReports.FindByGeneratedReportID(GeneratedReportID).Delete(); bpMain.Update(ds); bpTokens.Update(ds); btnCancel_Click(null,null); }
private void SaveReportTokens() { //update the datagrid so that the information is most up to date. btnUpdateGrid_Click(null,null); BEQuickReports.tbl_GeneratedReportTokensRow dr; BPGeneratedReportTokens bp = new BPGeneratedReportTokens(); bp.DeleteByGeneratedReportID(GeneratedReportID); foreach (Token tkn in gridDataSource) { dr = DSQuickReports.tbl_GeneratedReportTokens.Newtbl_GeneratedReportTokensRow(); dr.GeneratedReportID = GeneratedReportID; dr.TokenID = tkn.TokenID; if (tkn.Function != "-1" && tkn.Expression != "") { dr.TokenFilter = tkn.Function; dr.TokenFilterExpression = tkn.Expression; } else { dr.SetTokenFilterNull(); dr.SetTokenFilterExpressionNull(); } dr.TokenSort = tkn.ColumnSort; dr.TokenOrder = tkn.TokenOrder; dr.DataTypeID = tkn.DataTypeID; if (ddlLetterColumn.SelectedValue == dr.TokenID.ToString() && ddlLinkColumn.SelectedValue == dr.TokenID.ToString()) { dr.TokenType = Convert.ToInt32(QuickReport.TokenTypes.LinkLetterColumn); } else if (ddlLetterColumn.SelectedValue == dr.TokenID.ToString()) { dr.TokenType = Convert.ToInt32(QuickReport.TokenTypes.LetterColumn); } else if (ddlLinkColumn.SelectedValue == dr.TokenID.ToString()) { dr.TokenType = Convert.ToInt32(QuickReport.TokenTypes.LinkColumn); } else if (tkn.Hidden == true) { dr.TokenType = Convert.ToInt32(QuickReport.TokenTypes.Hidden); } else { dr.TokenType = Convert.ToInt32(QuickReport.TokenTypes.Regular); } DSQuickReports.tbl_GeneratedReportTokens.Addtbl_GeneratedReportTokensRow(dr); } bp.Update(DSQuickReports); }
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); } }