Пример #1
0
        private ScheduleConfig GetConfigFromFileName(string[] args)
        {
            string     _config    = args[1];
            ConfigType configType = (ConfigType)Enum.Parse(typeof(ConfigType), _config);

            switch (configType)
            {
            case ConfigType.DoBackupConfig:
                string type = args[3];
                return(DoBackupConfig.GetInstance(type.ToUpper()));

            case ConfigType.IndexConfig:
                return(IndexConfig.GetInstance());

            case ConfigType.IntegrityCheckConfig:
                return(IntegrityCheckConfig.GetInstance());
            }
            return(null);
        }
Пример #2
0
        private void goButton_Click(object sender, EventArgs e)
        {
            StringBuilder builder = new StringBuilder();
            int           timeout = GetTimeOutValue(timeoutComboBox);

            if (goButton.Text == "Save Scheduling &Settings")
            {
                // save the scheduling configurations
                IndexConfig config        = IndexConfig.GetInstance();
                string      operationName = "Index Optimize";

                bool success = SaveConfigurations(config) && ScheduleOperation(operationName, config, @"-c IndexConfig");
                if (success) // All Validation passed.
                {
                    MessageBox.Show("Configuration Saved Successfully. " + operationName + " successfully " +
                                    GetDisplaySchedule(config.RunInterval, config.AdditionalInfo), "Success",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    scheduleLabel.Text = GetDisplaySchedule(config.RunInterval, config.AdditionalInfo)
                                         + ". Next Execution @ " + config.NextExecution;
                }
                else
                {
                    MessageBox.Show("Some issue in saving the configurations.", "Operation Failed",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
            else
            {
                bool success = SubmitForm(ref builder, "[IndexOptimize]", timeout);
                if (success)
                {
                    MessageBox.Show("Command Executed Successfully. Please check the log file for more details.",
                                    "Success", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
            }
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        public RunConfig()
        {
            InitializeComponent();

            InitializeDatabaseComboBox(databaseComboBox);
            InitializeTimeoutComboBox(timeoutComboBox);

            logDirectoryLabel.Text = AppDomain.CurrentDomain.BaseDirectory;
            LogDirectory           = logDirectoryLabel.Text;

            SystemConfig systemConfig = SystemConfig.GetInstance();

            if (systemConfig.AutomaticScheduling)
            {
                scheduleButton.Visible = true;
            }

            IndexConfig config = IndexConfig.GetInstance();

            if (!String.IsNullOrEmpty(config.DatabaseName))
            {
                int index = databaseComboBox.FindString(config.DatabaseName);
                if (index != -1)
                {
                    databaseComboBox.SelectedIndex = index;
                }
            }

            frag1TextBox.Text = config.FragmentationLevel1.ToString();
            frag2TextBox.Text = config.FragmentationLevel2.ToString();

            if (config.OperationSequence != null)
            {
                string[] parts = config.OperationSequence.Split(',');
                if (parts.Length > 0)
                {
                    lowCombobox.SelectedIndex = lowCombobox.FindString(parts[0]);
                }
                if (parts.Length > 1)
                {
                    mediumComboBox.SelectedIndex = mediumComboBox.FindString(parts[1]);
                }
                if (parts.Length > 2)
                {
                    highComboBox.SelectedIndex = highComboBox.FindString(parts[2]);
                }
            }

            minPageCntTextBox.Text = config.MinimumPageCountLevel.ToString();
            int i = timeoutComboBox.FindString((config.QueryExecutionTimeout / 60).ToString() + " minute");

            if (i != -1)
            {
                timeoutComboBox.SelectedIndex = i;
            }
            fillFactorTextBox.Text   = config.FillFactor.ToString();
            updateStatsComboBox.Text = GetMappedCommand(config.UpdateStatistics);
            interval       = config.RunInterval;
            additionalInfo = config.AdditionalInfo;
            if (config.NextExecution != null)
            {
                scheduleLabel.Text = GetDisplaySchedule(interval, additionalInfo)
                                     + ". Next Execution @ " + config.NextExecution;
                scheduleLabel.Visible = true;
            }
        }