/// <summary> /// Add a new Zephyr Breathing Waveform data record to the database /// </summary> /// <param name="zephyrBreathing">ZephyrBreathingWaveform object to add to the database</param> public void CreateZephyrBreathingWaveform(ZephyrBreathingWaveform zephyrBreathing) { if(zephyrBreathing != null) { _repository.Add(zephyrBreathing); } }
/// <summary> /// Create a list of ZephyrBreathingWaveform objects from the data read from the csv file selected by the user. /// </summary> /// <param name="csvReader">csv reader object</param> /// <param name="patientData">Patient data record that will be referenced by each zephyr breathing data record.</param> /// <returns></returns> public static List<ZephyrBreathingWaveform> BuildZephyrBreathingDataList(CsvReader csvReader, PatientData patientData) { List<ZephyrBreathingWaveform> zephyrBreathingData = null; if (csvReader != null && patientData != null && patientData.Id != null) { zephyrBreathingData = new List<ZephyrBreathingWaveform>(); while (csvReader.ReadNextRecord()) { if (csvReader != null) { //File should read in the following order. //Time | BreathingWaveform string dateFormat = "dd/MM/yyyy HH:mm:ss.fff"; string date = csvReader[0]; DateTime dateTime; if (DateTime.TryParseExact(date, dateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) { ZephyrBreathingWaveform zephyrBreathing = new ZephyrBreathingWaveform() { Time = dateTime, Data = Convert.ToInt32(csvReader[1]), PatientDataId = patientData.Id }; zephyrBreathingData.Add(zephyrBreathing); } } } } return zephyrBreathingData; }