Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="table"></param>
        public DBViewerDataGrid(DataTable table) : this()
        {
            this.SuspendLayout();
            string[] databaseInfo = table.TableName.Split(new char[] { '.' });

            // default properties for the DBViewerDataGrid Form.
            this.Text        = table.TableName;
            this.Icon        = new Icon(this.GetType(), "DBViewer.ico");
            this.WindowState = FormWindowState.Maximized;

            // creates database data grid.
            table.TableName = databaseInfo[databaseInfo.Length - 1];
            data            = new DatabaseDataGrid(table);
            data.Parent     = this;
            data.Dock       = DockStyle.Fill;
            if (DBViewerConstants.AdminMode)
            {
                foreach (DBViewerConstants.TableRule TableRule in DBViewerConstants.AdminTables)
                {
                    if (table.TableName == TableRule.TableName)
                    {
                        if (TableRule.ReadOnly == true)
                        {
                            data.ReadOnly = true;
                        }
                        else
                        {
                            data.ReadOnly = false;
                        }
                    }
                }
            }
            else
            {
                foreach (DBViewerConstants.TableRule TableRule in DBViewerConstants.UserTables)
                {
                    if (table.TableName == TableRule.TableName)
                    {
                        if (TableRule.ReadOnly == true)
                        {
                            data.ReadOnly = true;
                        }
                        else
                        {
                            data.ReadOnly = false;
                        }
                    }
                }
            }

            // initializes the main menu.
            InitializeMenu();

            // Fixes bug: opening a tableview form ruins z-order
            DBViewerGui.instance.BringToFront();

            this.ResumeLayout();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="table"></param>
        public DBViewerDataGrid(DataTable table) : this()
        {
            this.SuspendLayout();
            string[] databaseInfo = table.TableName.Split(new char[] { '.' });

            // default properties for the DBViewerDataGrid Form.
            this.Text        = table.TableName;
            this.Icon        = new Icon(this.GetType(), "DBViewer.ico");
            this.WindowState = FormWindowState.Maximized;

            // creates database data grid.
            table.TableName = databaseInfo[databaseInfo.Length - 1];
            data            = new DatabaseDataGrid(table);
            data.Parent     = this;
            data.Dock       = DockStyle.Fill;

            // initializes the main menu.
            InitializeMenu();

            this.ResumeLayout();
        }