InputIssueList GetIssuesInFieldName(string fieldName)
        {
            InputIssueList issues = new InputIssueList();

            if (!IsAlpha(fieldName))
            {
                issues.Add(Warning.NonAlphaInFieldName);
                if (!IsComposedOf(fieldName, _validNameChars))
                {
                    issues.Add(Error.InvalidCharsInFieldName);
                }
            }
            if (fieldName.Length == 0)
            {
                issues.Add(Error.FieldNameEmpty);
            }
            else
            {
                if (!fieldName.ToLower().StartsWith(fieldName.Substring(0, 1)))
                {
                    issues.Add(Error.FieldNameNotCamelCase);
                }
            }
            return(issues);
        }
        InputIssueList ValidateInputName()
        {
            string text = txtName.Text;

            _inputIssuesName.Clear();

            if (!IsAlpha(text))
            {
                _inputIssuesName.Add(Warning.NonAlphaInName);
                if (!IsComposedOf(text, _validNameChars))
                {
                    _inputIssuesName.Add(Error.InvalidCharsInName);
                }
            }

            if (text.Length == 0)
            {
                _inputIssuesName.Add(Error.NameEmpty);
            }
            else
            {
                if (!text.ToUpper().StartsWith(text.Substring(0, 1)))
                {
                    _inputIssuesName.Add(Error.NameNotPascalCase);
                }
            }

            DisplayFirstIssue(_inputIssuesName, lblIssueName);
            return(_inputIssuesName);
        }
        InputIssueList GetIssuesInFieldEnumCode(string fieldEnumCode)
        {
            InputIssueList issues = new InputIssueList();

            if (!IsComposedOf(fieldEnumCode, _alphabet + "_"))
            {
                issues.Add(Warning.NonAlphaInFieldEnumCode);
                if (!IsComposedOf(fieldEnumCode, _validEnumCodeChars))
                {
                    issues.Add(Error.InvalidCharsInFieldEnumCode);
                }
            }
            if (!fieldEnumCode.Equals(fieldEnumCode.ToUpper()))
            {
                issues.Add(Error.FieldEnumCodeNotUpperCase);
            }
            return(issues);
        }
        InputIssueList GetIssuesInFieldDisp(string fieldDisp)
        {
            InputIssueList issues = new InputIssueList();

            if (!IsComposedOf(fieldDisp, _alphabet + " "))
            {
                issues.Add(Warning.NonAlphaInFieldDisp);
                if (!IsComposedOf(fieldDisp, _validDispChars))
                {
                    issues.Add(Warning.InvalidCharsInFieldDisp);
                }
            }
            if (!fieldDisp.Equals(fieldDisp.ToLower()))
            {
                issues.Add(Error.FieldDispNotLowerCase);
            }
            return(issues);
        }
        InputIssueList GetIssuesInFieldDefaultValue(string fieldDefaultValue)
        {
            InputIssueList issues = new InputIssueList();

            if (!IsComposedOf(fieldDefaultValue, _validDefaultValueChars))
            {
                issues.Add(Warning.InvalidCharsInFieldDefaultValue);
            }
            return(issues);
        }
        InputIssueList ValidateInputFields()
        {
            _inputIssuesFields.Clear();

            // Must be at least one field
            if (listViewFields.Items.Count == 0)
            {
                _inputIssuesFields.Add(Error.TooFewFields);
            }

            // Every field name and enum code must be unique
            for (int i = 0; i < listViewFields.Items.Count; i++)
            {
                for (int j = i + 1; j < listViewFields.Items.Count; j++)
                {
                    if (GetColumn(listViewFields.Items[i], colFieldName).Text.Equals(GetColumn(listViewFields.Items[j], colFieldName)))
                    {
                        _inputIssuesFields.Add(Error.NonUniqueFieldName);
                    }
                    if (GetColumn(listViewFields.Items[i], colFieldEnumCode).Text.Equals(GetColumn(listViewFields.Items[j], colFieldEnumCode)))
                    {
                        _inputIssuesFields.Add(Error.NonUniqueFieldEnumCode);
                    }
                }
            }

            // There must be no issues with any of the particular fields
            foreach (ListViewItem lvi in listViewFields.Items)
            {
                _inputIssuesFields += GetIssuesInFieldType(GetColumn(lvi, colFieldType).Text);
                _inputIssuesFields += GetIssuesInFieldName(GetColumn(lvi, colFieldName).Text);
                _inputIssuesFields += GetIssuesInFieldDisp(GetColumn(lvi, colFieldDisp).Text);
                _inputIssuesFields += GetIssuesInFieldDefaultValue(GetColumn(lvi, colFieldDefaultValue).Text);
                _inputIssuesFields += GetIssuesInFieldEnumCode(GetColumn(lvi, colFieldEnumCode).Text);
            }

            DisplayFirstIssue(_inputIssuesFields, lblIssueFields);

            return(_inputIssuesFields);
        }
        InputIssueList ValidateInputEnumCode()
        {
            string text = txtEnumCode.Text;

            _inputIssuesEnumCode.Clear();

            if (!IsComposedOf(text, _alphabet + "_"))
            {
                _inputIssuesEnumCode.Add(Warning.NonAlphaInEnumCode);
                if (!IsComposedOf(text, _validEnumCodeChars))
                {
                    _inputIssuesEnumCode.Add(Error.InvalidCharsInEnumCode);
                }
            }

            if (!text.Equals(text.ToUpper()))
            {
                _inputIssuesEnumCode.Add(Error.EnumCodeNotUpperCase);
            }

            DisplayFirstIssue(_inputIssuesEnumCode, lblIssueEnumCode);
            return(_inputIssuesEnumCode);
        }
        InputIssueList ValidateInputDispPlural()
        {
            string text = txtDispPlural.Text;

            _inputIssuesDispPlural.Clear();

            if (!IsComposedOf(text, _alphabet + " "))
            {
                _inputIssuesDispPlural.Add(Warning.NonAlphaInDisp);
                if (!IsComposedOf(text, _validDispChars))
                {
                    _inputIssuesDispPlural.Add(Warning.InvalidCharsInDisp);
                }
            }

            if (!text.Equals(text.ToLower()))
            {
                _inputIssuesDispPlural.Add(Error.DispNotLowerCase);
            }

            DisplayFirstIssue(_inputIssuesDispPlural, lblIssueDispPlural);
            return(_inputIssuesDispPlural);
        }