public static void PrintMeasurementToConsole(Measurement measurement) { Console.WriteLine(string.Format("ID:{0}, System:{1}, Test:{2}, TextID:{3}", measurement.ID, measurement.InstrumentSystem, measurement.TestNumber, measurement.TextID)); }
public static async Task <int> GetMeasurementIDAsync(DescDBContext dbContext, Measurement measurement) { var record = await dbContext.MeasurementDescriptions .Where(x => x.SectionInfo.ID == measurement.SectionInfo.ID) .Where(x => x.TextID == measurement.TextID) .Where(x => x.TestNumber == measurement.TestNumber) .Where(x => x.InstrumentSystem == measurement.InstrumentSystem) .Where(x => x.StartOffset == measurement.StartOffset && x.EndOffset == measurement.EndOffset) .FirstOrDefaultAsync().ConfigureAwait(true); if (record != null) { return(record.ID); } else { return(-1); } }
public static async Task <bool> FindMeasurementInDatabase(DescDBContext dbContext, Measurement measurement) { //TODO: Throw an error if the measurement doesn't have a sectioninfo ID bool recordExists = await dbContext.MeasurementDescriptions .Where(x => x.SectionInfo.ID == measurement.SectionInfo.ID) .Where(x => x.TextID == measurement.TextID) .Where(x => x.TestNumber == measurement.TestNumber) .Where(x => x.StartOffset == measurement.StartOffset && x.EndOffset == measurement.EndOffset) .AnyAsync().ConfigureAwait(true); if (recordExists) { return(true); } else { return(false); } }
/// <summary> /// Duplicates a Measurement. Creates a new Measurement by copying the properties of another Measurement. /// </summary> public Measurement(Measurement measurement) : this(measurement?.SectionInfo ?? throw new ArgumentNullException(nameof(measurement))) { StartOffset = measurement.StartOffset; EndOffset = measurement.EndOffset; DataRow = measurement.DataRow; }