Example #1
0
 public void AddLineTrip(LineTrip trip)
 {
     if (DataSource.ListLineTrips.FirstOrDefault(t => t.TripId == trip.TripId) != null)
     {
         throw new ArgumentException("Duplicate trip");
     }
     DataSource.ListLineTrips.Add(trip.Clone());
 }
Example #2
0
 public void AddLineTrip(LineTrip trip)
 {
     if (DataSource.ListLineTrips.FirstOrDefault(t => t.LineId == trip.LineId &&
                                                 t.StartTimeRange == trip.StartTimeRange) != null)
     {
         throw new DuplicateLineTripException(GetLine(trip.LineId).BusLineNumber, trip.StartTimeRange);
     }
     DataSource.ListLineTrips.Add(trip.Clone());
 }
 public void AddLineTrip(LineTrip lineTrip)//IDL function
 {
     if ((DataSource.LinesTrip.FirstOrDefault(curLine => curLine.LineId == lineTrip.LineId && curLine.StartAt == lineTrip.StartAt && !curLine.Deleted) != null))
     {
         throw new LineTripExceptions(lineTrip.LineId, lineTrip.StartAt, true);
     }
     else
     {
         DataSource.LinesTrip.Add(lineTrip.Clone());
     }
 }
        public LineTrip GetLineTrip(int lineId, TimeSpan start)//IDL function
        {
            LineTrip retValue = DataSource.LinesTrip.FirstOrDefault(curLine => curLine.LineId == lineId && curLine.StartAt == start && !curLine.Deleted);

            if (retValue != null)
            {
                return(retValue.Clone());
            }
            else
            {
                throw new LineTripExceptions(lineId, start, false);
            }
        }
Example #5
0
        public LineTrip GetLineTrip(int lineId, int stationKey)
        {
            LineTrip trip = DataSource.ListLineTrips.Find(t => t.LineIdTrip == lineId);

            if (trip != null)
            {
                return(trip.Clone());
            }
            else
            {
                throw new ArgumentException("This trip doesn't exist");
            }
        }
Example #6
0
        public LineTrip GetLineTrip(int lineId, TimeSpan now)
        {
            LineTrip trip = DataSource.ListLineTrips.Find(s => s.LineId == lineId && s.StartTimeRange <= now &&
                                                          s.EndTimeRange >= now);

            if (trip != null)
            {
                return(trip.Clone());
            }
            else
            {
                int LineNumber = GetLine(lineId).BusLineNumber;
                throw new InexistantLineTripException(LineNumber, now);
            }
        }