Example #1
0
        /// <summary>
        /// SQLite convered from DSS
        /// https://github.com/usbr/convertdss
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addSqLiteModel_Click(object sender, EventArgs e)
        {
            var dlg = new Reclamation.TimeSeries.ScenarioPicker.ScenarioPicker();

            dlg.Text = "Select SqLite files";
            dlg.Dialog.DefaultExt = ".db";
            dlg.Dialog.Filter     = "SQLite *.db|*.db|All Files|*.*";
            dlg.Dialog.Title      = "Open SQLite File (from DSS)";
            try
            {
                DB.SuspendTreeUpdates();
                var result = dlg.ShowDialog();

                if (result == DialogResult.OK)
                {
                    if (dlg.ScenariosChecked && dlg.ScenarioFiles.Count > 0)
                    {
                        //create scenarios
                        ShowAsBusy("Reading data");
                        var tblScen = DB.GetScenarios();
                        foreach (var item in dlg.ScenarioFiles)
                        {
                            string scenarioPath = ConnectionStringUtility.MakeFileNameRelative("FileName=" + item, DB.DataSource);
                            tblScen.AddScenarioRow(Path.GetFileNameWithoutExtension(item), true, scenarioPath, 0);
                        }
                        //add first file in the list to the tree
                        if (dlg.AddToTreeChecked)
                        {
                            SQLiteSeries.CreatePiscesTree(dlg.ScenarioFiles[0], CurrentFolder, DB);
                        }
                        DB.Server.SaveTable(tblScen);
                        DatabaseChanged();
                    }
                    else
                    if (dlg.AddToTreeChecked)
                    {
                        //add to tree, but not to scenairo list
                        ShowAsBusy("Reading  data");
                        for (int i = 0; i < dlg.ScenarioFiles.Count; i++)
                        {
                            string fn = dlg.ScenarioFiles[i].ToString();
                            SQLiteSeries.CreatePiscesTree(fn, CurrentFolder, DB);
                        }
                        DatabaseChanged();
                    }
                }
            }
            finally
            {
                ShowAsReady("Done with Modsim import");
                DB.ResumeTreeUpdates();
            }
        }
Example #2
0
        private void AddBpaHydsimClick(object sender, EventArgs e)
        {
            var dlg = new Reclamation.TimeSeries.ScenarioPicker.ScenarioPicker();

            dlg.Text = "Select Hydsim Output Files";
            dlg.Dialog.DefaultExt = ".mdb";
            dlg.Dialog.Filter     = "BPA Hydsim Access (*.mdb, *.accdb)|*.mdb;*.accdb|All Files|*.*";
            dlg.Dialog.Title      = "Open BPA Hydsim Access File";

            try
            {
                DB.SuspendTreeUpdates();
                var result = dlg.ShowDialog();

                if (result == DialogResult.OK)
                {
                    if (dlg.ScenariosChecked && dlg.ScenarioFiles.Count > 0)
                    {
                        //create scenarios
                        ShowAsBusy("Reading Hydsim data");
                        var tblScen = DB.GetScenarios();

                        foreach (var item in dlg.ScenarioFiles)
                        {
                            string scenarioPath = ConnectionStringUtility.MakeFileNameRelative("FileName=" + item, DB.DataSource);
                            tblScen.AddScenarioRow(Path.GetFileNameWithoutExtension(item), true, scenarioPath, 0);
                        }
                        //add first file in the list to the tree
                        if (dlg.AddToTreeChecked)
                        {
                            var bpa = new BpaHydsim.BpaHydsimTreeAccess(dlg.ScenarioFiles[0], DB.DataSource, DB.NextSDI(), this.CurrentFolder.ID);
                            var tbl = bpa.CreateTree();
                            DB.Server.SaveTable(tbl);
                        }

                        DB.Server.SaveTable(tblScen);
                        DatabaseChanged();
                    }
                    else
                    if (dlg.AddToTreeChecked)
                    {
                        //add to tree, but not to scenairo list
                        ShowAsBusy("Reading Hydsim data");
                        for (int i = 0; i < dlg.ScenarioFiles.Count; i++)
                        {
                            string fn  = dlg.ScenarioFiles[i].ToString();
                            var    bpa = new BpaHydsim.BpaHydsimTreeAccess(fn, DB.DataSource, DB.NextSDI(), this.CurrentFolder.ID);
                            var    tbl = bpa.CreateTree();
                            DB.Server.SaveTable(tbl);
                        }
                        DatabaseChanged();
                    }
                }
            }

            finally
            {
                ShowAsReady("Done with Hydsim import");
                DB.ResumeTreeUpdates();
            }
        }
