public GroupTrip(ScheduledRoute scheduledRoute, Ship ship)
 {
     this.route        = scheduledRoute ?? throw new ArgumentNullException(nameof(scheduledRoute));
     this.depatureTime = scheduledRoute.depatureTime;
     this.returnTime   = scheduledRoute.getReturnTime();
     this.tripType     = scheduledRoute.tripType;
     this.ship         = ship ?? throw new ArgumentNullException(nameof(ship));
 }
 public GroupTrip(Route route, DateTime depatureTime, TripType tripType, Ship ship)
 {
     this.depatureTime = depatureTime;
     this.returnTime   = this.depatureTime.AddMinutes((double)(route.driveTimeMinutes * tripType.driveTimeMultiplier));
     this.route        = route ?? throw new ArgumentNullException(nameof(route));
     this.tripType     = tripType ?? throw new ArgumentNullException(nameof(tripType));
     this.ship         = ship ?? throw new ArgumentNullException(nameof(ship));
 }
Example #3
0
 public PriceCategory(string name, TripType tripType, PersonCategory personCategory, decimal price, Route route)
 {
     this.name           = name ?? throw new ArgumentNullException(nameof(name));
     this.tripType       = tripType ?? throw new ArgumentNullException(nameof(tripType));
     this.personCategory = personCategory ?? throw new ArgumentNullException(nameof(personCategory));
     this.price          = price;
     this.route          = route ?? throw new ArgumentNullException(nameof(route));
 }
        public bool removeTripType(TripType tripType)
        {
            DAL.TripType entity = db.TripType.Where(v => v.id == tripType.id).FirstOrDefault();

            if (entity == null)
            {
                return(false);
            }

            // entity.boatToursManagerId = null;
            db.SaveChanges();
            return(this.tripTypes.Remove(tripType));
        }
        public GroupTrip(DAL.GroupTrip groupTrip)
        {
            this.id = groupTrip.id;

            this.route          = new Route(groupTrip.Route);
            this.depatureTime   = depatureTime;
            this.returnTime     = returnTime;
            this.personsOnBoard = personsOnBoard ?? throw new ArgumentNullException(nameof(personsOnBoard));
            this.tripType       = new TripType(groupTrip.TripType);
            this.ship           = new Ship(groupTrip.Ship);

            foreach (DAL.GroupTripPriceCategory gtpc in groupTrip.GroupTripPriceCategory)
            {
                this.personsOnBoard.Add(new PriceCategory(gtpc.PriceCategory), gtpc.quantity);
            }
        }
        public bool addTripType(TripType tripType)
        {
            if (this.tripTypes.Contains(tripType))
            {
                return(false);
            }

            DAL.TripType entity = db.TripType.Where(v => v.id == tripType.id).FirstOrDefault();

            if (entity == null && (entity = tripType.saveInDB()) == null)
            {
                return(false);
            }

            //entity.boatToursManagerId = this.id;
            db.SaveChanges();
            this.tripTypes.Add(tripType);
            return(true);
        }
 public ScheduledRoute(DAL.Route route, DAL.ScheduleRoute scheduledRoute) : base(route)
 {
     this.depatureTime = scheduledRoute.depatureTime;
     this.tripType     = new TripType(scheduledRoute.TripType);
 }
 public ScheduledRoute(LatLongCoordinate startPoint, LatLongCoordinate endPoint, decimal driveTimeMinutes,
                       DateTime depatureTime, TripType tripType) : base(startPoint, endPoint, driveTimeMinutes)
 {
     this.depatureTime = depatureTime;
     this.tripType     = tripType ?? throw new ArgumentNullException(nameof(tripType));
 }