コード例 #1
0
        public bool Delete(string DetectorName, string CounterType, ElementList sParams)
        {
            DataRow dr = null;

            string table = "CountingParams";
            if (CounterType.Equals("Multiplicity") || CounterType.Equals("Coincidence"))
                table = "LMMultiplicity";

            Detectors dets = new Detectors(db);
            long l = dets.PrimaryKey(DetectorName);
            if (l == -1)
            {
                DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l);
                return false;
            }

            if (table.Equals("LMMultiplicity"))
                dr = HasRow(l, CounterType, table, sParams, sParams[faidx].Value); // the FA parameter
            else
                dr = HasRow(l, CounterType, table, sParams);
            if (dr != null)
            {
                string sSQL = "DELETE FROM " + table + " where counter_type=" + SQLSpecific.QVal(CounterType) + " AND detector_id=" + l.ToString();
                if (table.Equals("LMMultiplicity"))
                    sSQL += " AND " + sParams[faidx].Name + "=" + sParams[faidx].Value;
                return db.Execute(sSQL);
            }
            else
                return true;
        }
コード例 #2
0
        private DataTable BasicSelect(string DetectorName, string CounterType, string table, string FA)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(DetectorName);

            return(GetTable(l, CounterType, table, FA));
        }
コード例 #3
0
        // delete all the stratum associations with a detector
        public bool Unassociate(string measDetId)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(measDetId);
            string    sSQL = "DELETE FROM stratum_id_detector where " + "(stratum_id_detector.detector_id=" + l.ToString() + ")";

            return(db.Execute(sSQL));
        }
コード例 #4
0
ファイル: DetAndParams.cs プロジェクト: tempbottle/INCC6
 public DataTable Get(string measDetId)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL = "Select * FROM " + table + " where detector_id = " + l.ToString();
     DataTable dt = db.DT(sSQL);
     return dt;
 }
コード例 #5
0
        public bool Associate(string measDetId, string stratumID)
        {
            db.SetConnection();
            Detectors dets  = new Detectors(db);
            long      l     = dets.PrimaryKey(measDetId);
            long      m     = PrimaryKey(stratumID);
            string    saSQL = "insert into stratum_id_detector VALUES(" + l.ToString() + "," + m.ToString() + ")";

            return(db.Execute(saSQL));
        }
コード例 #6
0
ファイル: DetAndParams.cs プロジェクト: tempbottle/INCC6
        public DataTable Get(string measDetId)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(measDetId);
            string    sSQL = "Select * FROM " + table + " where detector_id = " + l.ToString();
            DataTable dt   = db.DT(sSQL);

            return(dt);
        }
コード例 #7
0
ファイル: AnalysisMethods.cs プロジェクト: radtek/INCC6
        private void GetKeys(string DetectorName, string ItemType, out long l, out long m)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);

            l = dets.PrimaryKey(DetectorName);
            Descriptors mats = new Descriptors("material_types", db);

            m = mats.PrimaryKey(ItemType);
        }
コード例 #8
0
ファイル: DetAndParams.cs プロジェクト: tempbottle/INCC6
 public bool Create(string measDetId, ElementList sParams) 
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     sParams.Add(new Element("detector_id", l));
     string sSQL1 = "Insert into " + table + " ";
     string sSQL = sSQL1 + sParams.ColumnsValues;            
     return db.Execute(sSQL);
 }
コード例 #9
0
        public DataTable Get(string measDetId)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(measDetId);
            string    sSQL = "Select * from LMNetComm, LMHWParams where (LMNetComm.detector_id=" + l.ToString() + " AND LMHWParams.detector_id=" + l.ToString() + ")";
            DataTable dt   = db.DT(sSQL);

            return(dt);
        }
コード例 #10
0
ファイル: acq.cs プロジェクト: tempbottle/INCC6
        public DataTable Get(DateTimeOffset measDatetime, string measDetId, string item_type)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(measDetId);
            string    sSQL = "Select * FROM LMAcquireParams where detector_id = " + l.ToString() + " AND item_type=" + SQLSpecific.Value(item_type, true);
            DataTable dt   = db.DT(sSQL);

            return(dt);
        }
