InputIssueList ValidateInputFieldEnumCode() { if (listViewFields.SelectedItems.Count != 0) { _inputIssuesEditFieldEnumCode = GetIssuesInFieldEnumCode(GetColumn(listViewFields.SelectedItems[0], colFieldEnumCode).Text); } else { _inputIssuesEditFieldEnumCode.Clear(); } DisplayFirstIssue(_inputIssuesEditFieldEnumCode, lblIssueEditFieldEnumCode); return(_inputIssuesEditFieldEnumCode); }
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 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); }