public ProgressMessagesHelper()
 {
     storageContent = PersistentStorageHelper.GetValue(STORAGE_KEY) as String;
     if (!String.IsNullOrEmpty(storageContent))
     {
         string[] items = storageContent.Split(new[] { AbstractImportExportSettings.SEPARATOR }, StringSplitOptions.None);
         state   = items[0];
         content = items[1];
     }
 }
Exemple #2
0
    /// <summary>
    /// Enables tasks after separation is over.
    /// </summary>
    private void EnableTasks()
    {
        if (ValidationHelper.GetBoolean(PersistentStorageHelper.GetValue("CMSSchedulerTasksEnabled"), false))
        {
            SettingsKeyInfoProvider.SetGlobalValue("CMSSchedulerTasksEnabled", true);

            // Restart win service
            WinServiceHelper.RestartService(WinServiceHelper.HM_SERVICE_BASENAME, false);
        }
        PersistentStorageHelper.RemoveValue("CMSSchedulerTasksEnabled");
    }
    /// <summary>
    /// Enables tasks after separation is over.
    /// </summary>
    private void EnableTasks()
    {
        if (ValidationHelper.GetBoolean(PersistentStorageHelper.GetValue("CMSSchedulerTasksEnabled"), false))
        {
            SettingsKeyInfoProvider.SetGlobalValue("CMSSchedulerTasksEnabled", true);

            // Restart win service
            WinServiceItem def = WinServiceHelper.GetServiceDefinition(WinServiceHelper.HM_SERVICE_BASENAME);
            if (def != null)
            {
                WinServiceHelper.RestartService(def.GetServiceName());
            }
        }
        PersistentStorageHelper.RemoveValue("CMSSchedulerTasksEnabled");
    }
Exemple #4
0
    /// <summary>
    /// Takes sites online.
    /// </summary>
    private void TakeSitesOnline()
    {
        var siteIDs = (List <int>)PersistentStorageHelper.GetValue("SeparateDBSites");

        if ((siteIDs != null) && (siteIDs.Count > 0))
        {
            foreach (var siteID in siteIDs)
            {
                SiteInfo site = SiteInfoProvider.GetSiteInfo(siteID);
                site.SiteIsOffline = false;
                SiteInfoProvider.SetSiteInfo(site);
            }
        }
        PersistentStorageHelper.RemoveValue("SeparateDBSites");
    }
    /// <summary>
    /// Set connection string into web.config.
    /// </summary>
    private void SetConnectionString()
    {
        string connectionStringName = DatabaseSeparationHelper.ConnStringSeparateName;
        string encodedPassword      = HttpUtility.HtmlEncode(HttpUtility.HtmlEncode(databaseDialog.Password));

        if (!SystemContext.IsRunningOnAzure)
        {
            if (!SettingsHelper.SetConnectionString(connectionStringName, databaseDialog.ConnectionString))
            {
                string connStringDisplay   = ConnectionHelper.BuildConnectionString(databaseDialog.AuthenticationType, databaseDialog.ServerName, databaseDialog.Database, databaseDialog.Username, encodedPassword, 240);
                string resultStringDisplay = "&lt;add name=\"" + connectionStringName + "\" connectionString=\"" + connStringDisplay + "\"/&gt;";

                separationFinished.ErrorLabel.Visible = true;
                separationFinished.ErrorLabel.Text    = string.Format(ResHelper.GetFileString("Install.ConnectionStringError"), resultStringDisplay);
            }
        }
        else
        {
            string connStringValue = ConnectionHelper.BuildConnectionString(databaseDialog.AuthenticationType, databaseDialog.ServerName, databaseDialog.Database, databaseDialog.Username, encodedPassword, 240, isForAzure: true);
            string connString      = "&lt;add name=\"" + connectionStringName + "\" connectionString=\"" + connStringValue + "\"/&gt;";
            string appSetting      = "&lt;Setting name=\"" + connectionStringName + "\" value=\"" + connStringValue + "\"/&gt;";

            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text    = string.Format(ResHelper.GetFileString("Install.ConnectionStringAzure"), connString, appSetting);
        }

        // If it doesn't support OpenQuery command, show info about need to do manual data move.
        if (!SqlServerCapabilities.SupportsOpenQueryCommand)
        {
            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text   += GetManualCopyText();
        }

        if (PersistentStorageHelper.GetValue("SeparateDBSites") == null)
        {
            if (!separationFinished.ErrorLabel.Visible)
            {
                separationFinished.ErrorLabel.Text += "<br />";
            }
            else
            {
                separationFinished.ErrorLabel.Visible = true;
            }
            separationFinished.ErrorLabel.Text += ResHelper.GetFileString("separationdb.startsites");
        }
    }
Exemple #6
0
    /// <summary>
    /// Set connection string into web.config.
    /// </summary>
    private void SetConnectionString()
    {
        if (!SystemContext.IsRunningOnAzure)
        {
            if (!SettingsHelper.RemoveConnectionString(DatabaseSeparationHelper.ConnStringSeparateName))
            {
                separationFinished.ErrorLabel.Visible = true;
                string resultStringDisplay = " <br/><br/><strong>&lt;add name=\"" + DatabaseSeparationHelper.ConnStringSeparateName + "\" connectionString=\"" + DatabaseSeparationHelper.ConnStringSeparate + "\"/&gt;</strong><br/><br/>";
                separationFinished.ErrorLabel.Text = GetString("separationDB.removeConnectionStringError") + resultStringDisplay;
            }
        }
        else
        {
            string connString = "&lt;add name=\"" + DatabaseSeparationHelper.ConnStringSeparateName + "\" connectionString=\"" + DatabaseSeparationHelper.ConnStringSeparate + "\"/&gt;";
            string appSetting = "&lt;Setting name=\"" + DatabaseSeparationHelper.ConnStringSeparateName + "\" value=\"" + DatabaseSeparationHelper.ConnStringSeparate + "\"/&gt;";

            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text    = String.Format(GetString("separationDB.removeConnectionStringErrorAzure"), connString, appSetting);
        }

        // If it doesn't support OpenQuery command, show info about need to do manual data move.
        if (!SqlServerCapabilities.SupportsOpenQueryCommand)
        {
            separationFinished.AzureErrorLabel.Visible = true;
            separationFinished.AzureErrorLabel.Text   += GetManualCopyText();
        }

        if (PersistentStorageHelper.GetValue("SeparateDBSites") == null)
        {
            if (!separationFinished.ErrorLabel.Visible)
            {
                separationFinished.ErrorLabel.Text += "<br />";
            }
            else
            {
                separationFinished.ErrorLabel.Visible = true;
            }
            separationFinished.ErrorLabel.Text += ResHelper.GetFileString("separationdb.startsites");
        }
    }