public void RegisterDataTable(DataTransmissionList receivedTable) { var dataList = receivedTable.DataTransmissionModels; //Create CSV Model var cw = new CsvWriter <DataTransmissionModel>(); try { foreach (var recievedModel in dataList) { DataTransmissionOperations.GetInstance().RegisterData(recievedModel); //Insert data into Database //DataBaseOperations.InsertFlugData(recievedModel); } //Write Model into Csv File cw.WriteModelsListToCsvFile(dataList, Constants.DATA_RECEIVED_FILE_PATH); } catch (Exception e) { //Exceptions are typically logged at the ERROR level Constants.LOGGER.Error(e); throw; } }
public void RegisterData(DataTransmissionModel received) { try { var newReceivedData = new DataTransmissionModel { Flight = received.Flight, Track = received.Track, Altitude = received.Altitude, Latitude = received.Latitude, Longitude = received.Longitude, Prefix = received.Prefix, SenderId = received.SenderId, Groundspeed = received.Groundspeed, Timestamp = received.Timestamp, UTC = received.UTC, DeviationAlt = received.DeviationAlt, DeviationLat = received.DeviationLat, DeviationLong = received.DeviationLong, AltTimestamp = received.AltTimestamp, LatTimestamp = received.LatTimestamp, LongTimestamp = received.LongTimestamp, Flarm = received.Flarm, }; //Create CSV Model var cw = new CsvWriter <DataTransmissionModel>(); //Write Model into Csv File cw.WriteModelToCsvFile(newReceivedData, Constants.DATA_RECEIVED_FILE_PATH); //Add Data To registration Class (Data Dictionary) DataTransmissionOperations.GetInstance().RegisterData(newReceivedData); } catch (Exception e) { //Exceptions are typically logged at the ERROR level Constants.LOGGER.Error(e); throw; } }