public LoaderViewModel() { ExitCommand = new DelegatingCommand(OnExit, OnCanExit); CreateRCADDBCommand = new DelegatingCommand(OnCreateRCADDB, OnCanCreateRCADDB); PreviousCommand = new DelegatingCommand(OnPreviousStep, OnCanGoToPreviousStep); NextCommand = new DelegatingCommand(OnNextStep, OnCanGoToNextStep); TestDBConnectionCommand = new DelegatingCommand(OnTestDBConnection); RefreshDBListCommand = new DelegatingCommand(OnRefreshDBList, OnCanRefreshDBList); SelectScriptTargetFileCommand = new DelegatingCommand(OnSelectTargetScriptFile, OnCanSelectScriptTargetFile); _connection = new rCADConnection(); _connection.Host = "."; _connection.Instance = string.Empty; _connection.Database = string.Empty; _connection.SecurityType = SecurityType.WindowsAuthentication; _step = 1; _localDatabases = new ObservableCollection <string>(); _workerDTS = new BackgroundWorker(); _workerDTS.DoWork += new DoWorkEventHandler(BackgroundCreateRCADDB_DTS); _workerDTS.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundCreateRCADDBCompleted); _workerSQLCMD = new BackgroundWorker(); _workerSQLCMD.DoWork += new DoWorkEventHandler(BackgroundCreateRCADDB_SQLCMD); _workerSQLCMD.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundCreateRCADDBCompleted); UsingSQLExpress = false; ScriptTargetFile = string.Empty; InitializeEnvironment(); }
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); } } }
public TaxonomyUpdaterViewModel() { ExitCommand = new DelegatingCommand(OnExit, OnCanExit); TestDBConnectionCommand = new DelegatingCommand(OnTestDBConnection); UpdateTaxonomyCommand = new DelegatingCommand(OnUpdateTaxonomy, OnCanUpdateTaxonomy); _updatingDB = false; _instanceDatabases = new ObservableCollection <string>(); _connection = new rCADConnection(); _connection.Host = "."; _connection.Instance = string.Empty; _connection.Database = string.Empty; _connection.SecurityType = SecurityType.WindowsAuthentication; _worker = new BackgroundWorker(); _worker.DoWork += new DoWorkEventHandler(BackgroundUpdateTaxonomy); _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundUpdateTaxonomyCompleted); }
private void MapAlignmentToRCAD(rCADConnection connection) { string connectionString = connection.BuildConnectionString(); MappingToRCAD = true; RCADMappingStatus = MAPPING_ALIGNMENT_MESSAGE; CommandManager.InvalidateRequerySuggested(); RCADMappingArgs args = new RCADMappingArgs() { ConnectionString = connectionString, Database = connection.Database }; _worker = new BackgroundWorker(); _worker.DoWork += new DoWorkEventHandler(MapAlignmentToRCADWorker); _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(MapAlignmentToRCADWorkerCompleted); _worker.RunWorkerAsync(args); }
private void OnUpdateTaxonomy() { UpdatingDB = true; StatusMessage = UPDATING_TAXONOMY; rCADConnection oleConn = new rCADConnection(); oleConn.Instance = Instance; oleConn.Host = Host; oleConn.SecurityType = SecurityType.WindowsAuthentication; oleConn.Database = Database; oleConn.Provider = "SQLNCLI10.1"; TaxonomyLoaderArgs args = new TaxonomyLoaderArgs { ConnectionString = oleConn.BuildConnectionString(), DatabaseName = Database }; _worker.RunWorkerAsync(args); }
public LoadingViewModel() { NextCommand = new DelegatingCommand(OnNextStep, OnCanGoToNextStep); PreviousCommand = new DelegatingCommand(OnPreviousStep, OnCanGoToPreviousStep); ExitCommand = new DelegatingCommand(OnExit, OnCanExit); LoadAlignmentCommand = new DelegatingCommand(OnLoadAlignment, OnCanLoadAlignment); ClearAlignmentCommand = new DelegatingCommand(OnClearAlignment, () => IsAlignmentLoaded); TestDBConnectionCommand = new DelegatingCommand(OnTestDBConnection); SelectOutputDirectoryCommand = new DelegatingCommand(OnSelectOutputDirectory); _instanceDatabases = new ObservableCollection <string>(); _rCADConnection = new rCADConnection(); _rCADConnection.Host = "."; _rCADConnection.Instance = string.Empty; _rCADConnection.Database = string.Empty; _step = 1; _loadingAlignmentStatusMessage = string.Empty; UsingSQLExpress = false; Initialize(); }