示例#1
0
    public bool IsDataValid()
    {
        string name;
        bool   valid;

        if (enableIdCheckBox.Checked)
        {
            name = "First Id";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("firstId");
            }

            valid = GenericHelper.CheckIntegerValue(false, startIdTextBox.Text, name, false);

            if (!valid)
            {
                startIdTextBox.Focus();
                return(false);
            }
            else
            {
                _startId = Convert.ToInt32(startIdTextBox.Text);
            }

            name = "Second Id";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("secondId");
            }

            valid = GenericHelper.CheckIntegerValue(false, endIdTextBox.Text, name, false);

            if (!valid)
            {
                endIdTextBox.Focus();
                return(false);
            }
            else
            {
                _endId = Convert.ToInt32(endIdTextBox.Text);
            }
        }

        if (enableDurationCheckBox.Checked)
        {
            name = "First Duration";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("firstDuration");
            }

            valid = GenericHelper.CheckIntegerValue(true, startDurationTextBox.Text, name, false);

            if (!valid)
            {
                startDurationTextBox.Focus();
                return(false);
            }
            else
            {
                _startDuration = Convert.ToInt32(startDurationTextBox.Text);
            }

            name = "Second Duration";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("secondDuration");
            }

            valid = GenericHelper.CheckIntegerValue(true, endDurationTextBox.Text, name, false);

            if (!valid)
            {
                endDurationTextBox.Focus();
                return(false);
            }
            else
            {
                _endDuration = Convert.ToInt32(endDurationTextBox.Text);
            }
        }

        if (enableStartTimeCheckBox.Checked)
        {
            if (dynamicStartTimeStartCheckBox.Checked)
            {
                name = "First StartTime";

                if (ConfigHandler.UseTranslation)
                {
                    name = Translator.GetText("firstStartTime");
                }

                valid = GenericHelper.CheckDynamicDateTimeValue(startDateTimeTextBox.Text, name);

                if (!valid)
                {
                    startDateTimeTextBox.Focus();
                    return(false);
                }
                else
                {
                    _startStartTime = startDateTimeTextBox.Text;
                }
            }
            else
            {
                _startStartTime = startDateTimePicker.Value.ToString();
            }

            if (dynamicStartTimeEndCheckBox.Checked)
            {
                name = "Second StartTime";

                if (ConfigHandler.UseTranslation)
                {
                    name = Translator.GetText("secondStartTime");
                }

                valid = GenericHelper.CheckDynamicDateTimeValue(endDateTimeTextBox.Text, name);

                if (!valid)
                {
                    endDateTimeTextBox.Focus();
                    return(false);
                }
                else
                {
                    _endStartTime = endDateTimeTextBox.Text;
                }
            }
            else
            {
                _endStartTime = endDateTimePicker.Value.ToString();
            }
        }

        if (enableReadsCheckBox.Checked)
        {
            name = "First Reads";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("firstReads");
            }

            valid = GenericHelper.CheckIntegerValue(true, startReadsTextBox.Text, name, true);

            if (!valid)
            {
                startReadsTextBox.Focus();
                return(false);
            }
            else
            {
                _startReads = Convert.ToInt32(startReadsTextBox.Text);
            }

            name = "Second Reads";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("secondReads");
            }

            valid = GenericHelper.CheckIntegerValue(true, endReadsTextBox.Text, name, true);

            if (!valid)
            {
                endReadsTextBox.Focus();
                return(false);
            }
            else
            {
                _endReads = Convert.ToInt32(endReadsTextBox.Text);
            }
        }

        if (enableWritesCheckBox.Checked)
        {
            name = "First Writes";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("firstWrites");
            }

            valid = GenericHelper.CheckIntegerValue(true, startWritesTextBox.Text, name, true);

            if (!valid)
            {
                startWritesTextBox.Focus();
                return(false);
            }
            else
            {
                _startWrites = Convert.ToInt32(startWritesTextBox.Text);
            }

            name = "Second Writes";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("secondWrites");
            }

            valid = GenericHelper.CheckIntegerValue(true, endWritesTextBox.Text, name, true);

            if (!valid)
            {
                endWritesTextBox.Focus();
                return(false);
            }
            else
            {
                _endWrites = Convert.ToInt32(endWritesTextBox.Text);
            }
        }

        if (enableCpuCheckBox.Checked)
        {
            name = "First Cpu";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("firstCpu");
            }

            valid = GenericHelper.CheckIntegerValue(true, startCpuTextBox.Text, name, true);

            if (!valid)
            {
                startCpuTextBox.Focus();
                return(false);
            }
            else
            {
                _startCpu = Convert.ToInt32(startCpuTextBox.Text);
            }

            name = "Second Cpu";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("secondCpu");
            }

            valid = GenericHelper.CheckIntegerValue(true, endCpuTextBox.Text, name, true);

            if (!valid)
            {
                endCpuTextBox.Focus();
                return(false);
            }
            else
            {
                _endCpu = Convert.ToInt32(endCpuTextBox.Text);
            }
        }

        if (enableSpidCheckBox.Checked)
        {
            name = "First SPID";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("firstSPID");
            }

            valid = GenericHelper.CheckIntegerValue(true, startSpidTextBox.Text, name, false);

            if (!valid)
            {
                startSpidTextBox.Focus();
                return(false);
            }
            else
            {
                _startSpid = Convert.ToInt32(startSpidTextBox.Text);
            }

            name = "Second SPID";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("secondSPID");
            }

            valid = GenericHelper.CheckIntegerValue(true, endSpidTextBox.Text, name, false);

            if (!valid)
            {
                endSpidTextBox.Focus();
                return(false);
            }
            else
            {
                _endSpid = Convert.ToInt32(endSpidTextBox.Text);
            }
        }

        if (enableRowsCheckBox.Checked)
        {
            name = "First Rows";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("firstRows");
            }

            valid = GenericHelper.CheckIntegerValue(true, startRowsTextBox.Text, name, true);

            if (!valid)
            {
                startRowsTextBox.Focus();
                return(false);
            }
            else
            {
                _startRows = Convert.ToInt32(startRowsTextBox.Text);
            }

            name = "Second Rows";

            if (ConfigHandler.UseTranslation)
            {
                name = Translator.GetText("secondRows");
            }

            valid = GenericHelper.CheckIntegerValue(true, endRowsTextBox.Text, name, true);

            if (!valid)
            {
                endRowsTextBox.Focus();
                return(false);
            }
            else
            {
                _endRows = Convert.ToInt32(endRowsTextBox.Text);
            }
        }

        return(true);
    }