/// <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); }
private void OKBtn_Click(object sender, EventArgs e) { if (acq.modified) { Measurement m = N.App.Opstate.Measurement; INCCResults.results_rec re = m.INCCAnalysisResults.TradResultsRec; DB.Results dbres = new DB.Results(); dbres.UpdateEndingComment(m.MeasurementId.UniqueId, acq.ending_comment_str); // save the comment in the existing measurement result_rec, in the database, it is a surgical insertion at this point because the process is complete } Close(); }
/// <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); }
/// <summary> /// Save in the database the summary <see cref="INCCResults.results_rec"/> results for every type of INCC measurement. /// </summary> /// <param name="m">The measurement to preserve</param> /// <param name="moskey">The option selector+multiplicity key for the method results map</param> static void SaveSummaryResultsForThisMeasurement(this Measurement m, MeasOptionSelector moskey) { long mid = m.MeasurementId.UniqueId; DB.Results dbres = new DB.Results(); // save results with mid as foreign key bool b = dbres.Update(mid, m.INCCAnalysisResults.TradResultsRec.ToDBElementList()); // APluralityOfMultiplicityAnalyzers: results rec needs to be fully populated before here, or it needs to be saved again at the end of the processing m.Logger.TraceEvent(NCCReporter.LogLevels.Info, 34045, (b ? "Preserved " : "Failed to save ") + "summary results"); }
/// <summary> /// Save in the database the summary <see cref="INCCResults.results_rec"/> results for every type of INCC measurement. /// </summary> /// <param name="m">The measurement to preserve</param> /// <param name="moskey">The option selector+multiplicity key for the method results map</param> static void SaveSummaryResultsForThisMeasurement(this Measurement m, MeasOptionSelector moskey) { DB.Measurements ms = new DB.Measurements(); long mid = ms.Lookup(m.Detectors[0].Id.DetectorName, m.MeasDate, m.MeasOption.PrintName()); DB.Results dbres = new DB.Results(ms.db); // save results with mid as foreign key bool b = dbres.Update(mid, m.INCCAnalysisResults.TradResultsRec.ToDBElementList()); m.Logger.TraceEvent(NCCReporter.LogLevels.Info, 34045, (b ? "Preserved " : "Failed to save ") + "summary results"); }