コード例 #11
0
ファイル: DetAndParams.cs プロジェクト: tempbottle/INCC6
 public bool Update(string measDetId, ElementList sParams)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL1 = "UPDATE " + table + " SET ";
     string sSQL1i = String.Empty;
     string wh = " where " + "detector_id = " + l.ToString();
     string sSQL = sSQL1 + sParams.ColumnEqValueList + wh;
     return db.Execute(sSQL);
 }
コード例 #12
0
        public bool Has(string DetectorName, string CounterType)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(DetectorName);
            string    sSQL = "Select * from INNER JOIN LMMultiplicity, CountingParams ON (LMMultiplicity.detector_id=CountingParams.detector_id) " +
                             "where detector_id=" + l.ToString() + " AND " + "counter_type=" + SQLSpecific.QVal(CounterType);
            DataTable dt = db.DT(sSQL);

            return(dt.Rows.Count > 0);
        }
コード例 #13
0
ファイル: acq.cs プロジェクト: hnordquist/INCC6
 // joins the matching LM if found
 public DataTable Get(string measDetId)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL = "select * from acquire_parms_rec left join LMAcquireParams on (LMAcquireParams.detector_id=" + l.ToString() + ") " +
         "where (acquire_parms_rec.meas_detector_id=" + SQLSpecific.Value(measDetId, true) + ")" +
          " order by acquire_parms_rec.MeasDate DESC";
     DataTable dt = db.DT(sSQL);
     return dt;
 }
コード例 #14
0
ファイル: DetAndParams.cs プロジェクト: tempbottle/INCC6
        public bool Update(string measDetId, ElementList sParams)
        {
            db.SetConnection();
            Detectors dets   = new Detectors(db);
            long      l      = dets.PrimaryKey(measDetId);
            string    sSQL1  = "UPDATE " + table + " SET ";
            string    sSQL1i = String.Empty;
            string    wh     = " where " + "detector_id = " + l.ToString();
            string    sSQL   = sSQL1 + sParams.ColumnEqValueList + wh;

            return(db.Execute(sSQL));
        }
コード例 #15
0
ファイル: acq.cs プロジェクト: tempbottle/INCC6
        public bool Update(string measDetId, string item_type, ElementList sParams)
        {
            db.SetConnection();
            Detectors dets   = new Detectors(db);
            long      l      = dets.PrimaryKey(measDetId);
            string    sSQL1  = "UPDATE LMAcquireParams SET ";
            string    sSQL1i = String.Empty;
            string    wh     = " where " + "item_type = " + SQLSpecific.Value(item_type, true) + " AND detector_id = " + l.ToString();
            string    sSQL   = sSQL1 + sParams.ColumnEqValueList + wh;

            return(db.Execute(sSQL));
        }
コード例 #16
0
ファイル: acq.cs プロジェクト: tempbottle/INCC6
        public bool Create(DateTimeOffset measDatetime, string measDetId, ElementList sParams)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(measDetId);

            sParams.Add(new Element("detector_id", l));
            string sSQL1 = "Insert into LMAcquireParams ";
            string sSQL  = sSQL1 + sParams.ColumnsValues;

            return(db.Execute(sSQL));
        }
コード例 #17
0
ファイル: DetAndParams.cs プロジェクト: tempbottle/INCC6
        public bool Delete(string measDetId)
        {
            db.SetConnection();
            Detectors dets   = new Detectors(db);
            long      l      = dets.PrimaryKey(measDetId);
            string    sSQL1  = "DELETE from " + table;
            string    sSQL1i = String.Empty;
            string    wh     = " where " + "detector_id = " + l.ToString();
            string    sSQL   = sSQL1 + wh;

            return(db.Execute(sSQL));
        }
