public long Lookup(string detname, DateTime dt) { if (string.IsNullOrEmpty(detname)) { return(-1); } db.SetConnection(); Measurements m = new Measurements(db); string s = "select results_rec.id from results_rec INNER JOIN measurements ON " + "(measurements.id=results_rec.mid AND measurements.detector_id=" + SQLSpecific.QVal(detname) + "AND measurements.DateTime=results_rec.original_meas_date) where results_rec.original_meas_date=" + SQLSpecific.getDate(dt); string r = db.Scalar(s); long lr = -1; if (!long.TryParse(r, out lr)) { lr = -1; } return(lr); }
// TODO: update results and method results in same step public bool unraeadyUpdate(string detname, DateTime date, ElementList resParams, ElementList methodParams) { db.SetConnection(); Measurements ms = new Measurements(db); ArrayList sqlList = new ArrayList(); //....... long l = ms.PrimaryKey(detname, date); string sSQL1 = "UPDATE " + table + " SET "; string wh = " where mid=" + l.ToString(); string sSQL = sSQL1 + resParams.ColumnEqValueList + wh; return db.Execute(sSQL); }
public long Create(string detname, DateTime date, ElementList resParams) { db.SetConnection(); Measurements ms = new Measurements(db); long mid = ms.PrimaryKey(detname, date); return Create(mid, resParams); }
public DataTable GetMethod(string detname, DateTime date) { db.SetConnection(); Measurements ms = new Measurements(db); long l = ms.PrimaryKey(detname, date); string sSQL = "Select * FROM " + MethodTableName + "where mid = " + l.ToString(); DataTable dt = db.DT(sSQL); return dt; }
public long Lookup(string detname, DateTime dt) { if (String.IsNullOrEmpty(detname)) return -1; db.SetConnection(); Measurements m = new Measurements(db); string s = "select results_rec.id from results_rec INNER JOIN measurements ON "+ "(measurements.id=results_rec.mid AND measurements.detector_id=" + SQLSpecific.QVal(detname) + "AND measurements.DateTime=results_rec.original_meas_date) where results_rec.original_meas_date=" + SQLSpecific.getDate(dt); string r = db.Scalar(s); long lr = -1; if (!Int64.TryParse(r, out lr)) lr = -1; return lr; }
// can use IList interface on this public DataTable GetACollection(Pieces p, String did = null) { DataTable dt = new DataTable(); try { switch (p) { default: break; case Pieces.HVParams: HVParams hv = new HVParams(); dt = hv.Get(did); break; case Pieces.HVResults: HVPlateauResults hvr = new HVPlateauResults(); dt = hvr.AllHVPlateauResults(did); break; case Pieces.Measurements: Measurements ms = new Measurements(); dt = ms.AllMeasurements(did); break; case Pieces.CountingAnalyzers: CountingAnalysisParameters cap = new CountingAnalysisParameters(); dt = cap.AnalyzerParamsForDetector(did); break; case Pieces.AnalysisMethodSpecifiers: using(AnalysisMethodSpecifiers am = new AnalysisMethodSpecifiers()) { dt = am.MethodsForDetector(did); } break; case Pieces.Detectors: Detectors clsD = new Detectors(); dt = clsD.getDetectors(true); break; case Pieces.LMParams: LMNetCommParams blue = new LMNetCommParams(); dt = blue.Get(did); break; case Pieces.LMMultParams: LMMultiplicityParams purple = new LMMultiplicityParams(); dt = purple.Get(did); break; case Pieces.DetectorTypes: Descriptors clsDT = new Descriptors("detector_types"); dt = clsDT.getDescs(); break; case Pieces.Materials: Descriptors clsMtl = new Descriptors("material_types"); dt = clsMtl.getDescs(); break; case Pieces.TestParams: TestParams tp = new TestParams(); dt = tp.Get(); break; case Pieces.NormParams: NormParams np = new NormParams(); dt = np.Get(did); break; case Pieces.AASSetupParams: AASSetupParams aass = new AASSetupParams(); dt = aass.Get(did); break; case Pieces.BackgroundParams: BackgroundParams clsB = new BackgroundParams(); TruncatedBackgroundParams clsTB = new TruncatedBackgroundParams(); dt = clsB.Get(did); DataTable dt2 = clsTB.Get(did); dt.Merge(dt2); break; // next: caution, should use select/join case Pieces.Facilities: Descriptors clsF = new Descriptors("facility_names"); dt = clsF.getDescs(); break; case Pieces.MBAs: Descriptors MBA = new Descriptors(p.ToString()); dt = MBA.getDescs(); break; case Pieces.Items: Items clsI = new Items(); dt = clsI.getItems(); break; case Pieces.CollarItems: CollarItems clsCI = new CollarItems(); dt = clsCI.getItems(); break; case Pieces.Isotopics: Isotopics clsIs = new Isotopics(); dt = clsIs.getIsotopics(); break; case Pieces.Strata: Strata s = new Strata(); dt = s.Get(); break; case Pieces.StrataWithAssoc: Strata ss = new Strata(); dt = ss.GetAssociations(did); break; case Pieces.AcquireParams: AcquireParams aq = new AcquireParams(); dt = aq.Get(did); break; case Pieces.IOCodes: Descriptors ioc = new Descriptors("io_code"); dt = ioc.getDescs(); break; case Pieces.InvChangeCodes: Descriptors icc = new Descriptors("inventory_change_code"); dt = icc.getDescs(); break; case Pieces.UnattendedParams: UnattendParams u = new UnattendParams(); dt = u.Get(did); break; case Pieces.CmPuRatioParams: cm_pu_ratio_rec cpu = new cm_pu_ratio_rec(); dt = cpu.Get(); break; case Pieces.Results: Results rr = new Results(); dt = rr.AllResults(did); break; } } catch (Exception caught) { DBMain.AltLog(LogLevels.Warning, 70191, "Get Collection '" + caught.Message + "' "); } return dt; }
// can use IList interface on this public DataTable GetACollection(Pieces p, String did = null) { DataTable dt = new DataTable(); try { switch (p) { default: break; case Pieces.HVParams: HVParams hv = new HVParams(); dt = hv.Get(did); break; case Pieces.HVResults: HVPlateauResults hvr = new HVPlateauResults(); dt = hvr.AllHVPlateauResults(did); break; case Pieces.Measurements: Measurements ms = new Measurements(); dt = ms.AllMeasurements(did); break; case Pieces.CountingAnalyzers: CountingAnalysisParameters cap = new CountingAnalysisParameters(); dt = cap.AnalyzerParamsForDetector(did); break; case Pieces.AnalysisMethodSpecifiers: using (AnalysisMethodSpecifiers am = new AnalysisMethodSpecifiers()) { dt = am.MethodsForDetector(did); } break; case Pieces.Detectors: Detectors clsD = new Detectors(); dt = clsD.getDetectors(true); break; case Pieces.LMParams: LMNetCommParams blue = new LMNetCommParams(); dt = blue.Get(did); break; case Pieces.LMMultParams: LMMultiplicityParams purple = new LMMultiplicityParams(); dt = purple.Get(did); break; case Pieces.DetectorTypes: Descriptors clsDT = new Descriptors("detector_types"); dt = clsDT.getDescs(); break; case Pieces.Materials: Descriptors clsMtl = new Descriptors("material_types"); dt = clsMtl.getDescs(); break; case Pieces.TestParams: TestParams tp = new TestParams(); dt = tp.Get(); break; case Pieces.NormParams: NormParams np = new NormParams(); dt = np.Get(did); break; case Pieces.AASSetupParams: AASSetupParams aass = new AASSetupParams(); dt = aass.Get(did); break; case Pieces.BackgroundParams: BackgroundParams clsB = new BackgroundParams(); TruncatedBackgroundParams clsTB = new TruncatedBackgroundParams(); dt = clsB.Get(did); DataTable dt2 = clsTB.Get(did); dt.Merge(dt2); break; // next: caution, should use select/join case Pieces.Facilities: Descriptors clsF = new Descriptors("facility_names"); dt = clsF.getDescs(); break; case Pieces.MBAs: Descriptors MBA = new Descriptors(p.ToString()); dt = MBA.getDescs(); break; case Pieces.Items: Items clsI = new Items(); dt = clsI.getItems(); break; case Pieces.CollarItems: CollarItems clsCI = new CollarItems(); dt = clsCI.getItems(); break; case Pieces.Isotopics: Isotopics clsIs = new Isotopics(); dt = clsIs.getIsotopics(); break; case Pieces.Strata: Strata s = new Strata(); dt = s.Get(); break; case Pieces.StrataWithAssoc: Strata ss = new Strata(); dt = ss.GetAssociations(did); break; case Pieces.AcquireParams: AcquireParams aq = new AcquireParams(); dt = aq.Get(did); break; case Pieces.IOCodes: Descriptors ioc = new Descriptors("io_code"); dt = ioc.getDescs(); break; case Pieces.InvChangeCodes: Descriptors icc = new Descriptors("inventory_change_code"); dt = icc.getDescs(); break; case Pieces.UnattendedParams: UnattendParams u = new UnattendParams(); dt = u.Get(did); break; case Pieces.CmPuRatioParams: cm_pu_ratio_rec cpu = new cm_pu_ratio_rec(); dt = cpu.Get(); break; case Pieces.Results: Results rr = new Results(); dt = rr.AllResults(did); break; } } catch (Exception caught) { DBMain.AltLog(LogLevels.Warning, 70191, "Get Collection '" + caught.Message + "' "); } return(dt); }