Esempio n. 1
0
        public PropagationHorizonDesignator PropagationHorizonFind(PropagationHorizonDesignator hor, ELEVATIONMODEL model)
        {
            System.Data.SQLite.SQLiteDatabase db = GetPropagationDatabase(model);
            // save localobstruction
            LocalObstructionDesignator obstr = hor.LocalObstruction;

            lock (db.DBCommand)
            {
                db.DBCommand.CommandText = "SELECT * FROM " + PropagationHorizonDesignator.TableName + " WHERE Lat = @Lat AND Lon = @Lon AND h = @h AND Dist = @Dist AND QRG = @QRG AND Radius = @Radius AND F1_Clearance = @F1_Clearance AND StepWidth = @StepWidth";
                db.DBCommand.Parameters.Clear();
                db.DBCommand.Parameters.Add(hor.AsDouble("Lat"));
                db.DBCommand.Parameters.Add(hor.AsDouble("Lon"));
                db.DBCommand.Parameters.Add(hor.AsDouble("h"));
                db.DBCommand.Parameters.Add(hor.AsDouble("Dist"));
                db.DBCommand.Parameters.Add(hor.AsDouble("QRG"));
                db.DBCommand.Parameters.Add(hor.AsDouble("Radius"));
                db.DBCommand.Parameters.Add(hor.AsDouble("F1_Clearance"));
                db.DBCommand.Parameters.Add(hor.AsDouble("StepWidth"));
                DataTable Result = db.Select(db.DBCommand);
                if ((Result != null) && (Result.Rows.Count > 0))
                {
                    return(new PropagationHorizonDesignator(Result.Rows[0], obstr));
                }
            }
            return(null);
        }
