コード例 #1
0
 /// <summary>
 /// DBViewerGui Instance - Singelton.
 /// </summary>
 /// <returns></returns>
 public static DBViewerGui Instance()
 {
     if (instance == null)
     {
         instance = new DBViewerGui();
     }
     return(instance);
 }
コード例 #2
0
        private void SendRequestForDataTableView()
        {
            if (CalculateNodeHierarchy(this.SelectedNode) == (int)DatabaseTreeViewHierarchy.Table)
            {
                string   path      = this.SelectedNode.FullPath;
                string[] arguments = path.Split(this.PathSeparator[0]);

                DBViewerGui.Instance().ViewDataTable(arguments[1], arguments[2], arguments[3]);
            }
        }
コード例 #3
0
 static void Main()
 {
     try
     {
         Application.EnableVisualStyles();
         Application.Run(DBViewerGui.Instance());
     }
     catch
     {
         // catches all exceptions.
     }
 }
コード例 #4
0
ファイル: DatabaseDataGrid.cs プロジェクト: cupton31/DBViewer
        /// <summary>
        /// Saves database table.
        /// </summary>
        public void SaveDatabaseTable()
        {
            // gets the db info (server, database, table).
            string[] databaseInfo = GetDatabaseInfo(this.Parent.Text);
            // adds the deleted rows to the table.
            DataTable table = RestoreDeletedRowsInDataSource();

            DBViewerGui.Instance().SaveDatabaseTable(databaseInfo[0], databaseInfo[1], databaseInfo[2], table);
            //deleted data reseted.
            deletedRows.Clear();
            //saved data marked as unchanged.
            table.AcceptChanges();
        }
コード例 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 protected override void OnBeforeExpand(TreeViewCancelEventArgs e)
 {
     base.OnBeforeExpand(e);
     //TODO: add a check the eliminates the need ot expand it every time.
     if (CalculateNodeHierarchy(e.Node) == (int)DatabaseTreeViewHierarchy.Server)
     {
         ArrayList databases = new ArrayList();
         foreach (TreeNode node in e.Node.Nodes)
         {
             databases.Add(node.Text);
         }
         DBViewerGui.Instance().AddSqlDataTables(e.Node.Text, databases);
     }
 }
コード例 #6
0
ファイル: DBViewerGui.cs プロジェクト: cupton31/DBViewer
 static void Main()
 {
     try
     {
         Application.EnableVisualStyles();
         DBViewerConstants.connectionString   = "data source=IA-SQL01\\IALICENSE;initial catalog=LightBridgeDev;persist security info=True;user id=iadev;password=iadev;encrypt=False;trustservercertificate=False;user instance=False;context connection=False;MultipleActiveResultSets=True;App=EntityFramework";
         DBViewerConstants.EndpointMachine_Id = 2;
         Application.Run(DBViewerGui.Instance());
     }
     catch
     {
         // catches all exceptions.
     }
 }
コード例 #7
0
        /// <summary>
        /// Handles the "Add new server ..." click event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SqlServerRegistrationMenuItemClickEventHandler(object sender, EventArgs e)
        {
            DBViewerSqlServerRegistrar registrar = new DBViewerSqlServerRegistrar();

            if (registrar.ShowDialog(this) == DialogResult.OK)
            {
                // gets the server, user name and password.
                string server   = registrar.ServerName;
                string user     = registrar.UserName;
                string password = registrar.UserPassword;

                // updates the DBViewerGui that a sql server should be added.
                DBViewerGui.Instance().AddSqlServer(server, user, password);
            }

            registrar.Dispose();
        }