Beispiel #1
0
        /// <summary>
        /// Logs the trip event if different from last message recorded for this particular trip
        /// </summary>
        /// <param name="Uow">The uow.</param>
        /// <param name="tripId">The trip identifier.</param>
        /// <param name="message">The message to be logged</param>
        private static void LogTripEventIfDifferentFromLast(IUnitOfWork Uow, int tripId, string message)
        {
            try
            {
                TripEvent lastTripEvent = Uow.Repository <TripEvent>()
                                          .Query().Get().Where(te => te.TripId == tripId)
                                          .OrderByDescending(te => te.EventDate)
                                          .FirstOrDefault();

                if (lastTripEvent != null && !lastTripEvent.Message.Equals(message))
                {
                    Uow.Repository <TripEvent>().Insert(new TripEvent(tripId, message));
                    Uow.Save();
                }
            }
            catch (Exception ex)
            {
                //Diagnostics.WriteMainDiagnosticInfo(TraceEventType.Error, TraceEventId.TraceGeneral, " Error in LogTripEventIfDifferentFromLast for Trip: " + tripId + ".  " + ex.Message);
            }
        }
Beispiel #2
0
 public TripEventArgs(TripEvent tripEvent, object data)
 {
     this.tripEvent = tripEvent;
     this.data      = data;
 }