예제 #1
0
 //Might want to put this in a worker thread.
 private void OnTestDBConnection()
 {
     if (!_rCADConnection.TestConnection())
     {
         IMessageVisualizer mesg = Resolve <IMessageVisualizer>();
         mesg.Show("Error",
                   string.Format("Error: Database connection test failed. Either database is not available or the configured connection is invalid."),
                   MessageButtons.OK);
         ConnectionValid = false;
     }
     else
     {
         ConnectionValid = true;
         if (Alignment != null)
         {
             Alignment.ClearRCADMapping();
         }
         //Load instance databases
         InstanceDatabases.Clear(); //If it was previously populated.
         ServerConnection conn = new ServerConnection();
         conn.ConnectionString = ConnectionString;
         Server sqlServer = new Server(conn);
         foreach (Database db in sqlServer.Databases)
         {
             InstanceDatabases.Add(db.Name);
         }
     }
 }
예제 #2
0
 private void OnTestDBConnection()
 {
     if (!_connection.TestConnection())
     {
         IMessageVisualizer mesg = Resolve <IMessageVisualizer>();
         mesg.Show("Error",
                   string.Format("Error: Database connection test failed. Either database is not available or the configured connection is invalid."),
                   MessageButtons.OK);
         ConnectionValid = false;
         _desiredServer  = null;
         _localDatabases.Clear();
     }
     else
     {
         ConnectionValid = true;
         ServerConnection conn = new ServerConnection();
         conn.ConnectionString = ConnectionString;
         _desiredServer        = new Server(conn);
         foreach (Database db in _desiredServer.Databases)
         {
             _localDatabases.Add(db.Name);
         }
     }
 }