private static void BoatReady(TimeTableEntry timetable, PortModel destination, FerryJourney ferryJourney)
        {
            if (ferryJourney.Ferry == null)
                FerryManager.AddFerry(timetable, ferryJourney);

            var ferry = ferryJourney.Ferry;

            var time = FerryModule.TimeReady(timetable, destination);
            destination.AddBoat(time, ferry);
        }
        public static TimeSpan TimeReady(TimeTableEntry timetable, PortModel destination)
        {
            if (timetable == null)
                return new TimeSpan(0,0,0);
            if (destination == null)
                throw new ArgumentNullException("destination");

            var arrivalTime = timetable.Time.Add(timetable.JourneyTime);
            int turnaroundTime = FerryManager.GetFerryTurnaroundTime(destination);
            var timeReady = arrivalTime.Add(TimeSpan.FromMinutes(turnaroundTime));
            return timeReady;
        }
Example #3
0
        private static void BoatReady(TimeTableEntry timetable, PortModel destination, FerryJourney ferryJourney)
        {
            if (ferryJourney.Ferry == null)
            {
                FerryManager.AddFerry(timetable, ferryJourney);
            }

            var ferry = ferryJourney.Ferry;

            var time = FerryModule.TimeReady(timetable, destination);

            destination.AddBoat(time, ferry);
        }
        public static FerryJourney CreateFerryJourney(List<PortModel> ports, TimeTableEntry timetable)
        {
            if (ports == null)
                return null;

            if (timetable == null)
                return null;

            var fj = new FerryJourney
            {
                Origin = ports.Single(x => x.Id == timetable.OriginId),
                Destination = ports.Single(x => x.Id == timetable.DestinationId)
            };
            return fj;
        }
Example #5
0
        public static TimeSpan TimeReady(TimeTableEntry timetable, PortModel destination)
        {
            if (timetable == null)
            {
                return(new TimeSpan(0, 0, 0));
            }
            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }

            var arrivalTime    = timetable.Time.Add(timetable.JourneyTime);
            int turnaroundTime = FerryManager.GetFerryTurnaroundTime(destination);
            var timeReady      = arrivalTime.Add(TimeSpan.FromMinutes(turnaroundTime));

            return(timeReady);
        }
        public static FerryJourney CreateFerryJourney(List <PortModel> ports, TimeTableEntry timetable)
        {
            if (ports == null)
            {
                return(null);
            }

            if (timetable == null)
            {
                return(null);
            }

            var fj = new FerryJourney
            {
                Origin      = ports.Single(x => x.Id == timetable.OriginId),
                Destination = ports.Single(x => x.Id == timetable.DestinationId)
            };

            return(fj);
        }
 public static void AddFerry(TimeTableEntry timetable, FerryJourney journey)
 {
     journey.Ferry = journey.Origin.GetNextAvailable(timetable.Time);
 }
 public static void AddFerry(TimeTableEntry timetable, FerryJourney journey)
 {
     journey.Ferry = journey.Origin.GetNextAvailable(timetable.Time);
 }