コード例 #18
0
ファイル: acq.cs プロジェクト: radtek/INCC6
        public DataTable Get(string measDetId) // joins the matching LM if found
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(measDetId);
            string    sSQL = "select * from acquire_parms_rec left join LMAcquireParams on (LMAcquireParams.detector_id=" + l.ToString() + ") " +
                             "where (acquire_parms_rec.meas_detector_id=" + SQLSpecific.Value(measDetId, true) + ")" +
                             " order by acquire_parms_rec.MeasDate DESC";
            DataTable dt = db.DT(sSQL);

            return(dt);
        }
コード例 #19
0
        private DataTable AllWithKeyNames(string DetectorName)
        {
            db.SetConnection();
            Detectors dets  = new Detectors(db);
            long      l     = dets.PrimaryKey(DetectorName);
            string    sSQLa = "Select * from CountingParams where CountingParams.detector_id=" + l.ToString();
            string    sSQLb = "Select * from LMMultiplicity where LMMultiplicity.detector_id=" + l.ToString();
            DataTable dta   = db.DT(sSQLa);
            DataTable dtb   = db.DT(sSQLb);

            dta.Merge(dtb);
            return(dta);
        }
コード例 #20
0
        // return the named stratum associated with a detector
        public DataTable Get(string measDetId, string stratumId)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(measDetId);
            long      m    = PrimaryKey(stratumId);
            string    sSQL = "Select * FROM stratum_ids INNER JOIN stratum_id_detector ON " +
                             "(stratum_id_detector.stratum_id=stratum_ids.stratum_id AND stratum_id_detector.detector_id=" + l.ToString()
                             + " AND stratum_id_detector.stratum_id=" + m.ToString() + ")";
            DataTable dt = db.DT(sSQL);

            return(dt);
        }
コード例 #21
0
        private string ResolvedKey(string val, IDB _db)
        {
            Detectors dets = new Detectors(_db);

            if (Id)
            {
                long l = dets.PrimaryKey(val);
                return(Field + "=" + l.ToString());
            }
            else
            {
                return(Field + "=" + SQLSpecific.Value(val, true));
            }
        }
コード例 #22
0
        // return the stratums associated with a detector
        public DataTable GetAssociations(string measDetId)
        {
            if (String.IsNullOrEmpty(measDetId))
            {
                return(Get());
            }
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(measDetId);
            string    sSQL = "Select * FROM stratum_ids INNER JOIN stratum_id_detector ON (stratum_id_detector.stratum_id=stratum_ids.stratum_id AND stratum_id_detector.detector_id=" + l.ToString() + ")";
            DataTable dt   = db.DT(sSQL);

            return(dt);
        }
コード例 #23
0
        public bool Update(string measDetId, string table, ElementList sParams)
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(measDetId);

            if (table == "net")
            {
                return(UpdateNetComm(l, sParams, db));
            }
            else
            {
                return(UpdateCfg(l, sParams, db));
            }
        }
コード例 #24
0
        // create a stratum and detector stratum association
        public bool Create(string measDetId, ElementList sParams)
        {
            db.SetConnection();
            Detectors dets    = new Detectors(db);
            long      l       = dets.PrimaryKey(measDetId);
            string    sSQL    = InsertStratum(sParams);
            ArrayList sqlList = new ArrayList();

            sqlList.Add(sSQL);
            sqlList.Add(SQLSpecific.getLastID("stratum_ids"));
            long   newID = db.ExecuteTransactionID(sqlList);
            string saSQL = "insert into stratum_id_detector VALUES(" + l.ToString() + "," + newID.ToString() + ")";

            return(db.Execute(saSQL));
        }
