Exemple #1
0
 public void handleErrorMarking(List <TextBox> list, int flagToCheck, valueCheckResult checkResult, Color color, Color colorToSkip)
 {
     if ((checkResult.type & flagToCheck) != 0)
     {
         this.colorBoxes(list, color, colorToSkip);
     }
 }
Exemple #2
0
        public valueCheckResult getInputErrors(String tag, int value)
        {
            valueCheckResult result = new valueCheckResult();

            result.type      = (int)invalidityType.none;
            result.offenders = new List <TextBox>();

            int subGroupIndex = tag[0] - '0';
            int lineIndex     = tag[1] - '0';
            int columnIndex   = tag[2] - '0';

            result = this.checkForErrors(subPanels[subGroupIndex].inputFields, (int)invalidityType.box, value, result, tag);
            result = this.checkForErrors(lines[lineIndex], (int)invalidityType.line, value, result, tag);
            result = this.checkForErrors(columns[columnIndex], (int)invalidityType.column, value, result, tag);

            return(result);
        }
Exemple #3
0
        public void validateField(TextBox inputField, int value)
        {
            valueCheckResult checkResult = this.getInputErrors(inputField.Tag.ToString(), value);

            int subGroupIndex = inputField.Tag.ToString()[0] - '0';
            int lineIndex     = inputField.Tag.ToString()[1] - '0';
            int columnIndex   = inputField.Tag.ToString()[2] - '0';

            if (checkResult.type != (int)invalidityType.none)
            {
                this.handleErrorMarking(subPanels[subGroupIndex].inputFields, (int)invalidityType.box, checkResult, Color.Red, Color.DarkRed);
                this.handleErrorMarking(lines[lineIndex], (int)invalidityType.line, checkResult, Color.Red, Color.DarkRed);
                this.handleErrorMarking(columns[columnIndex], (int)invalidityType.column, checkResult, Color.Red, Color.DarkRed);

                checkResult.offenders.Add(inputField);
                this.colorBoxes(checkResult.offenders, Color.DarkRed, Color.DarkOrchid);

                hasErrors = true;
            }
        }
Exemple #4
0
        public valueCheckResult checkForErrors(List <TextBox> list, int errorValue, int value, valueCheckResult resultToModify, String tag)
        {
            foreach (TextBox textBox in list)
            {
                if (this.extractValue(textBox) == value && textBox.Tag.ToString() != tag)
                {
                    resultToModify.type |= errorValue;
                    resultToModify.offenders.Add(textBox);
                    break;
                }
            }

            return(resultToModify);
        }