예제 #1
0
        ///////////////////////

        public bool UpdateCalib(string DetectorName, string ItemType, string calib_table, ElementList sParams)
        {
            //NEXT: this duo-lookup part takes too long, so get the values once in a wrapper call, then cache them, then reuse them
            long l, m;

            GetKeys(DetectorName, ItemType, out l, out m);
            DataRow dr = HasRow(l, m); // sets the connection

            if (l == -1 || m == -1)
            {
                DBMain.AltLog(LogLevels.Warning, 70137, "Missing Det/Mat keys ({0},{1}) selecting method calibration params", l, m);
                return(false);
            }
            string wh    = " where item_type_id= " + m.ToString() + " AND detector_id=" + l.ToString();
            string exsql = "select item_type_id from " + calib_table + wh; // 1 column is sufficient to show existence

            DataTable dt = db.DT(exsql);

            if (dt.Rows.Count < 1)
            {
                string sSQL = "insert into " + calib_table + " ";
                sParams.Add(new Element("item_type_id", m));
                sParams.Add(new Element("detector_id", l));
                sSQL += sParams.ColumnsValues;
                return(db.Execute(sSQL));
            }
            else
            {
                string sSQL1 = "UPDATE " + calib_table + " SET ";
                string sSQL  = sSQL1 + sParams.ColumnEqValueList + wh;
                return(db.Execute(sSQL));
            }
        }
예제 #2
0
파일: Results.cs 프로젝트: eric645/INCC6
        public long CreateMethod(long resid, long mid, ElementList resParams)
        {
            db.SetConnection();
            resParams.Add(new Element("rid", resid));
            resParams.Add(new Element("mid", mid));
            ArrayList sqlList = new ArrayList();
            string    sSQL1   = "Insert into " + MethodTableName(resParams.OptTable) + " ";
            string    sSQL    = sSQL1 + resParams.ColumnsValues;

            sqlList.Add(sSQL);
            sqlList.Add(SQLSpecific.getLastID(MethodTableName(resParams.OptTable)));
            return(db.ExecuteTransactionID(sqlList));
        }
예제 #3
0
        public long CreateTbl(long id, string table, ElementList sParams, IDB db)
        {
            sParams.Add(new Element("detector_id", id));
            string sSQL1 = "Insert into " + table + " ";
            string sSQL  = sSQL1 + sParams.ColumnsValues;

            ArrayList sqlList = new ArrayList();

            sqlList.Add(sSQL);
            sqlList.Add(SQLSpecific.getLastID(table));
            return(db.ExecuteTransactionID(sqlList));
        }
예제 #4
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));
        }
예제 #5
0
파일: Results.cs 프로젝트: eric645/INCC6
        public long Create(long measid, ElementList sParams)
        {
            db.SetConnection();
            ArrayList sqlList = new ArrayList();
            string    sSQL1   = "Insert into results_rec ";

            sParams.Add(new Element("mid", measid));
            string sSQL = sSQL1 + sParams.ColumnsValues; sqlList.Add(sSQL);

            sqlList.Add(SQLSpecific.getLastID("results_rec"));
            return(db.ExecuteTransactionID(sqlList));
        }
예제 #6
0
파일: Results.cs 프로젝트: eric645/INCC6
        public long Create(long mid, ElementList resParams)
        {
            db.SetConnection();
            resParams.Add(new Element("mid", mid));
            ArrayList sqlList = new ArrayList();
            string    sSQL1   = "Insert into " + table + "_m" + " ";
            string    sSQL    = sSQL1 + resParams.ColumnsValues;

            sqlList.Add(sSQL);
            sqlList.Add(SQLSpecific.getLastID(table + "_m"));
            return(db.ExecuteTransactionID(sqlList));
        }
예제 #7
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);
        }
        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));
            }
        }
예제 #9
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);
            }
        }
예제 #10
0
 protected string HVPRunInsertStatement(long HVPId, ElementList sParams)
 {
     sParams.Add(new Element("hvp_id", HVPId));
     return("Insert into HVStatus " + sParams.ColumnsValues);
 }
예제 #11
0
 protected string CycleInsertStatement(long Measurement_ID, ElementList sParams)
 {
     sParams.Add(new Element("mid", Measurement_ID));
     return("Insert into cycles " + sParams.ColumnsValues);
 }
예제 #12
0
 protected string CIInsertStatement(long cid, ElementList sParams)
 {
     sParams.Add(new Element("cid", cid));
     return("Insert into composite_isotopic_rec " + sParams.ColumnsValues);
 }