Ejemplo n.º 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);
         }
     }
 }