51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Data;
|
|
|
|
using bsmd.AISService.AIS;
|
|
|
|
namespace bsmd.AISService.DB
|
|
{
|
|
public class AISWatchkeeper
|
|
{
|
|
private static string GetAllWatchkeeperShipsQuery = "SELECT mmsi, name, aktiv, watching, tracking FROM wk_ship";
|
|
private int mmsi;
|
|
private string name;
|
|
private bool aktiv;
|
|
private bool watching;
|
|
private bool tracking;
|
|
|
|
public int MMSI
|
|
{
|
|
get { return this.mmsi; }
|
|
}
|
|
|
|
public bool Aktiv
|
|
{
|
|
get { return this.aktiv; }
|
|
}
|
|
|
|
public static List<AISWatchkeeper> GetWatchkeeperShips(DBConnector con)
|
|
{
|
|
List<AISWatchkeeper> result = new List<AISWatchkeeper>();
|
|
IDataReader reader = con.ExecuteQuery(AISWatchkeeper.GetAllWatchkeeperShipsQuery);
|
|
if (reader == null) return result;
|
|
while (reader.Read())
|
|
{
|
|
AISWatchkeeper wkShip = new AISWatchkeeper();
|
|
wkShip.mmsi = reader.GetInt32(0);
|
|
wkShip.name = reader.GetString(1);
|
|
wkShip.aktiv = reader.GetBoolean(2);
|
|
wkShip.watching = reader.GetBoolean(3);
|
|
wkShip.tracking = reader.GetBoolean(4);
|
|
result.Add(wkShip);
|
|
}
|
|
reader.Close();
|
|
return result;
|
|
}
|
|
|
|
|
|
}
|
|
}
|