コード例 #25
0
        public bool Update(string DetectorName, string CounterType, ElementList sParams)
        {
            DataRow dr = null;

            string table = "CountingParams";

            if (CounterType.Equals("Multiplicity") || CounterType.Equals("Coincidence"))
            {
                table = "LMMultiplicity";
            }

            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(DetectorName);

            if (l == -1)
            {
                DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l);
                return(false);
            }

            if (table.Equals("LMMultiplicity"))
            {
                dr = HasRow(DetectorName, CounterType, table, sParams[faidx].Value); // the FA parameter
            }
            else
            {
                dr = HasRow(DetectorName, CounterType, table);
            }
            if (dr == null)
            {
                sParams.Add(new Element("detector_id", l));
                string sSQL = "Insert into " + table;
                sSQL += sParams.ColumnsValues;
                return(db.Execute(sSQL));
            }
            else
            {
                //NEXT: not tested(?)
                string sSQL = "UPDATE " + table + " SET ";
                sSQL += (sParams.ColumnEqValueList + " where counter_type=" + SQLSpecific.QVal(CounterType) + " AND detector_id=" + l.ToString());
                if (table.Equals("LMMultiplicity"))
                {
                    sSQL += " AND " + sParams[faidx].Name + "=" + sParams[faidx].Value;
                }
                return(db.Execute(sSQL));
            }
        }
コード例 #26
0
        public long DeleteAll(string DetectorName)
        {
            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(DetectorName);

            if (l == -1)
            {
                DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l);
                return(-1);
            }
            string    table1  = "CountingParams";
            string    table2  = "LMMultiplicity";
            ArrayList sqlList = new ArrayList();

            sqlList.Add("DELETE FROM " + table1 + " where detector_id=" + l.ToString());
            sqlList.Add("DELETE FROM " + table2 + " where detector_id=" + l.ToString());
            return(db.Execute(sqlList));
        }
コード例 #27
0
        // fix this, need a blanket clear

        public bool DeleteAll(string DetectorName, string CounterType, ElementList sParams)
        {
            DataRow dr = null;

            string table = "CountingParams";

            if (CounterType.Equals("Multiplicity") || CounterType.Equals("Coincidence"))
            {
                table = "LMMultiplicity";
            }

            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(DetectorName);

            if (l == -1)
            {
                DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l);
                return(false);
            }

            if (table.Equals("LMMultiplicity"))
            {
                dr = HasRow(DetectorName, CounterType, table, sParams[faidx].Value); // the FA parameter
            }
            else
            {
                dr = HasRow(DetectorName, CounterType, table);
            }
            if (dr != null)
            {
                //NEXT: not tested(?)
                string sSQL = "DELETE FROM " + table + " where counter_type=" + SQLSpecific.QVal(CounterType) + " AND detector_id=" + l.ToString();
                if (table.Equals("LMMultiplicity"))
                {
                    sSQL += " AND " + sParams[faidx].Name + "=" + sParams[faidx].Value;
                }
                return(db.Execute(sSQL));
            }
            else
            {
                return(true);
            }
        }
コード例 #28
0
        public bool Insert(string DetectorName, string CounterType, ElementList sParams)
        {
            DataRow dr = null;

            string table = "CountingParams";

            if (CounterType.Equals("Multiplicity") || CounterType.Equals("Coincidence"))
            {
                table = "LMMultiplicity";
            }

            Detectors dets = new Detectors(db);
            long      l    = dets.PrimaryKey(DetectorName);

            if (l == -1)
            {
                DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l);
                return(false);
            }

            if (table.Equals("LMMultiplicity"))
            {
                dr = HasRow(l, CounterType, table, sParams, sParams[faidx].Value); // the FA parameter
            }
            else
            {
                dr = HasRow(l, CounterType, table, sParams);
            }
            if (dr == null)
            {
                sParams.Add(new Element("detector_id", l));
                string sSQL = "Insert into " + table;
                sSQL += sParams.ColumnsValues;
                return(db.Execute(sSQL));
            }
            else
            {
                // identical row found, skip it
                return(false);
            }
        }
