Example #1
0
        BO.BusLine BusLineDoBoAdapter(DO.BusLine lineDo)
        {
            BO.BusLine lineBo = new BO.BusLine();
            lineDo.CopyPropertiesTo(lineBo);

            DO.BusLine busLine = dl.GetLine(lineBo.BusLineNumber, AreasAdapter(lineBo.Area));
            List <int> request = (from station in dl.GetAllLineStationsBy(s => s.LineId == busLine.Id)
                                  orderby station.RankInLine
                                  select station.StationKey).ToList();

            lineBo.AllStationsOfLine = request;
            for (int i = 0; i < lineBo.AllStationsOfLine.Count() - 1; i++)
            {
                DO.BusStation station1 = BusStationBoDoAdapter(GetBusStation(lineBo.AllStationsOfLine.ElementAt(i)));
                DO.BusStation station2 = BusStationBoDoAdapter(GetBusStation(lineBo.AllStationsOfLine.ElementAt(i + 1)));

                lineBo.TotalDistance += dl.GetFollowingStations(station1, station2).Distance;
                lineBo.TotalTime     += dl.GetFollowingStations(station1, station2).AverageJourneyTime;
            }
            lineBo.TotalDistance = Math.Round(lineBo.TotalDistance /= 1000);

            lineBo.AllLineTripsOfLine = (from lt in GetAllLineTripsBy(t => t.LineId == busLine.Id)
                                         orderby lt.StartTimeRange
                                         select lt).ToList();

            return(lineBo);
        }
Example #2
0
 DO.BusLine BusLineBoDoAdapter(BO.BusLine lineBo)
 {
     DO.BusLine lineDo = new DO.BusLine();
     lineBo.CopyPropertiesTo(lineDo);
     return(lineDo);
 }