public List <Traject> GetTrajectenbyStations(long beginStationId, long eindStationId) { try { string query = "SELECT id, naam, actief FROM GetTrajects" + " WHERE beginPerronId IN ( SELECT Id FROM Perron WHERE stationId = @beginstationid)" + " AND eindPerronId IN ( SELECT Id FROM Perron WHERE = @eindstationid"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("beginstationid", beginStationId.ToString()), new KeyValuePair <string, string>("eindstationid", eindStationId.ToString()) }; DataSet results = ExecuteSql(query, parameters); List <Traject> trajecten = new List <Traject>(); if (results != null) { for (int x = 0; x < results.Tables[0].Rows.Count; x++) { Traject t = DataSetParser.DataSetToTraject(results, x); trajecten.Add(t); } } return(trajecten); } catch { return(null); } }
public Traject GetTrajectbyId(long id) { string sql = "Select * from Traject where id=@id"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("id", id.ToString()) }; DataSet results = ExecuteSql(sql, parameters); Traject t = null; if (results != null && results.Tables[0].Rows.Count > 0) { t = DataSetParser.DataSetToTraject(results, 0); } return(t); }
public List <Traject> GetAllTrajecten() { string sql = "Select * from Traject "; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); DataSet results = ExecuteSql(sql, parameters); List <Traject> trajecten = new List <Traject>(); if (results != null) { for (int x = 0; x < results.Tables[0].Rows.Count; x++) { Traject t = DataSetParser.DataSetToTraject(results, x); trajecten.Add(t); } } return(trajecten); }