コード例 #29
0
        public bool Update(string DetectorName, string CounterType, ElementList sParams)
        {
            DataRow dr = null;

            string table = "CountingParams";
            if (CounterType.Equals("Multiplicity") || CounterType.Equals("Coincidence"))
                table = "LMMultiplicity";

            Detectors dets = new Detectors(db);
            long l = dets.PrimaryKey(DetectorName);
            if (l == -1)
            {
                DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l);
                return false;
            }

            if (table.Equals("LMMultiplicity"))
                dr = HasRow(DetectorName, CounterType, table, sParams[faidx].Value); // the FA parameter
            else
                dr = HasRow(DetectorName, CounterType, table);
            if (dr == null)
            {
                sParams.Add(new Element("detector_id", l));
                string sSQL = "Insert into " + table;
                sSQL += sParams.ColumnsValues;
                return db.Execute(sSQL);
            }
            else
            {
                //NEXT: not tested(?)
                string sSQL = "UPDATE " + table + " SET ";
                sSQL += (sParams.ColumnEqValueList + " where counter_type=" + SQLSpecific.QVal(CounterType) + " AND detector_id=" + l.ToString());
                if (table.Equals("LMMultiplicity"))
                    sSQL += " AND " + sParams[faidx].Name + "=" + sParams[faidx].Value;
                return db.Execute(sSQL);
            }
        }
コード例 #30
0
ファイル: AnalysisMethods.cs プロジェクト: radtek/INCC6
        public bool Update(string DetectorName, string ItemType, ElementList sParams)
        {
            bool res = false;

            db.SetConnection();
            //NEXT: this duo-lookup part takes too long, so get the values once in a wrapper call, then cache them, then reuse them
            DataRow     dr   = HasRow(DetectorName, ItemType); // sets the connection
            Detectors   dets = new Detectors(db);
            long        l    = dets.PrimaryKey(DetectorName);
            Descriptors mats = new Descriptors("material_types", db);
            long        m    = mats.PrimaryKey(ItemType);

            if (l == -1 || m == -1)
            {
                DBMain.AltLog(LogLevels.Warning, 70130, "Missing Det/Mat keys ({0},{1}) selecting AnalysisMethods", l, m);
                return(false);
            }


            if (dr == null)     // a new entry!
            {
                string sSQL = "insert into analysis_method_rec ";
                sParams.Add(new Element("item_type_id", m));
                sParams.Add(new Element("analysis_method_detector_id", l));
                sSQL = sSQL + sParams.ColumnsValues;
                res  = db.Execute(sSQL);
            }
            else
            {
                string wh    = " where item_type_id= " + m.ToString() + " AND analysis_method_detector_id=" + l.ToString();
                string sSQL1 = "UPDATE analysis_method_rec SET ";
                string sSQL  = sSQL1 + sParams.ColumnEqValueList + wh;
                res = db.Execute(sSQL);
            }

            return(res);
        }
コード例 #31
0
ファイル: AnalysisMethods.cs プロジェクト: tempbottle/INCC6
        public bool Update(string DetectorName, string ItemType, ElementList sParams)
        {
                bool res = false;
                db.SetConnection();
                //NEXT: this duo-lookup part takes too long, so get the values once in a wrapper call, then cache them, then reuse them
                DataRow dr = HasRow(DetectorName, ItemType); // sets the connection
                Detectors dets = new Detectors(db);
                long l = dets.PrimaryKey(DetectorName);
                Descriptors mats = new Descriptors("material_types", db);
                long m = mats.PrimaryKey(ItemType);

                if (l == -1 || m == -1)
                {
                    DBMain.AltLog(LogLevels.Warning, 70130, "Missing Det/Mat keys ({0},{1}) selecting AnalysisMethods", l, m);
                    return false;
                }


                if (dr == null) // a new entry!
                {
                    string sSQL = "insert into analysis_method_rec ";
                    sParams.Add(new Element("item_type_id", m));
                    sParams.Add(new Element("analysis_method_detector_id", l));
                    sSQL = sSQL + sParams.ColumnsValues;
                    res = db.Execute(sSQL);
                }
                else
                {
                    string wh = " where item_type_id= " + m.ToString() + " AND analysis_method_detector_id=" + l.ToString();
                    string sSQL1 = "UPDATE analysis_method_rec SET ";
                    string sSQL = sSQL1 + sParams.ColumnEqValueList + wh;
                    res = db.Execute(sSQL);
                }
            
            return res;
        }
