private static TrainTable GetTrainTableFromDataReader(SqlDataReader reader) { reader.Read(); TrainTable t = new TrainTable() { Id_Table = reader.GetInt32(0), DepartureStation = StationDAL.GetStationById(reader.GetInt32(1)).Name, ArrivalStation = StationDAL.GetStationById(reader.GetInt32(2)).Name, DepartureDate = reader.GetDateTime(3).ToShortDateString(), ArrivalDate = reader.GetDateTime(4).ToShortDateString(), DepartureTime = reader.GetValue(5).ToString(), ArrivalTime = reader.GetValue(6).ToString() }; return(t); }
private static IntermediateStation GetIntermediateStationFromDataReader(SqlDataReader reader) { reader.Read(); IntermediateStation t = new IntermediateStation() { Id_IntermediateStation = reader.GetInt32(0), Id_id_Station = reader.GetInt32(1), Station = StationDAL.GetStationById(reader.GetInt32(1)).Name, Id_id_Trip = reader.GetInt32(2), DepartureDate = reader.GetDateTime(3).ToShortDateString(), ArrivalDate = reader.GetDateTime(5).ToShortDateString(), DepartureTime = reader.GetValue(4).ToString(), ArrivalTime = reader.GetValue(6).ToString() }; return(t); }
private static List <TrainTable> GetTrainTablesListFromDataReader(SqlDataReader reader) { List <TrainTable> result = new List <TrainTable>(); while (reader.Read()) { TrainTable t = new TrainTable() { Id_Table = reader.GetInt32(0), DepartureStation = StationDAL.GetStationById(reader.GetInt32(1)).Name, ArrivalStation = StationDAL.GetStationById(reader.GetInt32(2)).Name, DepartureDate = reader.GetDateTime(3).ToShortDateString(), ArrivalDate = reader.GetDateTime(4).ToShortDateString(), DepartureTime = reader.GetValue(5).ToString(), ArrivalTime = reader.GetValue(6).ToString() }; result.Add(t); } return(result); }
private static List <IntermediateStation> GetIntermediateStationsListFromDataReader(SqlDataReader reader) { List <IntermediateStation> result = new List <IntermediateStation>(); while (reader.Read()) { IntermediateStation t = new IntermediateStation() { Id_IntermediateStation = reader.GetInt32(0), Id_id_Station = reader.GetInt32(1), Station = StationDAL.GetStationById(reader.GetInt32(1)).Name, Id_id_Trip = reader.GetInt32(2), DepartureDate = reader.GetDateTime(3).ToShortDateString(), ArrivalDate = reader.GetDateTime(5).ToShortDateString(), DepartureTime = reader.GetValue(4).ToString(), ArrivalTime = reader.GetValue(6).ToString() }; result.Add(t); } return(result); }