Пример #1
0
        /// <summary>
        /// Creates a new instance to store a value of a fixed-length type.
        /// Fixed-length types are DATE4, DATE_EXP, DATE10, TIME, AMOUNT.
        /// </summary>
        /// <param name="t">The ISO8583 type of the value that is going to be stored.</param>
        /// <param name="value">The value to store.s</param>
        /// <param name="originalValue">The original value of field</param>
        /// <param name="req">Indicates the requiremts (M,C, CE, ME, O )</param>
        public IsoValue(IsoType t, Parsing.ConfigParser.Base configBase, Object value, String originalValue, String req)
        {
            if (value == null)
            {
                throw new ArgumentException("Value cannot be null");
            }

            if (IsoTypeHelper.NeedsLength(t))
            {
                throw new ArgumentException("Use IsoValue constructor for Fixed-value types");
            }

            type = t;
            fval = value;
            b    = configBase;
            this.originalValue = originalValue;
            requirements       = req;
            if (t == IsoType.LLVAR || type == IsoType.LLLVAR)
            {
                length = value.ToString().Length;
            }
            else
            {
                length = IsoTypeHelper.GetLength(t);
            }
        }
Пример #2
0
        /// <summary>
        /// Creates a new instance to store a value of a given type. This constructor
        /// is used for variable-length types (LLVAR, LLLVAR, ALPHA, NUMERIC) -
        /// variable in the sense that that length of the value does not depend
        /// solely on the ISO type.
        /// </summary>
        /// <param name="t">the ISO8583 type of the value to be stored.</param>
        /// <param name="val">The value to be stored.</param>
        /// <param name="len">The length of the field.</param>
        /// <param name="originalValue">The original value of field</param>
        /// <param name="req">Indicates the requiremts (M,C, CE, ME, O )</param>
        /// <param name="typeElement">Indicates the Type of Element (Field, SubField, SubElement)</param>
        public IsoValue(IsoType t, Parsing.ConfigParser.Base configBase, Object val, Int32 len, String originalValue, String req, TypeElement typeElement, Dictionary <Int32, IsoValue> subData, Int32 subElementIDLength, Int32 lengthLengthSubElement)
        {
            if (val == null)
            {
                throw new ArgumentException("Value cannot be null");
            }

            type                        = t;
            fval                        = val;
            length                      = len;
            this.originalValue          = originalValue;
            requirements                = req;
            this.typeElement            = typeElement;
            this.subElementIDLength     = subElementIDLength;
            this.lengthLengthSubElement = lengthLengthSubElement;
            this.subData                = subData;
            b = configBase;

            if (typeElement == TypeElement.Field || typeElement == TypeElement.SubField)
            {
                if (length == 0 && IsoTypeHelper.NeedsLength(t))
                {
                    throw new ArgumentException("Length must be greater than zero");
                }
            }

            if (t == IsoType.LLVAR || t == IsoType.LLLVAR)
            {
                length = val.ToString().Length;
            }
        }
Пример #3
0
        /// <summary>
        /// Creates a new instance to store a value of a given type. This constructor
        /// is used for variable-length types (LLVAR, LLLVAR, ALPHA, NUMERIC) -
        /// variable in the sense that that length of the value does not depend
        /// solely on the ISO type.
        /// </summary>
        /// <param name="t">the ISO8583 type of the value to be stored.</param>
        /// <param name="val">The value to be stored.</param>
        /// <param name="len">The length of the field.</param>
        /// <param name="req">Indicates the requiremts (M,C, CE, ME, O )</param>
        /// <param name="subData">Collection of subDatas (SubField/SubElements) of field</param>
        public IsoValue(IsoType t, Parsing.ConfigParser.Base configBase, Object val, Int32 len, String originalValue, String req, Dictionary <Int32, IsoValue> subData)
        {
            if (val == null)
            {
                throw new ArgumentException("Value cannot be null");
            }

            type         = t;
            fval         = val;
            length       = len;
            b            = configBase;
            this.subData = subData;
            requirements = req;
            FormatOriginalValue();

            if (length == 0 && IsoTypeHelper.NeedsLength(t))
            {
                throw new ArgumentException("Length must be greater than zero");
            }

            if (t == IsoType.LLVAR || t == IsoType.LLLVAR)
            {
                length = val.ToString().Length;
            }
        }
Пример #4
0
        /// <summary>
        /// Creates a new instance to store a value of a given type. This constructor
        /// is used for variable-length types (LLVAR, LLLVAR, ALPHA, NUMERIC) -
        /// variable in the sense that that length of the value does not depend
        /// solely on the ISO type.
        /// </summary>
        /// <param name="t">the ISO8583 type of the value to be stored.</param>
        /// <param name="val">The value to be stored.</param>
        /// <param name="len">The length of the field.</param>
        /// <param name="originalValue">The original value of field</param>
        public IsoValue(IsoType t, Parsing.ConfigParser.Base configBase, Object val, Int32 len, String originalValue, TypeElement typeElement)
        {
            if (val == null)
            {
                throw new ArgumentException("Value cannot be null");
            }

            type               = t;
            fval               = val;
            length             = len;
            b                  = configBase;
            this.originalValue = originalValue;

            if (typeElement == TypeElement.Field || typeElement == TypeElement.SubField)
            {
                if (length == 0 && IsoTypeHelper.NeedsLength(t))
                {
                    throw new ArgumentException("Length must be greater than zero");
                }
            }

            if (t == IsoType.LLVAR || t == IsoType.LLLVAR)
            {
                length = val.ToString().Length;
            }
        }