private void printAllToolStripMenuItem_Click(object sender, EventArgs e) { if (vwDeals.RowCount == 0) { MessageBox.Show("No deal notes to print!", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string dealno = ""; for (int i = 0; i < vwDeals.RowCount; i++) { dealno = vwDeals.GetRowCellValue(i, "dealno").ToString(); if (dealno.Substring(0, 1) == "B") { ViewReports.BNOTE bnote = new ViewReports.BNOTE(); bnote.Parameters["dealno"].Value = dealno; ((SqlDataSource)bnote.DataSource).ConfigureDataConnection += ViewDeals_ConfigureDataConnection; ReportPrintTool tool = new ReportPrintTool(bnote); tool.ShowPreview(); } else if (dealno.Substring(0, 1) == "S") { ViewReports.SNOTE snote = new ViewReports.SNOTE(); snote.Parameters["dealno"].Value = dealno; ((SqlDataSource)snote.DataSource).ConfigureDataConnection += ViewDeals_ConfigureDataConnection; ReportPrintTool tool = new ReportPrintTool(snote); tool.ShowPreview(); } } }
private void printSelectedToolStripMenuItem_Click(object sender, EventArgs e) { if (rdoNone.Checked == true) { string dealno = ""; //print the deal not for the selected deal(s) for (int i = 0; i < vwDeals.RowCount; i++) { if (vwDeals.IsRowSelected(i)) { dealno = vwDeals.GetRowCellValue(i, "dealno").ToString(); if (dealno.Substring(0, 1) == "B") { //change connection string ViewReports.BNOTE bnote = new ViewReports.BNOTE(); bnote.Parameters["dealno"].Value = dealno; ((SqlDataSource)bnote.DataSource).ConfigureDataConnection += ViewDeals_ConfigureDataConnection; ReportPrintTool tool = new ReportPrintTool(bnote); tool.ShowPreview(); } else if (dealno.Substring(0, 1) == "S") { ViewReports.SNOTE snote = new ViewReports.SNOTE(); snote.Parameters["dealno"].Value = dealno; ((SqlDataSource)snote.DataSource).ConfigureDataConnection += ViewDeals_ConfigureDataConnection; ReportPrintTool tool = new ReportPrintTool(snote); tool.ShowPreview(); } } } } }
private void vwTrades_KeyUp(object sender, KeyEventArgs e) { string reportName = ""; string dealno = ""; if (e.KeyCode == Keys.F3) { //print the deal not for the selected deal(s) for (int i = 0; i < vwTrades.RowCount; i++) { if (vwTrades.IsRowSelected(i)) { dealno = vwTrades.GetRowCellValue(i, "dealno").ToString(); if (dealno.Substring(0, 1) == "B") { ViewReports.BNOTE bnote = new ViewReports.BNOTE(); bnote.Parameters["dealno"].Value = dealno; ((SqlDataSource)bnote.DataSource).ConfigureDataConnection += ClientTrades_ConfigureDataConnection; ReportPrintTool tool = new ReportPrintTool(bnote); tool.ShowPreview(); } else if (dealno.Substring(0, 1) == "S") { ViewReports.SNOTE snote = new ViewReports.SNOTE(); snote.Parameters["dealno"].Value = dealno; ((SqlDataSource)snote.DataSource).ConfigureDataConnection += ClientTrades_ConfigureDataConnection; ReportPrintTool tool = new ReportPrintTool(snote); tool.ShowPreview(); } break; } } } if (e.KeyCode == Keys.F10) { NewDeal ndeal = new NewDeal(); ndeal.ShowDialog(); } }