public List <Sector> getSectorList() { List <Sector> sectorList = new List <Sector>(); string query = @"select ID from [Location];"; List <int> sectorID = databaseConnection.executeReaderIntList(query); foreach (int id in sectorID) { query = @"Select RailNumber from [Location] where ID =" + id + @";"; int railnummer = (int)databaseConnection.executeReaderInt(query); query = @"Select SectorNumber from [Location] where ID =" + id + @";"; int sectornummer = (int)databaseConnection.executeReaderInt(query); query = @"Select Status from [Location] where ID =" + id + @";"; RailStatus.railStatus status = (RailStatus.railStatus)databaseConnection.executeReaderInt(query); sectorList.Add(new Sector(railnummer, sectornummer, status)); } return(sectorList); }
public Sector(int railNumber, int Number, RailStatus.railStatus status) { this.railNumber = railNumber; this.Number = Number; this.status = status; }