Пример #1
0
        /// <summary>
        ///  Parses a date encoded in a String or a decimal, using the date parser.
        /// </summary>
        /// <param name="encodedDate">the encoded date</param>
        /// <returns>the corresponding date</returns>
        protected DateTime?ParseDate(object encodedDate)
        {
            DateTime?date = null;
            var      s    = encodedDate as string;

            if (s != null)
            {
                date = _dateParser.Decode(s);
            }
            else
            {
                if (encodedDate is decimal)
                {
                    date = _dateParser.Decode((decimal)encodedDate);
                }
            }
            return(date);
        }
Пример #2
0
 /// <summary>
 /// Maps a <see cref="IFieldSet"/> to a <see cref="FlatFileRecord" />.
 /// <param name="fieldSet">the field set to map</param>
 /// <returns>the corresponding item</returns>
 /// </summary>
 public FlatFileRecord MapFieldSet(IFieldSet fieldSet)
 {
     // Create a new instance of the current mapped object
     return(new FlatFileRecord
     {
         Code = fieldSet.ReadInt(0),
         Name = fieldSet.ReadString(1), // ReadString trims the read string, use ReadRawString to keep trailing spaces
         Description = fieldSet.ReadString(2),
         Date = _dateParser.Decode(fieldSet.ReadString(3))
     });
 }