Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        public IntegrityConfig()
        {
            InitializeComponent();

            InitializeDatabaseComboBox(databaseComboBox);

            InitializeTimeoutComboBox(timeoutComboBox);

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

            SystemConfig systemConfig = SystemConfig.GetInstance();

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

            IntegrityCheckConfig config = IntegrityCheckConfig.GetInstance();

            if (!String.IsNullOrEmpty(config.DatabaseName))
            {
                int index = databaseComboBox.FindString(config.DatabaseName);
                if (index != -1)
                {
                    databaseComboBox.SelectedIndex = index;
                }
            }
            physicalCheckBox.Checked = config.PhysicalOnly.Equals("Y") ? true : false;
            GetCheckBoxText(physicalCheckBox);

            indexesCheckBox.Checked = config.ExcludeIndexes.Equals("Y") ? true : false;
            GetCheckBoxText(indexesCheckBox);

            extendedChecksCheckBox.Checked = config.ExtendedLogicalChecks.Equals("Y") ? true : false;
            GetCheckBoxText(extendedChecksCheckBox);

            interval       = config.RunInterval;
            additionalInfo = config.AdditionalInfo;

            if (!String.IsNullOrEmpty(config.CheckCommand))
            {
                int index = commandComboBox.FindString(GetMappedCommand(config.CheckCommand));
                if (index != -1)
                {
                    commandComboBox.SelectedIndex = index;
                }
            }

            commandComboBox.SelectedIndex = commandComboBox.FindString(GetMappedCommand(config.CheckCommand));
        }
Exemple #2
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);
        }
Exemple #3
0
        private void okButton_Click(object sender, EventArgs e)
        {
            StringBuilder builder = new StringBuilder();
            int           timeout = GetTimeOutValue(timeoutComboBox);

            if (okButton.Text == "Save Scheduling &Settings")
            {
                // save the scheduling configurations
                IntegrityCheckConfig config = IntegrityCheckConfig.GetInstance();
                string operationName        = "Integrity Check Config";
                bool   success = SaveConfigurations(config) && ScheduleOperation(operationName, config, @"-c IntegrityCheckConfig");
                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
            {
                bool success = SubmitForm(ref builder, "[DatabaseIntegrityCheck]", timeout);
                if (success)
                {
                    MessageBox.Show("Command Executed Successfully. Please check the log file"
                                    + "for more details.", "Print Commands output",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
                else
                {
                    MessageBox.Show(builder.ToString(), "Validation Errors",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
        }