Esempio n. 2
0
 public int PropagationHorizonDelete(PropagationHorizonDesignator hor, ELEVATIONMODEL model)
 {
     System.Data.SQLite.SQLiteDatabase db = GetPropagationDatabase(model);
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "DELETE FROM " + PropagationHorizonDesignator.TableName + " WHERE Lat = @Lat AND Lon = @Lon AND h = @h AND Dist = @Dist AND QRG = @QRG AND Radius = @Radius AND F1_Clearance = @F1_Clearance AND StepWidth = @StepWidth";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(hor.AsDouble("Lat"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Lon"));
         db.DBCommand.Parameters.Add(hor.AsDouble("h"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Dist"));
         db.DBCommand.Parameters.Add(hor.AsDouble("QRG"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Radius"));
         db.DBCommand.Parameters.Add(hor.AsDouble("F1_Clearance"));
         db.DBCommand.Parameters.Add(hor.AsDouble("StepWidth"));
         return(db.ExecuteNonQuery(db.DBCommand));
     }
 }
Esempio n. 3
0
 public int PropagationHorizonUpdate(PropagationHorizonDesignator hor, ELEVATIONMODEL model)
 {
     System.Data.SQLite.SQLiteDatabase db = GetPropagationDatabase(model);
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "UPDATE " + PropagationHorizonDesignator.TableName + " SET Lat = @Lat, Lon = @Lon, h = @h, Dist = @Dist, QRG = @QRG, Radius = @Radius, F1_Clearance = @F1_Clearance, @StepWidth = @StepWidth, Horizon = @Horizon, LastUpdated = @LastUpdated WHERE Lat = @Lat AND Lon = @Lon AND h = @h AND Dist = @Dist AND QRG = @QRG AND Radius = @Radius AND F1_Clearance = @F1_Clearance AND StepWidth = @StepWidth";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(hor.AsDouble("Lat"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Lon"));
         db.DBCommand.Parameters.Add(hor.AsDouble("h"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Dist"));
         db.DBCommand.Parameters.Add(hor.AsDouble("QRG"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Radius"));
         db.DBCommand.Parameters.Add(hor.AsDouble("F1_Clearance"));
         db.DBCommand.Parameters.Add(hor.AsDouble("StepWidth"));
         db.DBCommand.Parameters.Add(hor.AsBinary("Horizon"));
         db.DBCommand.Parameters.Add(hor.AsUNIXTime("LastUpdated"));
         return(db.ExecuteNonQuery(db.DBCommand));
     }
 }
Esempio n. 4
0
 public int PropagationHorizonInsert(PropagationHorizonDesignator hor, ELEVATIONMODEL model)
 {
     System.Data.SQLite.SQLiteDatabase db = GetPropagationDatabase(model);
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "INSERT INTO " + PropagationHorizonDesignator.TableName + " (Lat, Lon, h, Dist, QRG, Radius, F1_Clearance, StepWidth, Horizon, LastUpdated) VALUES (@Lat, @Lon, @h, @Dist, @QRG, @Radius, @F1_Clearance, @StepWidth, @Horizon, @LastUpdated)";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(hor.AsDouble("Lat"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Lon"));
         db.DBCommand.Parameters.Add(hor.AsDouble("h"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Dist"));
         db.DBCommand.Parameters.Add(hor.AsDouble("QRG"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Radius"));
         db.DBCommand.Parameters.Add(hor.AsDouble("F1_Clearance"));
         db.DBCommand.Parameters.Add(hor.AsDouble("StepWidth"));
         db.DBCommand.Parameters.Add(hor.AsBinary("Horizon"));
         db.DBCommand.Parameters.Add(hor.AsUNIXTime("LastUpdated"));
         return(db.ExecuteNonQuery(db.DBCommand));
     }
 }
Esempio n. 5
0
 public DateTime PropagationHorizonFindLastUpdated(PropagationHorizonDesignator hor, ELEVATIONMODEL model)
 {
     System.Data.SQLite.SQLiteDatabase db = GetPropagationDatabase(model);
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "SELECT LastUpdated FROM " + PropagationHorizonDesignator.TableName + " WHERE Lat = @Lat AND Lon = @Lon AND h = @h AND Dist = @Dist AND QRG = @QRG AND Radius = @Radius AND F1_Clearance = @F1_Clearance AND StepWidth = @StepWidth";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(hor.AsDouble("Lat"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Lon"));
         db.DBCommand.Parameters.Add(hor.AsDouble("h"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Dist"));
         db.DBCommand.Parameters.Add(hor.AsDouble("QRG"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Radius"));
         db.DBCommand.Parameters.Add(hor.AsDouble("F1_Clearance"));
         db.DBCommand.Parameters.Add(hor.AsDouble("StepWidth"));
         object result = db.ExecuteScalar(db.DBCommand);
         if (result != null)
         {
             return(SQLiteEntry.UNIXTimeToDateTime((int)result));
         }
     }
     return(DateTime.MinValue);
 }
Esempio n. 6
0
 public bool PropagationHorizonExists(PropagationHorizonDesignator hor, ELEVATIONMODEL model)
 {
     System.Data.SQLite.SQLiteDatabase db = GetPropagationDatabase(model);
     lock (db.DBCommand)
     {
         db.DBCommand.CommandText = "SELECT EXISTS (SELECT LastUpdated FROM " + PropagationHorizonDesignator.TableName + " WHERE Lat = @Lat AND Lon = @Lon AND h = @h AND Dist = @Dist AND QRG = @QRG AND Radius = @Radius AND F1_Clearance = @F1_Clearance AND StepWidth = @StepWidth)";
         db.DBCommand.Parameters.Clear();
         db.DBCommand.Parameters.Add(hor.AsDouble("Lat"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Lon"));
         db.DBCommand.Parameters.Add(hor.AsDouble("h"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Dist"));
         db.DBCommand.Parameters.Add(hor.AsDouble("QRG"));
         db.DBCommand.Parameters.Add(hor.AsDouble("Radius"));
         db.DBCommand.Parameters.Add(hor.AsDouble("F1_Clearance"));
         db.DBCommand.Parameters.Add(hor.AsDouble("StepWidth"));
         long result = (long)db.DBCommand.ExecuteScalar();
         if (result > 0)
         {
             return(true);
         }
     }
     return(false);
 }