public Station GetStationbyId(long id) { string sql = "Select * from Station 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); Station s = null; if (results != null && results.Tables[0].Rows.Count > 0) { s = DataSetParser.DataSetToStation(results, 0); } return(s); }
public List <Station> GetAllStations() { string sql = "Select * from Station"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); DataSet results = ExecuteSql(sql, parameters); List <Station> stations = new List <Station>(); if (results != null) { for (int x = 0; x < results.Tables[0].Rows.Count; x++) { Station s = DataSetParser.DataSetToStation(results, x); stations.Add(s); } } return(stations); }