예제 #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 OnCreateRCADDB()
        {
            if (ConnectionValid && _desiredServer != null && !string.IsNullOrEmpty(Database))
            {
                if (LocalDatabases.Contains(Database))
                {
                    IMessageVisualizer mesg = Resolve <IMessageVisualizer>();
                    mesg.Show("Error",
                              string.Format("Error: Database with name {0} exists on selected instance, please select another name or delete the existing database first.", Database),
                              MessageButtons.OK);
                    Database = null;
                    return;
                }

                CreatingDB = true;
                rCADConnection ssisOleConn = new rCADConnection();
                ssisOleConn.Database     = Database;
                ssisOleConn.Instance     = Instance;
                ssisOleConn.Host         = Host;
                ssisOleConn.SecurityType = SecurityType.WindowsAuthentication;
                ssisOleConn.Provider     = "SQLNCLI10.1";

                if (!UsingSQLExpress)
                {
                    CreateRCADDBArgs args = new CreateRCADDBArgs()
                    {
                        TargetInstance       = _desiredServer,
                        RCADConnectionString = ssisOleConn.BuildConnectionString(),
                        InstallDirectory     = _installDirectory,
                        DataDirectory        = _dataDirectory,
                        LoadRCADDBPackage    = _rCADLoaderSSISPkg,
                        RCADDatabaseName     = Database
                    };
                    StatusMessage = CREATING_RCAD_DB_MESSAGE;
                    _workerDTS.RunWorkerAsync(args);
                }
                else
                {
                    CreateRCADDBArgs args = new CreateRCADDBArgs()
                    {
                        TargetInstance   = _desiredServer,
                        RCADDatabaseName = Database,
                        TargetSQLFile    = ScriptTargetFile,
                        InstallDirectory = _installDirectory,
                        DataDirectory    = _dataDirectory
                    };
                    StatusMessage = CREATING_RCAD_DB_INSTALLSCRIPT;
                    _workerSQLCMD.RunWorkerAsync(args);
                }
            }
        }
예제 #3
0
        private void OnRemoveConnection()
        {
            IMessageVisualizer messageVisualizer = Resolve <IMessageVisualizer>();

            if (SelectedFilter != null &&
                messageVisualizer.Show("Delete Existing Connection",
                                       "Are you sure you want to delete " + SelectedFilter.Name,
                                       MessageButtons.YesNo) == MessageResult.Yes)
            {
                Filters.Remove(SelectedFilter);
                SelectedFilter.Dispose();
                SelectedFilter = null;
            }
        }
예제 #4
0
        private void OnCalculatePi()
        {
            IMessageVisualizer messageVisualizer = Resolve <IMessageVisualizer>();
            var result = messageVisualizer.Show("Calculating Pi",
                                                "This operation takes a long time. Are you sure you want to proceed?",
                                                new MessageVisualizerOptions(UICommand.YesNo));

            if (result == UICommand.Yes)
            {
                IDisposable waitNotify = Resolve <INotificationVisualizer>().BeginWait("Working", "Calculating Pi.. Please Wait");

                Task.Factory.StartNew(() =>
                {
                    Thread.Sleep(5000);
                    PiText = Math.PI.ToString();
                })
                .ContinueWith(t => waitNotify.Dispose(), TaskScheduler.FromCurrentSynchronizationContext());
            }
        }
예제 #5
0
 private void OnRefreshDBList()
 {
     if (_desiredServer != null)
     {
         _desiredServer.Refresh();
         _localDatabases.Clear();
         foreach (Database db in _desiredServer.Databases)
         {
             _localDatabases.Add(db.Name);
         }
     }
     else
     {
         IMessageVisualizer mesg = Resolve <IMessageVisualizer>();
         mesg.Show("Error",
                   string.Format("Error: Invalid or missing database connection, failed to update list."),
                   MessageButtons.OK);
     }
 }
예제 #6
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);
         }
     }
 }
예제 #7
0
        private void InitializeEnvironment()
        {
            try
            {
                RegistryKey rCADLoaderKey = Registry.LocalMachine.OpenSubKey(RCADLOADER_KEY);
                if (rCADLoaderKey != null)
                {
                    if (rCADLoaderKey.GetValue(INSTALLDIR_KEY, null) != null && rCADLoaderKey.GetValueKind(INSTALLDIR_KEY) == RegistryValueKind.String)
                    {
                        _installDirectory = rCADLoaderKey.GetValue(INSTALLDIR_KEY).ToString();
                    }
                    else
                    {
                        IMessageVisualizer mesg = Resolve <IMessageVisualizer>();
                        mesg.Show("Fatal",
                                  string.Format("Unable to find Registry SubKey {0} in Key {1}, installation corrupted!", INSTALLDIR_KEY, RCADLOADER_KEY),
                                  MessageButtons.OK);
                        App.Current.Shutdown();
                    }

                    if (rCADLoaderKey.GetValue(SSISPACKAGE_KEY, null) != null && rCADLoaderKey.GetValueKind(SSISPACKAGE_KEY) == RegistryValueKind.String)
                    {
                        _rCADLoaderSSISPkg = rCADLoaderKey.GetValue(SSISPACKAGE_KEY).ToString();
                    }
                    else
                    {
                        IMessageVisualizer mesg = Resolve <IMessageVisualizer>();
                        mesg.Show("Fatal",
                                  string.Format("Unable to find Registry SubKey {0} in Key {1}, installation corrupted!", SSISPACKAGE_KEY, RCADLOADER_KEY),
                                  MessageButtons.OK);
                        App.Current.Shutdown();
                    }

                    if (rCADLoaderKey.GetValue(DATADIR_KEY, null) != null && rCADLoaderKey.GetValueKind(DATADIR_KEY) == RegistryValueKind.String)
                    {
                        _dataDirectory = rCADLoaderKey.GetValue(DATADIR_KEY).ToString();
                    }
                    else
                    {
                        IMessageVisualizer mesg = Resolve <IMessageVisualizer>();
                        mesg.Show("Fatal",
                                  string.Format("Unable to find Registry SubKey {0} in Key {1}, installation corrupted!", DATADIR_KEY, RCADLOADER_KEY),
                                  MessageButtons.OK);
                        App.Current.Shutdown();
                    }
                }
                else
                {
                    IMessageVisualizer mesg = Resolve <IMessageVisualizer>();
                    mesg.Show("Fatal",
                              string.Format("Unable to find Local Machine Registry Key {0}, installation corrupted!", RCADLOADER_KEY),
                              MessageButtons.OK);
                    App.Current.Shutdown();
                } //Error condition, failed to open TaxonomyUpdater registry key
            }
            catch
            {
                IMessageVisualizer mesg = Resolve <IMessageVisualizer>();
                mesg.Show("Fatal",
                          string.Format("Unknown Error reading Application configuration from Registry, installation corrupted"),
                          MessageButtons.OK);
                App.Current.Shutdown();
            } //Error condition, failed to initialize directories
        }