Example #3
0
        private void AddBpaHydsimClick(object sender, EventArgs e)
        {
            var dlg = new Reclamation.TimeSeries.ScenarioPicker.ScenarioPicker();

            dlg.Text = "Select Hydsim Output Files";
            dlg.Dialog.DefaultExt = ".mdb";
            dlg.Dialog.Filter = "BPA Hydsim Access (*.mdb, *.accdb)|*.mdb;*.accdb|All Files|*.*";
            dlg.Dialog.Title = "Open BPA Hydsim Access File";

            try
            {
                DB.SuspendTreeUpdates();
                var result = dlg.ShowDialog();

                if (result == DialogResult.OK)
                {
                    if (dlg.ScenariosChecked && dlg.ScenarioFiles.Count > 0)
                    {
                        //create scenarios
                        ShowAsBusy("Reading Hydsim data");
                        var tblScen = DB.GetScenarios();

                        foreach (var item in dlg.ScenarioFiles)
                        {
                            string scenarioPath = ConnectionStringUtility.MakeFileNameRelative("FileName=" + item, DB.DataSource);
                            tblScen.AddScenarioRow(Path.GetFileNameWithoutExtension(item), true, scenarioPath,0);
                        }
                        //add first file in the list to the tree
                        if (dlg.AddToTreeChecked)
                        {
                            var bpa = new BpaHydsim.BpaHydsimTreeAccess(dlg.ScenarioFiles[0], DB.DataSource, DB.NextSDI(), this.CurrentFolder.ID);
                            var tbl = bpa.CreateTree();
                            DB.Server.SaveTable(tbl);
                        }

                        DB.Server.SaveTable(tblScen);
                        DatabaseChanged();
                    }
                    else
                        if (dlg.AddToTreeChecked)
                        {
                            //add to tree, but not to scenairo list
                            ShowAsBusy("Reading Hydsim data");
                            for (int i = 0; i < dlg.ScenarioFiles.Count; i++)
                            {
                                string fn = dlg.ScenarioFiles[i].ToString();
                                var bpa = new BpaHydsim.BpaHydsimTreeAccess(fn, DB.DataSource, DB.NextSDI(), this.CurrentFolder.ID);
                                var tbl = bpa.CreateTree();
                                DB.Server.SaveTable(tbl);
                            }
                            DatabaseChanged();
                        }
                }
            }

            finally
            {
                ShowAsReady("Done with Hydsim import");
                DB.ResumeTreeUpdates();
            }
        }
Example #4
0
        /// <summary>
        /// SQLite convered from DSS
        /// https://github.com/usbr/convertdss
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addSqLiteModel_Click(object sender, EventArgs e)
        {
            var dlg = new Reclamation.TimeSeries.ScenarioPicker.ScenarioPicker();

            dlg.Text = "Select SqLite files";
            dlg.Dialog.DefaultExt = ".db";
            dlg.Dialog.Filter = "SQLite *.db|*.db|All Files|*.*";
            dlg.Dialog.Title = "Open SQLite File (from DSS)";
            try
            {
                DB.SuspendTreeUpdates();
                var result = dlg.ShowDialog();

                if (result == DialogResult.OK)
                {
                    if (dlg.ScenariosChecked && dlg.ScenarioFiles.Count > 0)
                    {
                        //create scenarios
                        ShowAsBusy("Reading data");
                        var tblScen = DB.GetScenarios();
                        foreach (var item in dlg.ScenarioFiles)
                        {
                            string scenarioPath = ConnectionStringUtility.MakeFileNameRelative("FileName=" + item, DB.DataSource);
                            tblScen.AddScenarioRow(Path.GetFileNameWithoutExtension(item), true, scenarioPath,0);
                        }
                        //add first file in the list to the tree
                        if (dlg.AddToTreeChecked)
                        {
                            SQLiteSeries.CreatePiscesTree(dlg.ScenarioFiles[0], CurrentFolder, DB);
                        }
                        DB.Server.SaveTable(tblScen);
                        DatabaseChanged();
                    }
                    else
                        if (dlg.AddToTreeChecked)
                        {
                            //add to tree, but not to scenairo list
                            ShowAsBusy("Reading  data");
                            for (int i = 0; i < dlg.ScenarioFiles.Count; i++)
                            {
                                string fn = dlg.ScenarioFiles[i].ToString();
                              SQLiteSeries.CreatePiscesTree(fn, CurrentFolder, DB);
                            }
                            DatabaseChanged();
                        }
                }
            }
            finally
            {
                ShowAsReady("Done with Modsim import");
                DB.ResumeTreeUpdates();
            }
        }