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;
        }
        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));
        }
Beispiel #3
0
 // return the stratums only
 public DataTable Get()
 {
     db.SetConnection();
     Detectors dets = new Detectors(db);
     string sSQL = "Select * FROM stratum_ids";
     DataTable dt = db.DT(sSQL);
     return dt;
 }
Beispiel #4
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));
        }
Beispiel #5
0
 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;
 }
Beispiel #6
0
        // return the stratums only
        public DataTable Get()
        {
            db.SetConnection();
            Detectors dets = new Detectors(db);
            string    sSQL = "Select * FROM stratum_ids";
            DataTable dt   = db.DT(sSQL);

            return(dt);
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
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));
        }
Beispiel #11
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);
        }
Beispiel #12
0
 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);
 }
Beispiel #13
0
 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);
 }
Beispiel #14
0
 // 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;
 }
Beispiel #15
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);
        }
Beispiel #16
0
        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));
        }
Beispiel #17
0
        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);
        }
Beispiel #18
0
        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));
        }
Beispiel #19
0
        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));
        }
Beispiel #20
0
        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));
        }
Beispiel #21
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);
        }
Beispiel #22
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);
        }
Beispiel #23
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));
            }
        }
Beispiel #24
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);
        }
Beispiel #25
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));
        }
Beispiel #26
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));
            }
        }
        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));
            }
        }
Beispiel #28
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));
        }
        // 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);
            }
        }
Beispiel #30
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);
            }
        }
        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);
            }
        }
Beispiel #32
0
        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);
        }
Beispiel #33
0
        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;
        }
Beispiel #34
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;
 }
 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);
 }
Beispiel #36
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);
 }
Beispiel #37
0
 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;
 }
        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;
            }
        }
Beispiel #39
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);
 }
Beispiel #40
0
 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);
 }
Beispiel #41
0
 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);
 }
Beispiel #42
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);   
     }
 }
Beispiel #43
0
        // 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);
        }
Beispiel #44
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;
 }
Beispiel #45
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);
 }
Beispiel #46
0
 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);
 }
 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;
 }
Beispiel #48
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;
 }
 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);
 }
Beispiel #50
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);
 }
 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);
 }
Beispiel #52
0
        // 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;
        }