public static DescribedResult <bool> IsValidRawCheckedContainerIdentification(string rawCheckedContainerIdentificationValue) { var isValid = Utilities.CheckedContainerIdentificationRegex.IsMatch(rawCheckedContainerIdentificationValue); if (!isValid) { return(DescribedResult.FromValue(false, $"Container identification must be 3 upper-case letters, an upper-case letter, 6 numbers, and a number (11 characters). Example: ZEPU0037255.\nFound: {rawCheckedContainerIdentificationValue}")); } return(DescribedResult.FromValue(true)); }
public static DescribedResult <bool> IsValidCheckDigit(string checkDigitStringValue) { var isValid = Utilities.CheckDigitRegex.IsMatch(checkDigitStringValue); if (!isValid) { return(DescribedResult.FromValue(false, $"Check digit must be a single (1) number (not a letter). Examples: 1, 2, 3.\nFound: {checkDigitStringValue}.")); } return(DescribedResult.FromValue(true)); }
public static DescribedResult <bool> IsValidCheckDigit(int checkDigitValue) { var isValid = checkDigitValue > -1 && checkDigitValue < 10; if (!isValid) { return(DescribedResult.FromValue(false, $"Check digit must be a single (1) number (not a letter) between 0 and 9. Examples: 1, 2, 3.\nFound: {checkDigitValue}.")); } return(DescribedResult.FromValue(true)); }
public static DescribedResult <bool> IsValidSerialNumber(int serialNumberNumericValue) { var isWithinRange = serialNumberNumericValue > -1 && serialNumberNumericValue < 1_000_000; if (!isWithinRange) { return(DescribedResult.FromValue(false, MessageHelper.AllowedRange(0, 999_999))); } return(DescribedResult.FromValue(true)); }
public static DescribedResult <bool> IsValidSerialNumber(string serialNumberValue) { var isValid = Utilities.SerialNumberRegex.IsMatch(serialNumberValue); if (!isValid) { return(DescribedResult.FromValue(false, $"Serial number must be exactly six (6) numbers (no letters). Examples: 123456, 789012, 555555.\nFound: {serialNumberValue}.")); } return(DescribedResult.FromValue(true)); }
/// <summary> /// Per 3.1.1 - Owner code must be three (3) capital letters (not numbers). /// </summary> public static DescribedResult <bool> IsValidOwnerCode(string ownerCodeValue) { var isValid = Utilities.OwnerCodeRegex.IsMatch(ownerCodeValue); if (!isValid) { return(DescribedResult.FromValue(false, $"Owner code must be exactly three (3) upper-case letters (not numbers). Examples: XYZ, ABC, or TUV.\nFound: {ownerCodeValue}.")); } return(DescribedResult.FromValue(true)); }
public static DescribedResult <bool> IsValidEquipmentCategory(string equipmentCategoryString) { switch (equipmentCategoryString) { case Constants.EquipmentCategoryJStandardString: case Constants.EquipmentCategoryUStandardString: case Constants.EquipmentCategoryZStandardString: return(DescribedResult.FromValue(true)); default: return(DescribedResult.FromValue(false, MessageHelper.AllowedValues(Constants.EquipmentCategoryStandardStrings))); } }
/// <summary> /// Determines whether the input character is a valid container identification marker character. /// (Must be a number 0-9, or an upper-case letter, A-Z.) /// </summary> public static DescribedResult <bool> IsValidCharacter(char character) { var characterString = character.ToString(); var isValid = Utilities.ValidCharacterRegex.IsMatch(characterString); if (!isValid) { return(DescribedResult.FromValue(false, $"Character must be a number 0-9, or an upper-case letter A-Z.\nFound: {character}.")); } return(DescribedResult.FromValue(true)); }