Exemplo n.º 1
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
        }
Exemplo n.º 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
        }