private SalesReturnExportObject CreateExportObject() { SalesReturnExportObject obj = new SalesReturnExportObject() { Code = MemoTextbox.Text, Customer = CustomerDropdown.Text, Items = list }; return(obj); }
private void ExportButton_Click(object sender, EventArgs e) { if (list.Count > 0) { ToggleButtons(false); LoadImage.Visible = true; SalesReturnExportObject exportObject = CreateExportObject(); exportWorker.RunWorkerAsync(exportObject); } else { ClientHelper.ShowErrorMessage("No items to export."); } }
void exportWorker_DoWork(object sender, DoWorkEventArgs e) { try { SalesReturnExportObject exportObject = (SalesReturnExportObject)e.Argument; IExportStrategy strategy = new SalesReturnExportStrategy(exportObject); var exporter = new ReportExporter(strategy); exporter.ExportReport(); } catch (Exception ex) { ClientHelper.LogException(ex); ClientHelper.ShowErrorMessage("An error occurred while exporting. Please try again."); } }