Exemplo n.º 1
0
        private async void ImportExcelDataIntoDatabase()
        {
            try
            {
                var message = "The program will read into memory all rows from the spreadsheet, " +
                              "and then process saving them to the database.\n" +
                              "Ready to begin the import process?";
                var dr = XtraMessageBox.Show(message, "Begin Import?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dr == DialogResult.No)
                {
                    return;
                }

                var importer = new ExcelImporter(gridViewExcelSource, MappingInfo, Persistent);
                EventMediator.GetInstance().OnImportStarted();
                EventMediator.GetInstance().ImportProgressUpdated += OnProgressUpdated;

                marquee.Properties.Stopped = false;
                await importer.Import();

                message = "Data has been imported successfully!";
                XtraMessageBox.Show(message, "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                marquee.Properties.Stopped = true;
                EventMediator.GetInstance().OnImportComplete();
            }
            catch (Exception ex)
            {
                ex.Report();
            }
        }
Exemplo n.º 2
0
 private void UpdateProgress()
 {
     EventMediator.GetInstance().OnImportProgressUpdated(RowsComplete, TotalRows);
 }