Ejemplo n.º 1
0
        /// <summary>
        /// Converts the supplied list of <see cref="LogRecord"/> objects into a list of <see cref="DbLogRecord"/> objects.
        /// </summary>
        /// <param name="logRecords">The list of <see cref="LogRecord"/> objects to be converted.</param>
        /// <returns></returns>
        public static List <DbLogRecord> GetDbLogRecords(List <LogRecord> logRecords)
        {
            DateTime recordCreationTimeUtc = DateTime.UtcNow;
            var      dbLogRecords          = new List <DbLogRecord>();

            foreach (var logRecord in logRecords)
            {
                DbLogRecord dbLogRecord = GetDbLogRecord(logRecord);
                dbLogRecord.RecordCreationTimeUtc = recordCreationTimeUtc;
                dbLogRecords.Add(dbLogRecord);
            }
            return(dbLogRecords);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts the supplied <see cref="LogRecord"/> into a <see cref="DbLogRecord"/>.
        /// </summary>
        /// <param name="">The <see cref="LogRecord"/> to be converted.</param>
        /// <returns></returns>
        public static DbLogRecord GetDbLogRecord(LogRecord logRecord)
        {
            DbLogRecord dbLogRecord = new DbLogRecord
            {
                GeotabId  = logRecord.Id.ToString(),
                DateTime  = logRecord.DateTime.GetValueOrDefault(),
                DeviceId  = logRecord.Device.Id.ToString(),
                Latitude  = logRecord.Latitude,
                Longitude = logRecord.Longitude,
                Speed     = logRecord.Speed
            };

            return(dbLogRecord);
        }