Exemple #1
0
 public int SignalLevelDelete(SignalLevelDesignator sd)
 {
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "DELETE FROM " + SignalLevelDesignator.TableName + " WHERE LastUpdated = @LastUpdated";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(sd.AsUNIXTime("LastUpdated"));
         return(db.ExecuteNonQuery(db.DBCommand));
     }
 }
Exemple #2
0
 public int SignalLevelUpdate(SignalLevelDesignator sd)
 {
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "UPDATE " + SignalLevelDesignator.TableName + " SET Level = @Level, LastUpdated = @LastUpdated WHERE LastUpdated = @LastUpdated";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(sd.AsDouble("Level"));
         db.DBCommand.Parameters.Add(sd.AsUNIXTime("LastUpdated"));
         return(db.ExecuteNonQuery(db.DBCommand));
     }
 }
Exemple #3
0
 public int SignalLevelInsert(SignalLevelDesignator sd)
 {
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "INSERT INTO " + SignalLevelDesignator.TableName + " (Level, LastUpdated) VALUES (@Level, @LastUpdated)";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(sd.AsDouble("Level"));
         db.DBCommand.Parameters.Add(sd.AsUNIXTime("LastUpdated"));
         return(db.ExecuteNonQuery(db.DBCommand));
     }
 }
Exemple #4
0
 public DateTime SignalLevelFindLastUpdated(SignalLevelDesignator sd)
 {
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "SELECT LastUpdated FROM " + SignalLevelDesignator.TableName + " WHERE LastUpdated = @LastUpdated";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(sd.AsUNIXTime("LastUpdated"));
         object result = db.ExecuteScalar(db.DBCommand);
         if (IsValid(result))
         {
             return(SQLiteEntry.UNIXTimeToDateTime((int)result));
         }
     }
     return(DateTime.MinValue);
 }
Exemple #5
0
 public bool SignalLevelExists(SignalLevelDesignator sd)
 {
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "SELECT EXISTS (SELECT LastUpdated FROM " + SignalLevelDesignator.TableName + " WHERE LastUpdated = @LastUpdated";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(sd.AsUNIXTime("LastUpdated"));
         object result = db.DBCommand.ExecuteScalar();
         if (IsValid(result) && ((long)result > 0))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #6
0
 public SignalLevelDesignator SignalLevelFind(SignalLevelDesignator sd)
 {
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "SELECT * FROM " + SignalLevelDesignator.TableName + " WHERE LastUpdated = @LastUpdated";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(sd.AsUNIXTime("LastUpdated"));
         try
         {
             DataTable Result = db.Select(db.DBCommand);
             if ((Result != null) && (Result.Rows.Count > 0))
             {
                 return(new SignalLevelDesignator(Result.Rows[0]));
             }
         }
         catch (Exception ex)
         {
             Log.WriteMessage(ex.ToString(), LogLevel.Error);
         }
     }
     return(null);
 }