コード例 #32
0
ファイル: DetAndParams.cs プロジェクト: tempbottle/INCC6
 public bool Delete(string measDetId)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL1 = "DELETE from " + table;
     string sSQL1i = String.Empty;
     string wh = " where " + "detector_id = " + l.ToString();
     string sSQL = sSQL1 + wh;
     return db.Execute(sSQL);
 }
コード例 #33
0
ファイル: Strata.cs プロジェクト: tempbottle/INCC6
 // return the stratums associated with a detector
 public DataTable GetAssociations(string measDetId)
 {
     if (String.IsNullOrEmpty(measDetId))
         return Get();
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL = "Select * FROM stratum_ids INNER JOIN stratum_id_detector ON (stratum_id_detector.stratum_id=stratum_ids.stratum_id AND stratum_id_detector.detector_id=" + l.ToString() + ")";
     DataTable dt = db.DT(sSQL);
     return dt;
 }
コード例 #34
0
ファイル: Strata.cs プロジェクト: tempbottle/INCC6
 public bool Associate(string measDetId, string stratumID)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     long m = PrimaryKey(stratumID);
     string saSQL = "insert into stratum_id_detector VALUES(" + l.ToString() + "," + m.ToString() + ")";
     return db.Execute(saSQL);
 }
コード例 #35
0
ファイル: Strata.cs プロジェクト: tempbottle/INCC6
 // create a stratum and detector stratum association
 public bool Create(string measDetId, ElementList sParams)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL = InsertStratum(sParams);
     ArrayList sqlList = new ArrayList();
     sqlList.Add(sSQL);
     sqlList.Add(SQLSpecific.getLastID("stratum_ids"));
     long newID = db.ExecuteTransactionID(sqlList);
     string saSQL = "insert into stratum_id_detector VALUES(" + l.ToString() + "," + newID.ToString() + ")";
     return db.Execute(saSQL);
 }
コード例 #36
0
ファイル: Strata.cs プロジェクト: tempbottle/INCC6
 // delete all the stratum associations with a detector
 public bool Unassociate(string measDetId)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL = "DELETE FROM stratum_id_detector where " + "(stratum_id_detector.detector_id=" + l.ToString() + ")";
     return db.Execute(sSQL);
 }
コード例 #37
0
ファイル: Strata.cs プロジェクト: tempbottle/INCC6
 // return the named stratum associated with a detector
 public DataTable Get(string measDetId, string stratumId) 
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     long m = PrimaryKey(stratumId);
     string sSQL = "Select * FROM stratum_ids INNER JOIN stratum_id_detector ON " + 
         "(stratum_id_detector.stratum_id=stratum_ids.stratum_id AND stratum_id_detector.detector_id=" + l.ToString() 
         + " AND stratum_id_detector.stratum_id=" + m.ToString() + ")";
     DataTable dt = db.DT(sSQL);
     return dt;
 }
コード例 #38
0
 public bool Has(string DetectorName, string CounterType)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(DetectorName);
     string sSQL = "Select * from INNER JOIN LMMultiplicity, CountingParams ON (LMMultiplicity.detector_id=CountingParams.detector_id) " +
         "where detector_id=" + l.ToString() + " AND " + "counter_type=" + SQLSpecific.QVal(CounterType);
     DataTable dt = db.DT(sSQL);
     return (dt.Rows.Count > 0);
 }
コード例 #39
0
 private DataTable AllWithKeyNames(string DetectorName)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(DetectorName);
     string sSQLa = "Select * from CountingParams where CountingParams.detector_id=" + l.ToString();
     string sSQLb = "Select * from LMMultiplicity where LMMultiplicity.detector_id=" + l.ToString();
     DataTable dta = db.DT(sSQLa);
     DataTable dtb = db.DT(sSQLb);
     dta.Merge(dtb);
     return dta;
 }
コード例 #40
0
 private DataTable BasicSelect(string DetectorName, string CounterType, string table, string FA)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(DetectorName);
     return GetTable(l, CounterType, table, FA);
 }
