/// <summary> /// Store the metadata identifier and the generalized results of a measurement into the database. /// Creates a unique entry for a new measurement. /// Creates an entry for the traditional INCC5 results table for the summary results. /// Detailed measurement results (e.g. cycles, param methods and results), are saved by other methods. /// </summary> /// <returns>Unique database id of the measurement</returns> public long Persist() { logger.TraceEvent(LogLevels.Verbose, 34001, "Preserving measurement ..."); DB.Measurements dbm = new DB.Measurements(); long mid = dbm.Add(name: Detector.Id.DetectorName, date: MeasDate, // NEXT: file-based ops use the file date, but we want to replace with current time stamp mtype: MeasOption.PrintName(), filename: MeasurementId.FileName, // the file names are generated at the end of the process, in GenerateReports, subsequently the database entry is updated with the new file names notes: "2016"); if (mid < 0) { logger.TraceEvent(LogLevels.Warning, 34001, "Measurement not saved"); return(mid); } logger.TraceEvent(LogLevels.Verbose, 34001, "Preserved measurement id {0}", mid); DB.Results dbres = new DB.Results(); // save results with mid as foreign key long rid = dbres.Create(mid, INCCAnalysisResults.TradResultsRec.ToDBElementList()); logger.TraceEvent(LogLevels.Verbose, 34045, "Preserved summary results with id {0}", rid); long c = dbm.CountOf(name: Detector.Id.DetectorName, dt: MeasDate, type: MeasOption.PrintName()); dbm.UpdateNote(c.ToString(), mid); MeasurementId.UniqueId = mid; return(mid); }
/// <summary> /// Store the metadata identfier and the generalized results of a measurement into the database. /// Creates a unique entry for a new measurement. /// Creates an entry for the traditional INCC5 results table for the summary results. /// Detailed measurement results (e.g. cycles, param methods and results), are saved by other methods. /// </summary> /// <returns>Unique database id of the measurement</returns> public long Persist() { logger.TraceEvent(LogLevels.Verbose, 34001, "Preserving measurement ..."); DB.Measurements dbm = new DB.Measurements(); long mid = dbm.Add(name: Detectors[0].Id.DetectorName, date: MeasDate, // NEXT: file-based ops use the file date, but we want to replace with current time stamp mtype: MeasOption.PrintName(), filename: MeasurementId.FileName, // the file names are generated at the end of the process, GenerateReports, update the database at the end notes: "2015"); logger.TraceEvent(LogLevels.Verbose, 34001, "Preserved measurement id {0}", mid); DB.Results dbres = new DB.Results(); // save results with mid as foreign key long rid = dbres.Create(mid, this.INCCAnalysisResults.TradResultsRec.ToDBElementList()); logger.TraceEvent(LogLevels.Verbose, 34045, "Preserved summary results with id {0}", rid); return(mid); }