Exemplo n.º 1
0
        public long Add(string name, DateTimeOffset date, string mtype, string filename, string notes)
        {
            db.SetConnection();
            ArrayList sqlList = new ArrayList();
            string    sSQL1   = "Insert into measurements (detector_id, DateTime, Notes, Type, FileName) VALUES (" + SQLSpecific.QVal(name)
                                + "," + SQLSpecific.getDate(date) + "," + SQLSpecific.QVal(notes) + "," + SQLSpecific.QVal(mtype) +
                                "," + SQLSpecific.QVal(filename) + ")";

            sqlList.Add(sSQL1);
            sqlList.Add(SQLSpecific.getLastID("measurements"));
            return(db.ExecuteTransactionID(sqlList));
        }
Exemplo n.º 2
0
 public Element(string Name, DateTimeOffset dto)
 {
     this.Name = string.Copy(Name); Value = SQLSpecific.getDate(dto); Quote = false;
 }
Exemplo n.º 3
0
        public long Lookup(string name, DateTime dt)
        {
            if (String.IsNullOrEmpty(name))
            {
                return(-1);
            }
            db.SetConnection();
            string s  = "SELECT * FROM HVResult WHERE detector_id=" + SQLSpecific.QVal(name) + " AND HVPDateTime=" + SQLSpecific.getDate(dt);
            string r  = db.Scalar(s);
            long   lr = -1;

            if (!Int64.TryParse(r, out lr))
            {
                lr = -1;
            }
            return(lr);
        }
Exemplo n.º 4
0
        public bool Update(string name, DateTime dt, ElementList sParams)
        {
            db.SetConnection();
            string sSQL1 = "UPDATE HVResult SET ";
            string wh    = " where detector_id=" + SQLSpecific.QVal(name) + " AND HVPDateTime=" + SQLSpecific.getDate(dt);
            string sSQL  = sSQL1 + sParams.ColumnEqValueList + wh;

            return(db.Execute(sSQL));
        }
Exemplo n.º 5
0
        public long CountOf(string name, DateTimeOffset dt, string type)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(0);
            }
            db.SetConnection();
            string s = "SELECT COUNT(*) FROM measurements WHERE detector_id=" + SQLSpecific.QVal(name) + " AND DateTime=" + SQLSpecific.getDate(dt);

            if (!string.IsNullOrEmpty(type))
            {
                s += " AND Type=" + SQLSpecific.QVal(type);
            }

            string r  = db.Scalar(s);
            long   lr = -1;

            if (!long.TryParse(r, out lr))
            {
                lr = -1;
            }
            return(lr);
        }
Exemplo n.º 6
0
        public long Lookup(string detname, DateTime dt)
        {
            if (string.IsNullOrEmpty(detname))
            {
                return(-1);
            }
            db.SetConnection();
            Measurements m = new Measurements(db);
            string       s = "select results_rec.id from results_rec INNER JOIN measurements ON " +
                             "(measurements.id=results_rec.mid AND measurements.detector_id=" + SQLSpecific.QVal(detname) +
                             "AND measurements.DateTime=results_rec.original_meas_date) where results_rec.original_meas_date=" + SQLSpecific.getDate(dt);
            string r  = db.Scalar(s);
            long   lr = -1;

            if (!long.TryParse(r, out lr))
            {
                lr = -1;
            }
            return(lr);
        }