private void dgv_DataSourceChanged(object sender, EventArgs e)
        {
            ucDataGridView dgv = sender as ucDataGridView;

            if (dgv != null)
            {
                dgv.AutoResizeColumn();
            }
        }
        public static string GetRowCellStrValue(this ucDataGridView aDGV, int aRowIndex, string aColName)
        {
            if (aDGV.Rows[aRowIndex].Cells[aColName].Value != null)
            {
                return(aDGV.Rows[aRowIndex].Cells[aColName].Value.ToString());
            }

            return(string.Empty);
        }
        public static Object GetRowCellValue(this ucDataGridView aDGV, int aRowIndex, string aColName)
        {
            if (aDGV.Rows[aRowIndex].Cells[aColName].Value != null)
            {
                return(aDGV.Rows[aRowIndex].Cells[aColName].Value);
            }

            return(null);
        }
        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.tabControl1.TabPages.Count > 0)
            {
                if (this.tabControl1.TabPages[this.tabControl1.SelectedIndex].Text.Equals(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.COLUMN))
                {
                    DataTable      dt  = DALDataAccess.GetTableColumns(this.mHt["USER"].ToString(), this.mHt["OBJECT_NAME"].ToString());
                    ucDataGridView dgv = this.tabControl1.TabPages[this.tabControl1.SelectedIndex].Controls[0] as ucDataGridView;

                    dgv.DataSource = dt;
                }
                else if (this.tabControl1.TabPages[this.tabControl1.SelectedIndex].Text.Equals(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.DATA))
                {
                    string     query    = string.Format(@" SELECT * FROM {0}.{1} ", this.mHt["USER"].ToString(), this.mHt["OBJECT_NAME"].ToString());
                    ucDgvQuery dgvQuery = this.tabControl1.TabPages[this.tabControl1.SelectedIndex].Controls[0] as ucDgvQuery;
                    dgvQuery.Query = query;
                    dgvQuery.ExecuteQuery(false, 0, false);
                }
                else if (this.tabControl1.TabPages[this.tabControl1.SelectedIndex].Text.Equals(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.INDEX))
                {
                    DataTable      dt  = DALDataAccess.GetTableIndexInfo(this.mHt["USER"].ToString(), this.mHt["OBJECT_NAME"].ToString());
                    ucDataGridView dgv = this.tabControl1.TabPages[this.tabControl1.SelectedIndex].Controls[0] as ucDataGridView;

                    dgv.DataSource = dt;
                }
                else if (this.tabControl1.TabPages[this.tabControl1.SelectedIndex].Text.Equals(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT))
                {
                    DataTable dtScript = DALDataAccess.GetObjectScript(this.mHt["USER"].ToString(), this.mHt["OBJECT_NAME"].ToString());
                    TextBox   tbx      = this.tabControl1.TabPages[this.tabControl1.SelectedIndex].Controls[0] as TextBox;

                    tbx.Text = string.Format("{0};", dtScript.Rows[0]["SCRIPT"].ToString().Trim()).Replace("\n", "\r\n");

                    if (this.tabControl1.Tag.Equals(Common.Definition.ConstValue.DBViewer_ObjectList_VALUE.TABLE))
                    {
                        DataTable dtIndex = DALDataAccess.GetIndexByTableName(this.mHt["USER"].ToString(), this.mHt["OBJECT_NAME"].ToString());

                        if (dtIndex.Rows.Count > 0)
                        {
                            foreach (DataRow dr in dtIndex.Rows)
                            {
                                dtScript = DALDataAccess.GetObjectScript(this.mHt["USER"].ToString(), dr["INDEX_NAME"].ToString());

                                tbx.Text += "\r\n\r\n\r\n";
                                tbx.Text += string.Format("{0};", dtScript.Rows[0]["SCRIPT"].ToString().Trim()).Replace("\n", "\r\n");
                            }
                        }
                    }
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Add a node to the TreeView
        /// Node Tag points to all the information related to that node
        /// in a class of type 'clsDatasetTreeNode'
        /// </summary>
        /// <param name="mdataNode"></param>
        private void AddDataNode(clsDatasetTreeNode dataNodeToAdd)
        {
            TreeNode tn;

            if ((mDataTab.Controls.Count == 0) &&
                (mhtDatasets.ContainsKey("Expressions") ||
                 mhtDatasets.ContainsKey("Protein Info") ||
                 mhtDatasets.ContainsKey("Factors")))
            {
                #region Add Controls on tab page

                var dataGridTab = new ucDataGridView();
                mExpressionsTab = new TabPage();
                mDataTab.Controls.Add(mExpressionsTab);
                mExpressionsTab.Name = "ctltabPageData";
                mExpressionsTab.Controls.Add(dataGridTab);
                dataGridTab.Dock = DockStyle.Fill;

                #endregion
            }

            if (dataNodeToAdd.mDTable == null)
            {
                return;
            }

            //dataNodeToAdd.mDTable.rea
            if ((tn = GetNode(dataNodeToAdd.DataText)) == null)
            {
                mExpressionsTab.TabIndex = 0;
                mExpressionsTab.Text     = dataNodeToAdd.DataText;
                ((ucDataGridView)mExpressionsTab.Controls[0]).SetDataSource = dataNodeToAdd.mDTable;

                if (dataNodeToAdd.AddDGridContextMenu)
                {
                    ((ucDataGridView)mExpressionsTab.Controls[0]).CxMenu = mCntxtMnuGrid;
                }
                if (dataNodeToAdd.AddTVContextMenu)
                {
                    dataNodeToAdd.TNode.ContextMenuStrip = mContextMenuTreeV;
                }

                if (dataNodeToAdd.ParentNode.Equals("DAnTE"))
                {
                    ctlTreeView.Nodes[0].Nodes.Add(dataNodeToAdd.TNode);
                }
                else
                {
                    var parentNode = (mhtDatasets[dataNodeToAdd.ParentNode]).TNode;
                    parentNode.Nodes.Add(dataNodeToAdd.TNode);
                }
                ctlTreeView.ExpandAll();
                ctlTreeView.SelectedNode  = dataNodeToAdd.TNode;
                statusBarPanelMsg.Text    = dataNodeToAdd.Message;
                statusBarPanelRowNum.Text = dataNodeToAdd.mDTable.Rows.Count + " Rows/" +
                                            dataNodeToAdd.mDTable.Columns.Count + " Columns.";
                dataNodeToAdd.TNode.Tag = dataNodeToAdd;
            }
            else
            {
                tn.Tag = dataNodeToAdd;
                ctlTreeView.SelectedNode = tn;
                NodeSelect(tn);
            }
        }
Exemple #6
0
        /// <summary>
        /// Add a node to the TreeView
        /// Node Tag points to all the information related to theat node
        /// in a class of type 'clsDatasetTreeNode'
        /// </summary>
        /// <param name="mdataNode"></param>
        private void AddDataNode(clsDatasetTreeNode mdataNode)
        {
            TreeNode tn;

            if ((mtabControlData.Controls.Count == 0) &&
                (mhtDatasets.ContainsKey("Expressions") ||
                 mhtDatasets.ContainsKey("Protein Info") ||
                 mhtDatasets.ContainsKey("Factors")))
            {
                #region Add Controls on tab page
                var dataGridTab = new ucDataGridView();
                this.ctltabPage = new TabPage();
                this.mtabControlData.Controls.Add(this.ctltabPage);
                this.ctltabPage.Name = "ctltabPageData";
                this.ctltabPage.Controls.Add(dataGridTab);
                dataGridTab.Dock = System.Windows.Forms.DockStyle.Fill;
                #endregion
            }

            if (mdataNode.mDTable == null)
            {
                return;
            }

            //mdataNode.mDTable.rea
            if ((tn = GetNode(mdataNode.mstrDataText)) == null)
            {
                this.ctltabPage.TabIndex = 0;
                this.ctltabPage.Text     = mdataNode.mstrDataText;
                ((ucDataGridView)this.ctltabPage.Controls[0]).SetDataSource = mdataNode.mDTable;

                if (mdataNode.mblAddDGridCtxtMnu)
                {
                    ((ucDataGridView)this.ctltabPage.Controls[0]).CxMenu = mCntxtMnuGrid;
                }
                if (mdataNode.mblAddTVCtxtMnu)
                {
                    mdataNode.mTNode.ContextMenuStrip = mContextMenuTreeV;
                }

                if (mdataNode.mstrParentNode.Equals("DAnTE"))
                {
                    ctltreeView.Nodes[0].Nodes.Add(mdataNode.mTNode);
                }
                else
                {
                    var mtnParent = (mhtDatasets[mdataNode.mstrParentNode]).mTNode;
                    mtnParent.Nodes.Add(mdataNode.mTNode);
                }
                ctltreeView.ExpandAll();
                ctltreeView.SelectedNode       = mdataNode.mTNode;
                this.statusBarPanelMsg.Text    = mdataNode.mstrMessage;
                this.statusBarPanelRowNum.Text = mdataNode.mDTable.Rows.Count + " Rows/" +
                                                 mdataNode.mDTable.Columns.Count + " Columns.";
                mdataNode.mTNode.Tag = mdataNode;
            }
            else
            {
                tn.Tag = mdataNode;
                ctltreeView.SelectedNode = tn;
                NodeSelect(tn);
            }
        }
        public void Search(Hashtable aHt)
        {
            this.Cursor = Cursors.WaitCursor;

            this.tabControl1.TabPages.Clear();

            this.mHt = aHt;
            DataTable dt = DALDataAccess.GetObjectListByObjectName(this.mHt["USER"].ToString(), this.mHt["OBJECT_NAME"].ToString());

            if (dt.Rows.Count < 1)
            {
                this.Cursor = Cursors.Default;
                this.Clear();
                return;
            }

            this.lblInfo.Text    = string.Format("[{0}] Created:{1}   Last DDL:{2}", this.mHt["OBJECT_NAME"].ToString(), dt.Rows[0]["CREATED"].ToString(), dt.Rows[0]["LAST_DDL_TIME"].ToString());
            this.tabControl1.Tag = dt.Rows[0]["OBJECT_TYPE"].ToString();

            if (dt.Rows[0]["OBJECT_TYPE"].ToString().Equals(Common.Definition.ConstValue.DBViewer_ObjectList_VALUE.TABLE))
            {
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.COLUMN);
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.DATA);
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.INDEX);
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT);
            }
            else if (dt.Rows[0]["OBJECT_TYPE"].ToString().Equals(Common.Definition.ConstValue.DBViewer_ObjectList_VALUE.VIEW))
            {
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.COLUMN);
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.DATA);
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT);
            }
            else if (dt.Rows[0]["OBJECT_TYPE"].ToString().Equals(Common.Definition.ConstValue.DBViewer_ObjectList_VALUE.FUNCTION))
            {
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT);
            }
            else if (dt.Rows[0]["OBJECT_TYPE"].ToString().Equals(Common.Definition.ConstValue.DBViewer_ObjectList_VALUE.PROCEDURE))
            {
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT);
            }
            else if (dt.Rows[0]["OBJECT_TYPE"].ToString().Equals(Common.Definition.ConstValue.DBViewer_ObjectList_VALUE.TRIGGER))
            {
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT);
            }
            else if (dt.Rows[0]["OBJECT_TYPE"].ToString().Equals(Common.Definition.ConstValue.DBViewer_ObjectList_VALUE.INDEX))
            {
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT);
            }
            else if (dt.Rows[0]["OBJECT_TYPE"].ToString().Equals(Common.Definition.ConstValue.DBViewer_ObjectList_VALUE.SEQUENCE))
            {
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT);
            }
            else if (dt.Rows[0]["OBJECT_TYPE"].ToString().Equals(Common.Definition.ConstValue.DBViewer_ObjectList_VALUE.PACKAGE))
            {
                this.tabControl1.TabPages.Add(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT);
            }

            foreach (TabPage tp in this.tabControl1.TabPages)
            {
                if (tp.Text.Equals(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.COLUMN) || tp.Text.Equals(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.INDEX))
                {
                    ucDataGridView dgv = new ucDataGridView();
                    dgv.Dock = DockStyle.Fill;
                    dgv.AllowUserToAddRows          = false;
                    dgv.AllowUserToDeleteRows       = false;
                    dgv.AllowUserToResizeRows       = false;
                    dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                    dgv.ReadOnly           = true;
                    dgv.DataSourceChanged += dgv_DataSourceChanged;

                    tp.Controls.Add(dgv);
                }
                else if (tp.Text.Equals(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.DATA))
                {
                    ucDgvQuery dgvQuery = new ucDgvQuery();
                    dgvQuery.Dock = DockStyle.Fill;
                    dgvQuery.AllowUserToAddRows          = false;
                    dgvQuery.AllowUserToDeleteRows       = false;
                    dgvQuery.AllowUserToResizeRows       = false;
                    dgvQuery.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                    dgvQuery.ReadOnly = true;

                    tp.Controls.Add(dgvQuery);
                }
                else if (tp.Text.Equals(Common.Definition.ConstValue.DBViewer_ObjectInfo_DISPLAY.SCRIPT))
                {
                    TextBox tbx = new TextBox();
                    tbx.ReadOnly  = true;
                    tbx.Multiline = true;
                    tbx.Dock      = DockStyle.Fill;

                    tp.Controls.Add(tbx);
                }
            }

            this.tabControl1_SelectedIndexChanged(this.tabControl1, null);

            this.Cursor = Cursors.Default;
        }
 public static void SetRowCellValue(this ucDataGridView aDGV, int aRowIndex, string aColName, Object aValue)
 {
     aDGV.Rows[aRowIndex].Cells[aColName].Value = aValue;
 }