Example #1
0
        public long Create(long mid, ElementList resParams)
        {
            db.SetConnection();
            resParams.Add(new Element("mid", mid));
            ArrayList sqlList = new ArrayList();
            string    sSQL1   = "Insert into " + this.table + " ";
            string    sSQL    = sSQL1 + resParams.ColumnsValues;

            sqlList.Add(sSQL);
            sqlList.Add(SQLSpecific.getLastID(table));
            return(db.ExecuteTransactionID(sqlList));
        }
Example #2
0
        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));
        }
Example #3
0
        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));
        }
Example #4
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));
        }
Example #5
0
        // i think this was meant to insert new types as well as new sets of SR params
        public long Insert(string DetectorName, string DetectorAlias, Int32 DetectorType, string DetectorElectronics, string DetectorDesc)
        {
            long DetectorID = -1;

            DataRow dr = HasRow(DetectorName, DetectorType, DetectorElectronics); // sets the connection

            if (dr == null)                                                       // a new entry!
            {
                ArrayList sqlList = new ArrayList();
                string    sSQL    = "insert into detectors (detector_name,detector_alias,detector_type_id,electronics_id,detector_type_freeform)";
                string    sv      = " values (" + SQLSpecific.QVal(DetectorName) + "," + SQLSpecific.QVal(DetectorAlias) + "," + DetectorType.ToString() +
                                    "," + SQLSpecific.QVal(DetectorElectronics) + "," + SQLSpecific.QVal(DetectorDesc) + ")";
                sqlList.Add(sSQL + sv);
                sqlList.Add(SQLSpecific.getLastID("detectors"));
                DetectorID = db.ExecuteTransactionID(sqlList);
            }
            else // already there, just return the id
            {
                DetectorID = PrimaryKey(DetectorName);
            }
            return(DetectorID);
        }
Example #6
0
        public long Update(string Name, ElementList sParams)
        {
            db.SetConnection();
            DataTable dt = GetRows(Name); // must be unknown or at least one with same name because unique did not fire

            if (dt != null)
            {
                string wh   = " where item_name = " + SQLSpecific.QVal(Name);
                string sSQL = "UPDATE collar_data_entry SET ";
                sSQL += sParams.ColumnEqValueList + wh;
                return(db.Execute(sSQL) ? 0 : -1);
            }
            else  // totally new
            {
                ArrayList sqlList = new ArrayList();
                string    sSQL    = "Insert into collar_data_entry ";
                sSQL += sParams.ColumnsValues;
                sqlList.Add(sSQL);
                sqlList.Add(SQLSpecific.getLastID("collar_data_entry"));
                return(db.ExecuteTransactionID(sqlList));
            }
        }
Example #7
0
        public long Create(ElementList collar, ElementList collar_det, ElementList k5)
        {
            long success = 0;

            db.SetConnection();
            ArrayList sqlList = new ArrayList();
            // The collar is made of three records. One is in collar_rec, one in collar_detector, and one in collar_k5
            string sSQL = "Insert into collar_rec ";

            sSQL += collar.ColumnsValues;
            sqlList.Add(sSQL);
            sqlList.Add(SQLSpecific.getLastID("collar_rec"));
            success = db.ExecuteTransactionID(sqlList);

            sqlList = new ArrayList();
            // The collar is made of three records. One is in collar_rec, one in collar_detector, and one in collar_k5
            sSQL  = "Insert into collar_detector_rec ";
            sSQL += collar_det.ColumnsValues;
            sqlList.Add(sSQL);
            sqlList.Add(SQLSpecific.getLastID("collar_detector_rec"));
            if (success != -1) //Catch failure at each sql statement
            {
                success = db.ExecuteTransactionID(sqlList);
            }

            sqlList = new ArrayList();
            // The collar is made of three records. One is in collar_rec, one in collar_detector, and one in collar_k5
            sSQL  = "Insert into collar_k5_rec ";
            sSQL += k5.ColumnsValues;
            sqlList.Add(sSQL);
            sqlList.Add(SQLSpecific.getLastID("collar_k5_rec"));
            if (success != -1) //Catch failure at each sql statement
            {
                success = db.ExecuteTransactionID(sqlList);
            }

            return(success);
        }