示例#1
0
        private void createResultsSetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var createForm = new ResultSetCreate();

            createForm.QueriesDirectory = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Query].FullFileName;
            createForm.ResultsDirectory = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Expect].FullFileName;
            createForm.ConnectionString = Configuration.Project.ConnectionStrings[
                Configuration.ConnectionStringCollection.ConnectionClass.Oledb,
                Configuration.ConnectionStringCollection.ConnectionType.Expect
                                          ].Value;

            DialogResult dialogResult = createForm.ShowDialog();

            if (dialogResult.HasFlag(DialogResult.OK))
            {
                StartClick(null);
                QuerySetManager qsm = null;
                try
                {
                    qsm = QuerySetManager.BuildDefault(createForm.QueriesDirectory, createForm.ResultsDirectory, createForm.ConnectionString);
                    qsm.ProgressStatusChanged += new ProgressStatusHandler(ProgressStatus);
                    qsm.PersistResultSets();
                }

                catch (ConnectionException ex)
                {
                    MessageBox.Show(ex.Message, "Cannot connect with connectionString", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                finally
                {
                    qsm.ProgressStatusChanged -= new ProgressStatusHandler(ProgressStatus);

                    Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Query].FullFileName  = createForm.QueriesDirectory;
                    Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Expect].FullFileName = createForm.ResultsDirectory;
                    Configuration.Project.ConnectionStrings[
                        Configuration.ConnectionStringCollection.ConnectionClass.Oledb,
                        Configuration.ConnectionStringCollection.ConnectionType.Expect
                    ].Value = createForm.ConnectionString;

                    EndClick(null);
                }
            }
        }
示例#2
0
        private void createResultsSetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var createForm = new ResultSetCreate();
            createForm.QueriesDirectory = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Query].FullFileName;
            createForm.ResultsDirectory = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Expect].FullFileName;
            createForm.ConnectionString = Configuration.Project.ConnectionStrings[
                Configuration.ConnectionStringCollection.ConnectionClass.Oledb,
                Configuration.ConnectionStringCollection.ConnectionType.Expect
                ].Value;

            DialogResult dialogResult = createForm.ShowDialog();
            if (dialogResult.HasFlag(DialogResult.OK))
            {
                StartClick(null);
                QuerySetManager qsm = null;
                try
                {
                    qsm = QuerySetManager.BuildDefault(createForm.QueriesDirectory, createForm.ResultsDirectory, createForm.ConnectionString);
                    qsm.ProgressStatusChanged += new ProgressStatusHandler(ProgressStatus);
                    qsm.PersistResultSets();
                }

                catch (ConnectionException ex)
                {
                    MessageBox.Show(ex.Message, "Cannot connect with connectionString", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                finally
                {
                    qsm.ProgressStatusChanged -= new ProgressStatusHandler(ProgressStatus);

                    Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Query].FullFileName = createForm.QueriesDirectory;
                    Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Expect].FullFileName = createForm.ResultsDirectory;
                    Configuration.Project.ConnectionStrings[
                        Configuration.ConnectionStringCollection.ConnectionClass.Oledb,
                        Configuration.ConnectionStringCollection.ConnectionType.Expect
                        ].Value = createForm.ConnectionString;

                    EndClick(null);
                }
            }
        }