public Task UpdateProteinDataAsync(ProteinUpdateType type, long updateArg, CancellationToken cancellationToken, IProgress <ProgressChangedEventArgs> progress) { // update the WuHistory table with protein info var proteinDataUpdater = new ProteinDataUpdater(this, _proteinService); proteinDataUpdater.UpdateType = type; proteinDataUpdater.UpdateArg = updateArg; return(proteinDataUpdater.ExecuteAsync(cancellationToken, progress)); }
private void RefreshProjectData(WorkUnitProteinUpdateScope scope) { var result = MessageBox.AskYesNoQuestion(Form, "Are you sure? This operation cannot be undone.", Core.Application.NameAndVersion); if (result == DialogResult.No) { return; } long id = 0; if (scope == WorkUnitProteinUpdateScope.Project) { id = Model.SelectedWorkUnitRow.ProjectID; } else if (scope == WorkUnitProteinUpdateScope.Id) { id = Model.SelectedWorkUnitRow.ID; } var proteinDataUpdater = new ProteinDataUpdater((IWorkUnitDatabase)Model.Repository, ProteinService); try { using (var dialog = new ProgressDialog((progress, token) => proteinDataUpdater.Execute(progress, scope, id, token), true)) { dialog.Text = Core.Application.NameAndVersion; dialog.ShowDialog(Form); if (dialog.Exception != null) { Logger.Error(dialog.Exception.Message, dialog.Exception); MessageBox.ShowError(Form, dialog.Exception.Message, Core.Application.NameAndVersion); } } Model.ResetBindings(true); } catch (Exception ex) { Logger.Error(ex.Message, ex); MessageBox.ShowError(Form, ex.Message, Core.Application.NameAndVersion); } }
private void UpgradeTo0920(int dbVersion) { const string upgradeVersion1String = "0.9.2"; if (dbVersion < Application.ParseVersion(upgradeVersion1String)) { // delete duplicates _logger.InfoFormat("Performing WU History database upgrade to v{0}...", upgradeVersion1String); var duplicateDeleter = new DuplicateDeleter(this, _logger); OnUpgradeExecuting(duplicateDeleter); // add columns to WuHistory table AddProteinColumns(); // update the WuHistory table with protein info var proteinDataUpdater = new ProteinDataUpdater(this, _proteinService); OnUpgradeExecuting(proteinDataUpdater); // set database version SetDatabaseVersion(upgradeVersion1String); } }
private void UpgradeToVersion092(int dbVersion) { const string upgradeVersionString = "0.9.2"; if (dbVersion < Application.ParseVersion(upgradeVersionString)) { using (var connection = new SQLiteConnection(ConnectionString)) { connection.Open(); using (var transaction = connection.BeginTransaction()) { try { _logger.InfoFormat("Performing WU History database upgrade to v{0}...", upgradeVersionString); // delete duplicates var duplicateDeleter = new DuplicateDeleter(connection, _logger); duplicateDeleter.ExecuteAsyncWithProgress(true).Wait(); // add columns to WuHistory table AddProteinColumns(connection); // update the WuHistory table with protein info var proteinDataUpdater = new ProteinDataUpdater(connection, _proteinService); proteinDataUpdater.ExecuteAsyncWithProgress(true).Wait(); // set database version SetDatabaseVersion(connection, upgradeVersionString); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw new DataException("Database upgrade failed.", ex); } } } } }