BO.LineTrip SetArrivalTimeToStation(BO.Station station, BO.LineTrip lineTrip) { TimeSpan arrivalTime = TimeSpan.Zero; // Summarize the time of the line until it reaches the given station foreach (var lineStation in GetAllLineStationsByLineID(lineTrip.LineId)) { arrivalTime += lineStation.TimeFromNext; if (lineStation.Station == station.Code) { break; } } lineTrip.ArrivalTimeToStation = lineTrip.CurrentTimeToStation = arrivalTime + lineTrip.StartAt; return(lineTrip); }
/// <summary> /// Get a single line trip from the database /// build the line trip with the line code and the last station of the line /// </summary> /// <param name="id"></param> /// <returns></returns> public BO.LineTrip GetLineTrip(int id) { BO.LineTrip lineTripBo = new BO.LineTrip(); try { var lineTripDo = dl.GetLineTrip(id); lineTripDo.CopyPropertiesTo(lineTripBo); var line = GetLine(lineTripBo.LineId); lineTripBo.LineCode = line.Code; lineTripBo.LastStation = line.LastStationName; return(lineTripBo); } catch (DO.BadLineTripException ex) { throw new BO.BadLineTripException(id, ex.Message); } }
public TimeSpan CalculateDistance(BO.LineTrip trip) { return(dl.CalculateDistance(LineTripBoDoAdapter(trip))); }
public void DeleteLineTrip(BO.LineTrip trip) { dl.DeleteLineTrip(LineTripBoDoAdapter(trip)); }
public void AddLineTrip(BO.LineTrip trip) { dl.AddLineTrip(LineTripBoDoAdapter(trip)); }
public BO.LineTrip LineTripDoBoAdapter(DO.LineTrip lineTripDo) { BO.LineTrip lineTripBo = new BO.LineTrip(); lineTripDo.CopyPropertiesTo(lineTripBo); return(lineTripBo); }
DO.LineTrip LineTripBoDoAdapter(BO.LineTrip lineTripBo) { DO.LineTrip lineTripDo = new DO.LineTrip(); lineTripBo.CopyPropertiesTo(lineTripDo); return(lineTripDo); }
/// <summary> /// Add new line trip to the database /// </summary> /// <param name="lineTrip"></param> /// <returns></returns> public int AddLineTrip(BO.LineTrip lineTrip) { var lineTripDo = lineTrip.CopyPropertiesToNew(typeof(DO.LineTrip)) as DO.LineTrip; return(dl.AddLineTrip(lineTripDo)); }