/// <summary> /// Initialisiert eine neue Instanz der <see cref="T:System.Object" />-Klasse. /// </summary> public LogbookEntry( LogbookEntryType type, DateTime startDateTime, DateTime endDateTime, TimeSpan duration, IList <LogbookLocation> track, double distanceNauticalMiles) { Duration = duration; DistanceNauticalMiles = distanceNauticalMiles; Type = type; StartDateTime = startDateTime; EndDateTime = endDateTime; Track = track; }
public void WriteLogbookEntry(LogbookEntryType type, string logbookEntry) { DateTime dtentry = DateTime.Now; string _logEntry = dtentry.Day.ToString("D2") + dtentry.Month.ToString("D2") + dtentry.Year.ToString("D4") + dtentry.Hour.ToString("D2") + dtentry.Minute.ToString("D2") + dtentry.Second.ToString("D2"); switch (type) { case LogbookEntryType.BackupfileCreated: _logEntry += "|A backup file was created|"; break; case LogbookEntryType.LogfileStarted: _logEntry += "|A realtime log file was started|"; break; case LogbookEntryType.Note: _logEntry += "|A project note was inserted|"; break; case LogbookEntryType.SynchronizationStarted: _logEntry += "|Synchronization with the ECU was started|"; break; case LogbookEntryType.TransactionExecuted: _logEntry += "|A transaction was executed|"; break; case LogbookEntryType.TransactionRolledback: _logEntry += "|A transaction was rolled back|"; break; case LogbookEntryType.TransactionRolledforward: _logEntry += "|A transaction rolled forward|"; break; case LogbookEntryType.ProjectFileRecreated: _logEntry += "|A project file was recreated|"; break; case LogbookEntryType.PropertiesEdited: _logEntry += "|Project properties were edited|"; break; } _logEntry += logbookEntry.Replace("|", " "); if (m_filename != string.Empty) { using (StreamWriter sw = new StreamWriter(m_filename, true)) { sw.WriteLine(_logEntry); } } }
private void CreateEntry( LogbookEntryType entryType, Guid aircraftId, DateTime startDateTime, DateTime endDateTime, TimeSpan duration, IList <LogbookLocation> track, double distanceNauticalMiles, string notes) { LogbookEntry newEntry = new LogbookEntry(entryType, startDateTime, endDateTime, duration, track, distanceNauticalMiles); newEntry.Update(notes); FileInfo logbookEntryFile = GetLogbookEntryFile(aircraftId, startDateTime, "log", "json"); FileInfo logbookEntryTrackFile = GetLogbookEntryFile(aircraftId, startDateTime, "track", "csv"); /* Persist entry to json*/ _logbookEntryDao.SaveWithoutTrack(logbookEntryFile, newEntry); /* Persist track as GeoJSON */ _logbookEntryTrackDao.Save(logbookEntryTrackFile, LocationsToEntries(newEntry.Track)); }