public static LocalizedString InvalidUpgradeStatus(string id, UpgradeStatusTypes currentStatus) { return(new LocalizedString("InvalidUpgradeStatus", UpgradeHandlerStrings.ResourceManager, new object[] { id, currentStatus })); }
private void VerifyOrganizationStateBefore() { if (this.organization.UpgradeRequest == UpgradeRequestTypes.TenantUpgradeDryRun) { if (!this.InBeforeStartOrgCmdletState()) { throw new InvalidOrganizationStateException(this.organization.ExternalDirectoryOrganizationId, this.organization.ServicePlan, this.organization.AdminDisplayVersion, this.organization.IsUpgradingOrganization, this.organization.IsPilotingOrganization, this.organization.IsUpgradeOperationInProgress); } } else { if (this.InBeforeStartOrgCmdletState()) { bool flag = this.organization.UpgradeRequest == UpgradeRequestTypes.TenantUpgrade; string text = "Start-Organization" + (flag ? "Upgrade" : "Pilot"); base.Context.Logger.Log(MigrationEventType.Information, "Need to run '{0}'", new object[] { text }); this.LogUpgradeStageWithE14Counts(new UpgradeStage?((this.organization.UpgradeRequest == UpgradeRequestTypes.TenantUpgrade) ? UpgradeStage.StartOrgUpgrade : UpgradeStage.StartPilotUpgrade)); bool configOnly = flag && base.Context.Config.GetConfig <bool>("ConfigOnly"); this.orgOperationProxy.InvokeOrganizationCmdlet(this.organization.ExternalDirectoryOrganizationId, text, configOnly); this.organization = this.orgOperationProxy.GetOrganization(this.organization.ExternalDirectoryOrganizationId); } if (this.InBeforeStartOrgCmdletState()) { throw new InvalidOrganizationStateException(this.organization.ExternalDirectoryOrganizationId, this.organization.ServicePlan, this.organization.AdminDisplayVersion, this.organization.IsUpgradingOrganization, this.organization.IsPilotingOrganization, this.organization.IsUpgradeOperationInProgress); } } UpgradeStatusTypes upgradeStatusTypes = this.organization.UpgradeStatus; if (this.organization.UpgradeRequest == UpgradeRequestTypes.PrestageUpgrade) { upgradeStatusTypes = UpgradeStatusTypes.Complete; } else if (this.organization.UpgradeRequest == UpgradeRequestTypes.TenantUpgrade || this.organization.UpgradeRequest == UpgradeRequestTypes.TenantUpgradeDryRun) { upgradeStatusTypes = ((this.organization.UpgradeStatus == UpgradeStatusTypes.Warning) ? UpgradeStatusTypes.Warning : UpgradeStatusTypes.InProgress); } if (upgradeStatusTypes != this.organization.UpgradeStatus) { base.Context.Logger.Log(MigrationEventType.Information, "Changing Status from '{0}' to '{1}'", new object[] { this.organization.UpgradeStatus, upgradeStatusTypes }); this.orgOperationProxy.SetOrganization(this.organization, upgradeStatusTypes, this.organization.UpgradeRequest, string.Empty, string.Empty, this.organization.UpgradeStage, -1, -1); } }
void IOrganizationOperation.SetUser(RecipientWrapper user, UpgradeStatusTypes status, UpgradeRequestTypes request, string message, string details, UpgradeStage?stage) { PSCommand pscommand = new PSCommand(); pscommand.AddCommand("Set-User"); pscommand.AddParameter("Identity", user.Id.ToDNString()); if (user.UpgradeStatus != status) { pscommand.AddParameter("UpgradeStatus", status); user.UpgradeStatus = status; } if (user.UpgradeRequest != request) { pscommand.AddParameter("UpgradeRequest", request); user.UpgradeRequest = request; } if (user.UpgradeMessage != message) { pscommand.AddParameter("UpgradeMessage", message); user.UpgradeMessage = message; } if (user.UpgradeDetails != details) { pscommand.AddParameter("UpgradeDetails", details); user.UpgradeDetails = details; } if (user.UpgradeStage != stage) { pscommand.AddParameter("UpgradeStage", stage); user.UpgradeStage = stage; user.UpgradeStageTimeStamp = ((stage != null) ? new DateTime?(DateTime.UtcNow) : null); pscommand.AddParameter("UpgradeStageTimeStamp", user.UpgradeStageTimeStamp); } if (pscommand.Commands[0].Parameters.Count > 1) { this.RunPSCommandForOrgOrUser(pscommand); return; } this.Context.Logger.Log(MigrationEventType.Information, "Set-User will not be invoked because no property values have been changed", new object[0]); }
void IOrganizationOperation.SetOrganization(TenantOrganizationPresentationObjectWrapper tenant, UpgradeStatusTypes status, UpgradeRequestTypes request, string message, string details, UpgradeStage?upgradeStage, int e14MbxCountForCurrentStage, int nonUpgradeMoveRequestCount) { PSCommand pscommand = new PSCommand(); pscommand.AddCommand("Set-Organization"); pscommand.AddParameter("Identity", tenant.ExternalDirectoryOrganizationId); if (tenant.UpgradeStatus != status) { tenant.UpgradeStatus = status; pscommand.AddParameter("UpgradeStatus", status); } if (tenant.UpgradeRequest != request) { tenant.UpgradeRequest = request; pscommand.AddParameter("UpgradeRequest", request); } if (tenant.UpgradeMessage != message) { tenant.UpgradeMessage = message; pscommand.AddParameter("UpgradeMessage", message); } if (tenant.UpgradeDetails != details) { tenant.UpgradeDetails = details; pscommand.AddParameter("UpgradeDetails", details); } if (upgradeStage != UpgradeStage.None) { DateTime?dateTime = (upgradeStage != null) ? new DateTime?(DateTime.UtcNow) : null; if (tenant.UpgradeStage != upgradeStage) { tenant.UpgradeStage = upgradeStage; pscommand.AddParameter("UpgradeStage", upgradeStage); tenant.UpgradeStageTimeStamp = dateTime; pscommand.AddParameter("UpgradeStageTimeStamp", dateTime); } if (upgradeStage == null || tenant.UpgradeE14MbxCountForCurrentStage != e14MbxCountForCurrentStage) { tenant.UpgradeE14MbxCountForCurrentStage = ((upgradeStage != null) ? new int?(e14MbxCountForCurrentStage) : null); pscommand.AddParameter("UpgradeE14MbxCountForCurrentStage", tenant.UpgradeE14MbxCountForCurrentStage); } if (upgradeStage == null || tenant.UpgradeE14RequestCountForCurrentStage != nonUpgradeMoveRequestCount) { tenant.UpgradeE14RequestCountForCurrentStage = ((upgradeStage != null) ? new int?(nonUpgradeMoveRequestCount) : null); pscommand.AddParameter("UpgradeE14RequestCountForCurrentStage", tenant.UpgradeE14RequestCountForCurrentStage); } tenant.UpgradeLastE14CountsUpdateTime = ((upgradeStage != null) ? dateTime : null); pscommand.AddParameter("UpgradeLastE14CountsUpdateTime", tenant.UpgradeLastE14CountsUpdateTime); } this.RunPSCommandForOrgOrUser(pscommand); }
private void SetOrganization(TenantOrganizationPresentationObjectWrapper tenant, UpgradeStatusTypes workitemStatus, UpgradeRequestTypes requestType, UpgradeStage upgradeStage = UpgradeStage.None) { base.Context.Logger.Log(MigrationEventType.Information, "updating {0} organization with status {1} and type {2}", new object[] { tenant.ExternalDirectoryOrganizationId, workitemStatus, requestType }); this.orgOperationProxy.SetOrganization(tenant, workitemStatus, requestType, string.Empty, string.Empty, new UpgradeStage?(upgradeStage), -1, -1); this.tenantUpdatedCount++; }
public InvalidUpgradeStatusException(string id, UpgradeStatusTypes currentStatus, Exception innerException) : base(UpgradeHandlerStrings.InvalidUpgradeStatus(id, currentStatus), innerException) { this.id = id; this.currentStatus = currentStatus; }