Exemplo n.º 1
0
        public void RenderDataTable(IScriptEditor editor, DataTable tbl)
        {
            if (IsExecutingAsync)
            {
                throw new Exception("Query is already executing!");
            }

            _tables.Add(tbl);
            DxResultRenderer grd = new DxResultRenderer();

            if (editor != null)
            {
                editor.PrepareAddInSupportForResultContextMenu(grd.PopUpMenu.Items);
            }

            pan.Controls.Add(grd);
            grd.Parent = pan;
            grd.Height = _gridHeight;

            grd.Left = 0;
            grd.Top  = Int32.MaxValue - 100;
            grd.Dock = DockStyle.Top;
            grd.RenderDataTable(tbl);
            grd.Enter += new EventHandler(grd_Enter);
            _grids.Add(grd);
            grd.BringToFront();
            Splitter splt = null;

            if (true)
            {
                splt = new Splitter();
                splt.SplitterMoved  += new SplitterEventHandler(splt_SplitterMoved);
                splt.SplitterMoving += new SplitterEventHandler(splt_SplitterMoving);
                splt.BackColor       = _splitterBackColor;
                splt.MinExtra        = 15;
                splt.MinSize         = 15;
                pan.Controls.Add(splt);
                splt.Dock = DockStyle.Top;
                splt.BringToFront();
            }

            pan.Height += grd.Height + (splt != null ? splt.Height : 0);
        }
Exemplo n.º 2
0
        private void RenderResult(IScriptEditor editor, TabControl tabControl, ScriptExecutionResult execResult)
        {
            if (execResult == null || execResult.DataSets == null || execResult.DataSets.Count == 0)
            {
                return;
            }

            TabPage          tp  = null;
            DxResultRenderer grd = null;
            int tblNo            = 1;

            foreach (DataSet ds in execResult.DataSets)
            {
                if (ds == null || ds.Tables.Count == 0)
                {
                    continue;
                }

                DataSetInfo dsInfo = editor.GetDataSetInfo(ds);
                tblNo = 1;
                foreach (DataTable tbl in ds.Tables)
                {
                    string tabCaption = String.Format("Qry {0}.{1} [{2}]", dsInfo.BatchNo, tblNo, tbl.Rows.Count);
                    tp             = new TabPage(tabCaption);
                    tp.ToolTipText = String.Format(tabCaption + " [{0}]", dsInfo.ServerDbInfo);

                    tabControl.TabPages.Add(tp);

                    grd = new DxResultRenderer();
                    tp.Controls.Add(grd);

                    grd.Enter += new EventHandler(grd_Enter);

                    editor.PrepareAddInSupportForResultContextMenu(grd.PopUpMenu.Items);
                    grd.Parent = tp;
                    grd.Dock   = DockStyle.Fill;
                    grd.RenderDataTable(tbl);
                    _disposeList.Add(grd);
                    tblNo++;
                }
            }
        }