Ejemplo n.º 1
0
        public static SerialNumberNumeric ToNumeric(SerialNumber serialNumber)
        {
            var unvalidatedSerialNumberNumeric = Utilities.ToUnvalidatedNumeric(serialNumber);

            var serialNumberNumeric = Utilities.Validate(unvalidatedSerialNumberNumeric);

            return(serialNumberNumeric);
        }
Ejemplo n.º 2
0
        public static UnvalidatedSerialNumberNumeric ToUnvalidatedNumeric(SerialNumber serialNumber)
        {
            var unvalidatedSerialNumberNumericValue = Utilities.DefaultSerialNumberToNumericConverter(serialNumber.Value);

            var unvalidatedSerialNumberNumeric = new UnvalidatedSerialNumberNumeric(unvalidatedSerialNumberNumericValue);

            return(unvalidatedSerialNumberNumeric);
        }
        public static void Validate(this SerialNumber serialNumber)
        {
            var isValid = serialNumber.IsValid();

            if (!isValid.Value)
            {
                throw new ArgumentException(isValid.Message, nameof(serialNumber));
            }
        }
        public static CheckedContainerIdentification From(this CheckedContainerIdentification containerIdentification,
                                                          OwnerCode ownerCode,
                                                          EquipmentCategory equipmentCategory,
                                                          SerialNumber serialNumber,
                                                          CheckDigit checkDigit)
        {
            containerIdentification.OwnerCode         = ownerCode;
            containerIdentification.EquipmentCategory = equipmentCategory;
            containerIdentification.SerialNumber      = serialNumber;
            containerIdentification.CheckDigit        = checkDigit;

            return(containerIdentification);
        }
Ejemplo n.º 5
0
        public static DescribedResult <bool> TryValidate(UnvalidatedSerialNumber unvalidatedSerialNumber, out SerialNumber serialNumber)
        {
            var isValid = Utilities.IsValid(unvalidatedSerialNumber);

            if (isValid.Value)
            {
                serialNumber = new SerialNumber(unvalidatedSerialNumber.Value);
            }
            else
            {
                serialNumber = SerialNumber.Invalid;
            }

            return(isValid);
        }
Ejemplo n.º 6
0
        public static DescribedResult <bool> IsValid(SerialNumber serialNumber)
        {
            var output = Utilities.IsValidSerialNumber(serialNumber.Value);

            return(output);
        }
        public static ContainerIdentification NewFrom(OwnerCode ownerCode, EquipmentCategory equipmentCategory, SerialNumber serialNumber)
        {
            var containerIdentification = new ContainerIdentification().From(ownerCode, equipmentCategory, serialNumber);

            return(containerIdentification);
        }
        public static DescribedResult <bool> TryValidate(this UnvalidatedSerialNumber unvalidatedSerialNumber, out SerialNumber serialNumber)
        {
            var isValid = Utilities.TryValidate(unvalidatedSerialNumber, out serialNumber);

            return(isValid);
        }