Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #3
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;
        }
Exemple #4
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);
 }