Esempio n. 1
0
        private void openScriptLogToolStripMenuItem_Click(object sender, EventArgs e)
        {
            newTab("Query Log");
            ucQueryWindow currentQuery = ((ucQueryWindow)tabQueries.SelectedTab.Controls[0]);

            currentQuery.setCurrentQuery(File.ReadAllText(Logging.getScriptLogPath("SQLRunner2")));
        }
Esempio n. 2
0
        void BtnRunQueryClick(object sender, EventArgs e)
        {
            ucQueryWindow currentQuery = ((ucQueryWindow)tabQueries.SelectedTab.Controls[0]);

            currentQuery.runCurrentQueryText();
            Logging.LogScript(currentQuery.getCurrentQueryText(), "SQLRunner2");
        }
Esempio n. 3
0
        void newTab(string tabName)
        {
            int nameCount = 0;

            foreach (TabPage tp in tabQueries.TabPages)
            {
                if (tp.Text == tabName)
                {
                    nameCount++;
                }
                foreach (TabPage tp1 in tabQueries.TabPages)
                {
                    if (tp.Text == tabName + nameCount.ToString())
                    {
                        nameCount++;
                    }
                }
            }

            if (nameCount > 0)
            {
                tabName = tabName + nameCount.ToString();
            }

            TabPage       newTab = new TabPage(tabName);
            ucQueryWindow newQW  = new ucQueryWindow(dbConnMan);

            newQW.Dock = DockStyle.Fill;
            newTab.Controls.Add(newQW);
            //tabQueries.ContextMenuStrip = mnuQueryTabs;
            tabQueries.TabPages.Add(newTab);
            tabQueries.SelectedTab = newTab;
            newQW.Focus();
        }
Esempio n. 4
0
        void BtnRunActionClick(object sender, EventArgs e)
        {
            txtStatus.Text = "Running update...";
            ucQueryWindow currentQuery    = ((ucQueryWindow)tabQueries.SelectedTab.Controls[0]);
            int           recordsModified = currentQuery.runCurrentQueryTextAction();

            txtStatus.Text = recordsModified.ToString() + " records modified @ " + DateTime.Now.ToString();
            Logging.LogScript(currentQuery.getCurrentQueryText(), "SQLRunner2");
        }
Esempio n. 5
0
        void TvTablesListDoubleClick(object sender, EventArgs e)
        {
            if (tvTablesList.SelectedNode != null)
            {
                string tableName = tvTablesList.SelectedNode.Text;

                newTab(tableName);
                ucQueryWindow currentQuery = ((ucQueryWindow)tabQueries.SelectedTab.Controls[0]);
                currentQuery.setCurrentQuery(getSelectTopSQL(tableName));
                currentQuery.runCurrentQueryText();
                Logging.LogScript(currentQuery.getCurrentQueryText(), "SQLRunner2");
            }
        }
Esempio n. 6
0
        private void btnSaveResultsAs_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            DialogResult dr         = sfd.ShowDialog();
            string       expSuccess = "Nothing happened";

            if (dr == DialogResult.OK)
            {
                ucQueryWindow currentQuery = ((ucQueryWindow)tabQueries.SelectedTab.Controls[0]);
                expSuccess = currentQuery.fileExport(this.cboExportFormat.Text, sfd.FileName);
            }

            txtStatus.Text = expSuccess + " @ " + DateTime.Now.ToString();
        }
Esempio n. 7
0
        void BtnOpenScriptClick(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "SQL Files (*.SQL)|*.sql|All Files (*.*)|*.*";

            DialogResult dr = ofd.ShowDialog();

            //TODO: Needs save file funcitonality, cleanup

            if (dr == DialogResult.OK)
            {
                newTab(ofd.FileName.ToString());
                ucQueryWindow currentQuery = ((ucQueryWindow)tabQueries.SelectedTab.Controls[0]);
                currentQuery.setCurrentQuery(File.ReadAllText(ofd.FileName.ToString()));
            }
        }
Esempio n. 8
0
 void TabQueriesMouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         for (int i = 0; i < tabQueries.TabCount; ++i)
         {
             Rectangle r = tabQueries.GetTabRect(i);
             if (r.Contains(e.Location) /* && it is the header that was clicked*/)
             {
                 mnuQueryTabs.Show(tabQueries, e.Location);
                 break;
             }
             else
             {
                 ucQueryWindow currentQuery = ((ucQueryWindow)tabQueries.SelectedTab.Controls[0]);
             }
         }
     }
 }