Пример #1
0
        public void LargeImport()
        {
            Performance perf     = new Performance();
            string      dataPath = TestData.DataPath;
            string      fn       = @"T:\PN6200\Staff\KTarbet\PiscesSampleData\CraigAddley\Testout.txt";

            Console.WriteLine(fn);
            Assert.IsTrue(File.Exists(fn), "Missing file " + fn);
            SpreadsheetGearExcel xls = new SpreadsheetGearExcel(fn);

            perf.Report("done reading " + fn);
            Series s = SpreadsheetGearSeries.ReadFromWorkbook(xls.Workbook, "sheet1", "DateTime", "flow", false, "cfs");

            s.Read();
            Assert.AreEqual(666282, s.Count);
            //Series s = new ExcelDataReaderSeries(fn, "sheet1", "DateTime", "flow","cfs");


            perf.Report("done importing excel file");

            /*
             * 666282 records
             *
             *  SaveTable    ==> 286 seconds
             *  InsertTable  ==> 64 seconds
             */

            // perform exceedance calculation
            //ExplorerView v = new ExplorerView();
            //Explorer explorer = new Explorer(v, db);

            //explorer.MonthDayRange
        }
Пример #2
0
        private void ImportExcelWaterYear(string filename)
        {
#if !PISCES_OPEN
            var dlg = new ImportExcelWaterYear(filename, DB.GetUniqueUnits());

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                for (int i = 0; i < dlg.SheetNames.Length; i++)
                {
                    SpreadsheetGearSeries s = SpreadsheetGearSeries.ReadFromWorkbook(dlg.WorkBook, dlg.SheetNames[i], dlg.DateColumn, dlg.ValueColumn, true, dlg.ComboBoxUnits.Text);
                    s.Name = "Monthly" + s.SheetName;

                    if (s.Count > 0)
                    {
                        DB.AddSeries(s, CurrentFolder);
                    }
                    else
                    {
                        //MessageBox.Show("No data in the selection.  File " + openExcelDialog.FileName);
                        MessageBox.Show("No data in selection.  Worksheet: " + s.SheetName);
                    }

                    if (s.Messages.Count > 0)
                    {
                        MessageBox.Show(s.Messages.ToString(), "Import Warnings ", MessageBoxButtons.OK);
                    }
                }
            }
#endif
        }
Пример #3
0
        private void ImportExcelStandard(string filename)
        {
#if !PISCES_OPEN
            ImportExcelStandard dlg = new ImportExcelStandard(filename, DB.GetUniqueUnits());

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                var messageList = new List <string>();
                for (int i = 0; i < dlg.ValueColumns.Length; i++)
                {
                    Series s = SpreadsheetGearSeries.ReadFromWorkbook(dlg.WorkBook, dlg.SheetName, dlg.DateColumn, dlg.ValueColumns[i], false, dlg.ComboBoxUnits.Text);
                    if (s.Count > 0)
                    {
                        DB.AddSeries(s, CurrentFolder);
                    }
                    else
                    {
                        //messageList.Add("No data in the selection.  File " + openExcelDialog.FileName);
                        messageList.Add("No data in the selection.  Worksheet: " + dlg.SheetName);
                    }

                    if (s.Messages.Count > 0)
                    {
                        messageList.Add(s.Messages.ToString());
                    }
                }
                if (messageList.Count > 0)
                {
                    MessageBox.Show(String.Join("\n", messageList.ToArray()), "Import Warnings", MessageBoxButtons.OK);
                }
            }
#endif
        }
Пример #4
0
        private void ImportExcelDatabaseStyle(string filename)
        {
            var dlg = new ImportExcelDatabase(filename, DB.GetUniqueUnits());

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var messageList = new List <string>();
                for (int i = 0; i < dlg.SelectedSites.Length; i++)
                {
                    Series s = SpreadsheetGearSeries.ReadFromWorkbook(dlg.WorkBook,
                                                                      dlg.SheetName, dlg.DateColumn, dlg.ValueColumn, dlg.SiteColumn, dlg.SelectedSites[i], dlg.ComboBoxUnits.Text);
                    if (s.Count > 0)
                    {
                        DB.AddSeries(s, CurrentFolder);
                    }
                    else
                    {
                        //messageList.Add("No data in the selection.  File " + openExcelDialog.FileName);
                        messageList.Add("No data in the selection.  Site: " + dlg.SelectedSites[i]);
                    }

                    if (s.Messages.Count > 0)
                    {
                        messageList.Add(s.Messages.ToString());
                    }
                }
                if (messageList.Count > 0)
                {
                    MessageBox.Show(String.Join("\n", messageList.ToArray()), "Import Warnings", MessageBoxButtons.OK);
                }
            }
        }