Ejemplo n.º 1
0
        private void btnExportTransaction_Click(object sender, EventArgs e)
        {
            #region Generate .csv file

            var fileSelector = new FolderBrowserDialog();
            var timeStamp    = DateTime.Now.Date.ToString("ddMMyyyy");
            if (fileSelector.ShowDialog() == DialogResult.OK)
            {
                var path = string.Format(fileSelector.SelectedPath + @"\销售记录{0}.xls", timeStamp);
                ExportFile.ExportToExcel(path, new TransactionManage().GetTransactionList());
                MessageBox.Show((zh?"生成销售记录":"Generating 销售记录") + timeStamp + (zh?".xls 成功!":".xls Sucessfully!"));
            }

            #endregion
        }
Ejemplo n.º 2
0
        private void bkgWorkForExporting_DoWork(object sender, DoWorkEventArgs e)
        {
            var bkgWorker = sender as BackgroundWorker;
            var timeStamp = ((string[])e.Argument)[0];
            var path      = ((string[])e.Argument)[1];

            ExportFile.ExportToExcel(path, new TransactionManage().GetTransactionList());
            try
            {
                var counter = 0;
                bkgWorker.ReportProgress(counter++);
            }
            catch (NullReferenceException exception)
            {
                Console.WriteLine(exception);
                throw;
            }

            MessageBox.Show("Generating 销售记录" + timeStamp + ".xls Sucessfully!");
        }