private PurchaseReturnExportObject CreateExportObject()
        {
            PurchaseReturnExportObject obj = new PurchaseReturnExportObject()
            {
                Code     = MemoTextbox.Text,
                Supplier = SupplierDropdown.Text,
                Items    = list
            };

            return(obj);
        }
        private void ExportButton_Click(object sender, EventArgs e)
        {
            if (list.Count > 0)
            {
                ToggleButtons(false);
                LoadImage.Visible = true;

                PurchaseReturnExportObject exportObject = CreateExportObject();
                exportWorker.RunWorkerAsync(exportObject);
            }
            else
            {
                ClientHelper.ShowErrorMessage("No items to export.");
            }
        }
        void exportWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                PurchaseReturnExportObject exportObject = (PurchaseReturnExportObject)e.Argument;
                IExportStrategy            strategy     = new PurchaseReturnExportStrategy(exportObject);

                var exporter = new ReportExporter(strategy);
                exporter.ExportReport();
            }
            catch (Exception ex)
            {
                ClientHelper.LogException(ex);
                ClientHelper.ShowErrorMessage("An error occurred while exporting. Please try again.");
            }
        }