コード例 #1
0
        /// <summary>
        /// Returns the string representation of the stored value, which
        /// varies a little depending on its type: NUMERIC and ALPHA values
        /// are returned padded to the specified length of the field either
        /// with zeroes or spaces; AMOUNT values are formatted to 12 digits
        /// as cents; date/time values are returned with the specified format
        /// for their type. LLVAR and LLLVAR values are returned as they are.
        /// </summary>
        /// <returns></returns>
        public override String ToString()
        {
            if (type == IsoType.NUMERIC || type == IsoType.ALPHA)
            {
                return(IsoTypeHelper.Format(fval.ToString(), type, length));
            }

            if (type == IsoType.AMOUNT)
            {
                if (fval is Decimal)
                {
                    return(IsoTypeHelper.Format((Decimal)fval, type, 12));
                }
                else
                {
                    return(IsoTypeHelper.Format(Convert.ToDecimal(fval), type, 12));
                }
            }

            if (fval is DateTime)
            {
                return(IsoTypeHelper.Format((DateTime)fval, type));
            }

            return(fval.ToString());
        }
コード例 #2
0
        private void FormatOriginalValue()
        {
            if (subData != null)
            {
                if (subData.Count > 0)
                {
                    String orgValue = "";
                    foreach (KeyValuePair <Int32, IsoValue> sub in subData)
                    {
                        orgValue += sub.Value.originalValue;
                    }

                    originalValue = orgValue;
                    return;
                }
            }

            switch (type)
            {
            case IsoType.NUMERIC:
                originalValue = IsoTypeHelper.Format(fval.ToString(), type, length);
                break;

            case IsoType.ALPHA:
                originalValue = IsoTypeHelper.Format(fval.ToString(), type, length);
                break;

            case IsoType.DATE10:
                originalValue = IsoTypeHelper.Format(Convert.ToDateTime(fval), type);
                break;

            case IsoType.DATE12:
                originalValue = IsoTypeHelper.Format(Convert.ToDateTime(fval), type);
                break;

            case IsoType.DATE6:
                originalValue = IsoTypeHelper.Format(Convert.ToDateTime(fval), type);
                break;

            case IsoType.DATE4:
                originalValue = IsoTypeHelper.Format(Convert.ToDateTime(fval), type);
                break;

            case IsoType.DATE_EXP:
                originalValue = IsoTypeHelper.Format(Convert.ToDateTime(fval), type);
                break;

            case IsoType.TIME:
                originalValue = IsoTypeHelper.Format(Convert.ToDateTime(fval), type);
                break;

            case IsoType.AMOUNT:
                originalValue = IsoTypeHelper.Format(Convert.ToDecimal(fval), type, length);
                break;
            }
        }