Esempio n. 1
0
        private void OnSqlQuery(object sender, EventArgs e)
        {
            //try
            {
                TableLink link = (_ctxtNode.Tag == null) ? null : _ctxtNode.Tag as TableLink;
                if (link == null)
                {
                    return;
                }

                IDBObjectTree dbTree = link.Tree as IDBObjectTree;
                if (dbTree == null)
                {
                    return;
                }

                DBObjectIdentifier id        = dbTree.GetIdentifier(link.Cell);
                string             selectSql = string.Format("SELECT * FROM {0}", id.FullName);

                TabPage tp = Zen.UIControls.CtrlBuilder.BuildTabPage(string.Format("Query{0}", _sqlTabCount++), _tabDetailView.Size, _tabDetailView.Controls.Count);

                SqlControl ctrl = new SqlControl();
                ctrl.Dock       = DockStyle.Fill;
                ctrl.SqlText    = selectSql;
                ctrl.DataSource = dbTree.DataSource;

                tp.Controls.Add(ctrl);
                _tabDetailView.Controls.Add(tp);
            }
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
        }
Esempio n. 2
0
        private void OnContextMenu(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            Point    pt   = new Point(e.X, e.Y);
            TreeNode node = _treeView.GetNodeAt(pt);

            if (node == null)
            {
                return;
            }

            TableLink link = (node.Tag == null) ? null : node.Tag as TableLink;

            if (link != null)
            {
                _treeView.SelectedNode = node;
                _ctxtNode = node;
                ContextMenuStrip ctxtMenu = LoadContextMenu();
                ctxtMenu.Show(_treeView, pt);
            }
            _treeView.SelectedNode = null;
        }
Esempio n. 3
0
        private void OnTableToObj(object sender, EventArgs e)
        {
            TableLink link = (_ctxtNode.Tag == null) ? null : _ctxtNode.Tag as TableLink;

            if (link == null)
            {
                return;
            }

            IDBObjectTree dbTree = link.Tree as IDBObjectTree;

            if (dbTree == null)
            {
                return;
            }

            DBObjectIdentifier id     = dbTree.GetIdentifier(link.Cell);
            TableSchema        schema = new TableSchema(dbTree.DataSource, id.FullName);

            ShowTable(schema.ColumnDefs, id.Name);
        }
Esempio n. 4
0
        private void OnExport(object sender, EventArgs e)
        {
            //try
            {
                TableLink link = (_ctxtNode.Tag == null) ? null : _ctxtNode.Tag as TableLink;
                if (link == null)
                {
                    return;
                }

                IDBObjectTree dbTree = link.Tree as IDBObjectTree;
                if (dbTree == null)
                {
                    return;
                }

                DataTable tbl = dbTree.Export(link.Cell);
                ShowTable(tbl, tbl.TableName);
            }
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
        }