private void bgwSave_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { try { _presenter.SaveChanges(); if (this.IsNeedApproval) { _presenter.SendApproval(); } else { List <SPKViewModel> _dataSource = new List <SPKViewModel>(); _dataSource.Add(SelectedSPK); if (isContractWork) { SPKContractPrintItem report = new SPKContractPrintItem(); report.DataSource = _dataSource; report.FillDataSource(); if (!this.IsSPKSales) { _presenter.Print(); using (ReportPrintTool printTool = new ReportPrintTool(report)) { // Invoke the Print dialog. printTool.PrintDialog(); } } } else { SPKPrintItem report = new SPKPrintItem(); report.DataSource = _dataSource; report.FillDataSource(); if (!this.IsSPKSales) { _presenter.Print(); using (ReportPrintTool printTool = new ReportPrintTool(report)) { // Invoke the Print dialog. printTool.PrintDialog(); } } } } } catch (Exception ex) { MethodBase.GetCurrentMethod().Fatal("An error occured while trying to save spk with vehicleID: '" + this.VehicleId + "'", ex); e.Result = ex; } }
private void btnPrint_Click(object sender, EventArgs e) { SPKPrintItem report = new SPKPrintItem(); List <SPKViewModel> _dataSource = new List <SPKViewModel>(); _dataSource.Add(SelectedSPK); report.DataSource = _dataSource; report.FillDataSource(); using (ReportPrintTool printTool = new ReportPrintTool(report)) { // Invoke the Print dialog. printTool.PrintDialog(); } _presenter.Print(); }
private void cmsPrintData_Click(object sender, EventArgs e) { SPKPrintItem report = new SPKPrintItem(); List <SPKViewModel> _dataSource = new List <SPKViewModel>(); _dataSource.Add(SelectedSPK); report.DataSource = _dataSource; report.FillDataSource(); using (ReportPrintTool printTool = new ReportPrintTool(report)) { // Invoke the Print dialog. bool?result = printTool.PrintDialog(); if (result.HasValue && result.Value) { _presenter.PrintSPK(); } } btnSearch.PerformClick(); }