public LogEventAnnotationModel(LogEventAnnotation annotation, string providerId) { this.providerId = providerId; this.driverId = annotation.driverId; this.comment = annotation.comment; this.dateTime = annotation.dateTime; }
private void CreateLogEvent(SimulatedData_LogEvent sim_le, Vehicle vehicle, Driver driver) { Console.WriteLine("Adding log event to driver " + driver.Id.ToString() + ": event Id: " + sim_le.Id.ToString()); //create a log event based on our simulated data store LogEvent le = new LogEvent { Id = Guid.NewGuid(), driverId = driver.Id, vehicleId = vehicle.Id, locationId = sim_le.locationId, certificationCount = sim_le.certificationCount, coDrivers = sim_le.coDrivers, comment = sim_le.comment, dateTime = DateTimeOffset.Now, distanceLastValid = sim_le.distanceLastValid, editDateTime = sim_le.editDateTime, eventDataChecksum = sim_le.eventDataChecksum, eventType = sim_le.eventType, multidayBasis = sim_le.multidayBasis, origin = sim_le.origin, parentId = sim_le.parentId, sequence = sim_le.sequence, state = sim_le.state, verifyDateTime = sim_le.verifyDateTime, }; m_context.LogEvent.Add(le); //add annotations, if available List <SimulatedData_LogEventAnnotation> annotations = m_context.SimulatedData_LogEventAnnotation.Where(x => x.logEventId == sim_le.Id).ToList(); foreach (SimulatedData_LogEventAnnotation annotation in annotations) { LogEventAnnotation lea = new LogEventAnnotation { comment = annotation.comment, dateTime = DateTimeOffset.Now, driverId = le.driverId, Id = Guid.NewGuid(), logEventId = le.Id }; m_context.LogEventAnnotation.Add(lea); } m_context.SaveChanges(); }