Ejemplo n.º 1
0
    /// <summary>
    /// Finish button click.
    /// </summary>
    protected void FinishNextButton_Click(object sender, EventArgs e)
    {
        if (SqlInstallationHelper.DatabaseIsSeparated())
        {
            string error = String.Empty;
            // If it doesn't support OpenQuery command, data could not have been moved so we cannot delete tables.
            if (SqlServerCapabilities.SupportsOpenQueryCommand)
            {
                var separationHelper = new DatabaseSeparationHelper();

                separationHelper.InstallationConnStringSeparate = DatabaseSeparationHelper.ConnStringSeparate;
                separationHelper.InstallScriptsFolder           = SqlInstallationHelper.GetSQLInstallPathToObjects();
                separationHelper.ScriptsFolder = Server.MapPath("~/App_Data/DBSeparation");
                error = separationHelper.DeleteSourceTables(false, true);
            }

            if (!String.IsNullOrEmpty(error))
            {
                separationFinished.ErrorLabel.Visible = true;
                separationFinished.ErrorLabel.Text    = error;
                EventLogProvider.LogEvent(EventType.ERROR, "Contact management database separation", "DELETEOLDDATA", error, RequestContext.CurrentURL);
            }
            else
            {
                EnableTasks();
                TakeSitesOnline();
                WebFarmHelper.CreateTask(SystemTaskType.RestartApplication, "RestartApplication");
                ScriptHelper.RegisterStartupScript(this, typeof(string), "Close dialog", ScriptHelper.GetScript("RefreshParent(); CloseDialog();"));
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Finish button click.
    /// </summary>
    protected void FinishNextButton_Click(object sender, EventArgs e)
    {
        if (!SqlInstallationHelper.DatabaseIsSeparated())
        {
            string error = String.Empty;
            bool   dbEngineSupportsOpenqueryCommand = !DatabaseSeparationHelper.IsUsingAzureDatabase;

            if (dbEngineSupportsOpenqueryCommand)
            {
                var separationHelper = new DatabaseSeparationHelper();

                separationHelper.InstallScriptsFolder           = SqlInstallationHelper.GetSQLInstallPathToObjects();
                separationHelper.ScriptsFolder                  = Server.MapPath("~/App_Data/DBSeparation");
                separationHelper.InstallationConnStringSeparate = EncryptionHelper.DecryptData(hdnConnString.Value);
                error = separationHelper.DeleteSourceTables(separationFinished.DeleteOldDB, false);
            }

            if (!String.IsNullOrEmpty(error))
            {
                separationFinished.ErrorLabel.Visible = true;
                separationFinished.ErrorLabel.Text    = error;
                EventLogProvider.LogEvent(EventType.ERROR, "Contact management database join", "DELETEOLDDATA", error, RequestContext.CurrentURL);
            }
            else
            {
                EnableTasks();
                TakeSitesOnline();
                WebFarmHelper.CreateTask(SystemTaskType.RestartApplication, "RestartApplication", "", null);
                ScriptHelper.RegisterStartupScript(this, typeof(string), "Close dialog", ScriptHelper.GetScript("RefreshParent(); CloseDialog();"));
            }
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Finish button click.
    /// </summary>
    protected void FinishNextButton_Click(object sender, EventArgs e)
    {
        if (!SqlInstallationHelper.DatabaseIsSeparated())
        {
            string error = String.Empty;

            // If it doesn't support OpenQuery command, data could not have been moved so we cannot delete tables.
            if (SqlServerCapabilities.SupportsOpenQueryCommand)
            {
                var separationHelper = new DatabaseSeparationHelper();

                separationHelper.InstallScriptsFolder           = SqlInstallationHelper.GetSQLInstallPathToObjects();
                separationHelper.ScriptsFolder                  = Server.MapPath("~/App_Data/DBSeparation");
                separationHelper.InstallationConnStringSeparate = UnprotectConnectionString();
                error = separationHelper.DeleteSourceTables(separationFinished.DeleteOldDB, false);
            }

            if (!String.IsNullOrEmpty(error))
            {
                separationFinished.ErrorLabel.Visible = true;
                separationFinished.ErrorLabel.Text    = error;
                var logData = new EventLogData(EventTypeEnum.Error, "Contact management database join", "DELETEOLDDATA")
                {
                    EventDescription = error,
                    EventUrl         = RequestContext.CurrentURL
                };

                Service.Resolve <IEventLogService>().LogEvent(logData);
            }
            else
            {
                EnableTasks();
                WebFarmHelper.CreateTask(new RestartApplicationWebFarmTask());
                ScriptHelper.RegisterStartupScript(this, typeof(string), "Close dialog", ScriptHelper.GetScript("RefreshParent(); CloseDialog();"));
            }
        }
    }
    /// <summary>
    /// Finish button click.
    /// </summary>
    protected void FinishNextButton_Click(object sender, EventArgs e)
    {
        if (SqlInstallationHelper.DatabaseIsSeparated())
        {
            string error = String.Empty;
            // If it doesn't support OpenQuery command, data could not have been moved so we cannot delete tables.
            if (SqlServerCapabilities.SupportsOpenQueryCommand)
            {
                var separationHelper = new DatabaseSeparationHelper();

                separationHelper.InstallationConnStringSeparate = DatabaseSeparationHelper.ConnStringSeparate;
                separationHelper.InstallScriptsFolder = SqlInstallationHelper.GetSQLInstallPathToObjects();
                separationHelper.ScriptsFolder = Server.MapPath("~/App_Data/DBSeparation");
                error = separationHelper.DeleteSourceTables(false, true);
            }

            if (!String.IsNullOrEmpty(error))
            {
                separationFinished.ErrorLabel.Visible = true;
                separationFinished.ErrorLabel.Text = error;
                EventLogProvider.LogEvent(EventType.ERROR, "Contact management database separation", "DELETEOLDDATA", error, RequestContext.CurrentURL);
            }
            else
            {
                EnableTasks();
                TakeSitesOnline();
                WebFarmHelper.CreateTask(SystemTaskType.RestartApplication, "RestartApplication");
                ScriptHelper.RegisterStartupScript(this, typeof(string), "Close dialog", ScriptHelper.GetScript("RefreshParent(); CloseDialog();"));
            }
        }
    }