private void EventManager_DatabaseTransferComplete(DatabaseTransferEventArgs e) { _progressdialog.ItemProgress.Value = 100; _progressdialog.ItemText = string.Format("Deployed \"{0}\"...", e.DatabaseObject.Name); _progressdialog.TotalProgress.Value++; _progressdialog.TotalText = string.Format("Objects: {0}/{1}", _progressdialog.TotalProgress.Value, _progressdialog.TotalProgress.Maximum); UpdateProgressPercent(); GLItem item = FindDatabaseListItem(e.DatabaseObject.Name); if (item == null) return; // Completed ProgressBar pb = (ProgressBar) item.SubItems[(int) DatabaseListColumns.Progress].Control; pb.Value = 100; CheckDeployAbort(); Application.DoEvents(); }
/// <summary> /// Deploys the source database to the destination database. Only stored procedures, views and functions /// are deployed. /// </summary> internal void DeployDatabase(DatabaseDeploymentStructure structure) { EventManager.OnNotificationMessage("Starting deployment..."); InitializeServices(structure.Databases); try { // Deploy objects foreach(IDatabaseObject obj in structure.DatabaseObjects) { if(obj.IncludeInDeployment) { bool retry; do { retry = false; // Assume we won't retry operation try { // Signal that deployment started DatabaseTransferEventArgs e = new DatabaseTransferEventArgs(obj); EventManager.OnDatabaseTransferBegin(e); obj.Deploy(_sourceDbService, _destinationDbService); // Signal that deployment completed EventManager.OnDatabaseTransferComplete(e); } catch (DeployCancelException) { throw; } catch (Exception ex) { DeployErrorForm dlg = new DeployErrorForm(); dlg.ErrorMessage = ex.Message; dlg.SetLocalInfo("Object Name:", obj.Name); dlg.SetRemoteInfo("Type:", obj.TypeName); DialogResult result = dlg.ShowDialog(); switch (result) { case DialogResult.Retry: retry = true; break; case DialogResult.Ignore: break; // Skip to next file case DialogResult.Cancel: throw new DeployCancelException("User cancelled."); } } } while (retry); } } } catch (DeployCancelException ex) { // Deployment has been cancelled EventManager.OnNotificationMessage("*** Deployment stopped! " + ex.Message); } ShutdownServices(); EventManager.OnNotificationMessage("Deployment completed."); }
private void EventManager_DatabaseTransferBegin(DatabaseTransferEventArgs e) { _progressdialog.ItemText = string.Format("Deploying \"{0}\"...", e.DatabaseObject.Name); _progressdialog.ItemProgress.Value = 50; GLItem item = FindDatabaseListItem(e.DatabaseObject.Name); if (item == null) return; // Indicate progress ProgressBar pb = (ProgressBar) item.SubItems[(int) DatabaseListColumns.Progress].Control; pb.Value = 50; CheckDeployAbort(); Application.DoEvents(); }