示例#1
0
        private SalesReturnExportObject CreateExportObject()
        {
            SalesReturnExportObject obj = new SalesReturnExportObject()
            {
                Code     = MemoTextbox.Text,
                Customer = CustomerDropdown.Text,
                Items    = list
            };

            return(obj);
        }
示例#2
0
        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.");
            }
        }
示例#3
0
        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.");
            }
        }