コード例 #41
0
        public bool Insert(string DetectorName, string CounterType, ElementList sParams)
        {
            DataRow dr = null;

            string table = "CountingParams";
            if (CounterType.Equals("Multiplicity") || CounterType.Equals("Coincidence"))
                table = "LMMultiplicity";

            Detectors dets = new Detectors(db);
            long l = dets.PrimaryKey(DetectorName);
            if (l == -1)
            {
                DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l);
                return false;
            }

            if (table.Equals("LMMultiplicity"))
                dr = HasRow(l, CounterType, table, sParams, sParams[faidx].Value); // the FA parameter
            else
                dr = HasRow(l, CounterType, table, sParams);
            if (dr == null)
            {
                sParams.Add(new Element("detector_id", l));
                string sSQL = "Insert into " + table;
                sSQL += sParams.ColumnsValues;
                return db.Execute(sSQL);
            }
            else
            {
                // identical row found, skip it
                return false;
            }
        }
コード例 #42
0
ファイル: Detectors.cs プロジェクト: tempbottle/INCC6
 private string ResolvedKey(string val, IDB _db)
 {
     Detectors dets = new Detectors(_db);
     if (Id)
     {
         long l = dets.PrimaryKey(val);
         return Field + "=" + l.ToString();
     }
     else
     {
         return Field + "=" + SQLSpecific.Value(val, true);   
     }
 }
コード例 #43
0
ファイル: acq.cs プロジェクト: hnordquist/INCC6
 public bool Update(string measDetId, string item_type, ElementList sParams)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL1 = "UPDATE LMAcquireParams SET ";
     string sSQL1i = String.Empty;
     string wh = " where " + "item_type = " + SQLSpecific.Value(item_type, true) + " AND detector_id = " + l.ToString();
     string sSQL = sSQL1 + sParams.ColumnEqValueList + wh;
     return db.Execute(sSQL);
 }
コード例 #44
0
ファイル: acq.cs プロジェクト: hnordquist/INCC6
 public DataTable Get(DateTimeOffset measDatetime, string measDetId, string item_type)
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL = "Select * FROM LMAcquireParams where detector_id = " + l.ToString() + " AND item_type=" + SQLSpecific.Value(item_type, true);
     DataTable dt = db.DT(sSQL);
     return dt;
 }
コード例 #45
0
ファイル: Detectors.cs プロジェクト: tempbottle/INCC6
 public bool Update(string measDetId, string table, ElementList sParams) 
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     if (table == "net")
         return UpdateNetComm(l, sParams, db);
     else
         return UpdateCfg(l, sParams, db);
 }
コード例 #46
0
ファイル: Detectors.cs プロジェクト: tempbottle/INCC6
 public DataTable Get(string measDetId) 
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(measDetId);
     string sSQL = "Select * from LMNetComm, LMHWParams where (LMNetComm.detector_id=" + l.ToString() + " AND LMHWParams.detector_id=" + l.ToString() +")";
     DataTable dt = db.DT(sSQL);
     return dt;
 }
コード例 #47
0
ファイル: AnalysisMethods.cs プロジェクト: tempbottle/INCC6
 private void GetKeys(string DetectorName, string ItemType, out long l, out long m)
 {
      db.SetConnection();
      Detectors dets = new Detectors(db);
      l = dets.PrimaryKey(DetectorName);
      Descriptors mats = new Descriptors("material_types", db);
      m = mats.PrimaryKey(ItemType);
 }
コード例 #48
0
 public long DeleteAll(string DetectorName)
 {
     Detectors dets = new Detectors(db);
     long l = dets.PrimaryKey(DetectorName);
     if (l == -1)
     {
         DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det key ({0}) selecting CountingParams", l);
         return -1;
     }
     string table1 = "CountingParams";
     string table2 = "LMMultiplicity";
     ArrayList sqlList = new ArrayList();
     sqlList.Add("DELETE FROM " + table1 + " where detector_id=" + l.ToString());
     sqlList.Add("DELETE FROM " + table2 + " where detector_id=" + l.ToString());
     return db.Execute(sqlList);
 }