Exemplo n.º 1
0
        internal string SerializeFromNominalType(object val, X9FieldType fieldType)
        {
            int    length   = fieldType.Length.Value;
            string unpadded = Convert.ToString(val) ?? "";

            if (unpadded.Length > length)
            {
                throw new ArgumentException($"Cannot set field {fieldType.Name} value to '{unpadded}'. The length of the data " +
                                            $"({unpadded.Length}) exceeds the available length for this field ({length}).");
            }
            return(string.IsNullOrWhiteSpace(unpadded)
                ? new string(' ', length) // if no value, we fill with spaces instead of the field type's pad character
                : this.PadValue(unpadded, length));
        }
Exemplo n.º 2
0
 public X9TextField(X9FieldType fieldType) : base(fieldType)
 {
 }
Exemplo n.º 3
0
 public X9Field(X9FieldType fieldType)
 {
     this.FieldType = fieldType;
 }
Exemplo n.º 4
0
 public X9ImageField(X9FieldType fieldType) : base(fieldType)
 {
 }