Exemple #1
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>
    /// Gets the current export state.
    /// </summary>
    /// <param name="argument">Argument</param>
    public string GetExportState(string argument)
    {
        string result = null;

        // Get arguments
        string[] args = argument.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

        bool   cancel        = ValidationHelper.GetBoolean(args[0], false);
        int    messageLength = 0;
        int    errorLength   = 0;
        int    warningLength = 0;
        string machineName   = null;

        if (args.Length == 5)
        {
            messageLength = ValidationHelper.GetInteger(args[1], 0);
            errorLength   = ValidationHelper.GetInteger(args[2], 0);
            warningLength = ValidationHelper.GetInteger(args[3], 0);
            machineName   = ValidationHelper.GetString(args[4], null);
        }

        // Check if on same machine
        if (machineName == SqlHelperClass.MachineName.ToLower())
        {
            try
            {
                // Cancel export
                if (cancel)
                {
                    ExportManager.Settings.Cancel();
                }

                result = ExportManager.Settings.GetLimitedProgressLog(messageLength, errorLength, warningLength);
            }
            catch (Exception ex)
            {
                EventLogProvider ev = new EventLogProvider();
                ev.LogEvent("ExportWizard", "EXPORT", ex);

                result = ExportManager.Settings.GetLimitedProgressLog(messageLength, errorLength, warningLength);
            }
            finally
            {
                if (ExportManager.Settings.GetProgressState() != LogStatusEnum.Info)
                {
                    // Delete presistent data
                    PersistentStorageHelper.RemoveValue(PersistentSettingsKey);
                }
            }
        }

        return(result);
    }
 /// <summary>
 /// Runs appropriate action for specific wizard step.
 /// </summary>
 private void RunAction()
 {
     switch (wzdInstaller.ActiveStepIndex)
     {
     case 2:
         PreviousButton.Attributes.Add("disabled", "true");
         NextButton.Attributes.Add("disabled", "true");
         PersistentStorageHelper.RemoveValue(STORAGE_KEY);
         progress.StartLogging();
         asyncControl.RunAsync(StartSeparation, WindowsIdentity.GetCurrent());
         break;
     }
 }
    /// <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 #5
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>
    /// Callback event handler.
    /// </summary>
    /// <param name="argument">Callback argument</param>
    public void RaiseCallbackEvent(string argument)
    {
        // Get arguments
        string[] args          = argument.Split(new [] { ';' }, StringSplitOptions.RemoveEmptyEntries);
        bool     cancel        = ValidationHelper.GetBoolean(args[0], false);
        int      messageLength = 0;
        int      errorLength   = 0;
        int      warningLength = 0;
        string   machineName   = null;

        if (args.Length == 5)
        {
            messageLength = ValidationHelper.GetInteger(args[1], 0);
            errorLength   = ValidationHelper.GetInteger(args[2], 0);
            warningLength = ValidationHelper.GetInteger(args[3], 0);
            machineName   = ValidationHelper.GetString(args[4], null);
        }

        // Check if on same machine
        if (machineName == SystemContext.MachineName.ToLowerCSafe())
        {
            try
            {
                // Cancel Import
                if (cancel)
                {
                    ImportManager.Settings.Cancel();
                }

                hdnState.Value = ImportManager.Settings.GetLimitedProgressLog(messageLength, errorLength, warningLength);
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("ImportWizard", "IMPORT", ex);

                hdnState.Value = ImportManager.Settings.GetLimitedProgressLog(messageLength, errorLength, warningLength);
            }
            finally
            {
                if (ImportManager.Settings.GetProgressState() != LogStatusEnum.Info)
                {
                    // Delete presistent data
                    PersistentStorageHelper.RemoveValue(PersistentSettingsKey);
                }
            }
        }
    }