public DeliveryForm(Form parent, ShippingSystem sm, Package p)
 {
     InitializeComponent();
     parentForm = parent as DeliverPackageForm;
     shippingSystem = sm;
     package = p;
     recepientNameTextBox.Text = p.Destination.Addressee;
     streetAddressTextBox.Text = p.Destination.StreetAddress;
 }
Beispiel #2
0
        public bool addPackage(Package package)
        {
            if (VolumeAvailable < package.Volume)
                return false;

            packages.Add(package);
            currentVolume += (int)package.Volume;
            return true;
        }
Beispiel #3
0
 public void removePackage(Package package)
 {
     if (packages.Contains(package))
     {
         packages.Remove(package);
         currentWeight -= package.Weight;
         currentVolume -= (int)package.Volume;
     }
 }
Beispiel #4
0
 public bool addPackage(Package package)
 {
     if (packages.Contains(package))
         return false;
     if (VolumeAvailable < package.Volume || WeightAvailable < package.Weight)
         return false;
     packages.Add(package);
     currentWeight += package.Weight;
     currentVolume += (int)package.Volume;
     return true;
 }
Beispiel #5
0
 public bool hasPackage(Package p)
 {
     return -1 != packages.IndexOf(p);
 }
Beispiel #6
0
 public void removePackage(Package package)
 {
     packages.Remove(package);
     currentVolume -= (int)package.Volume;
 }
        public Location nextLocation(Package p)
        {
            int index;
            int start = locations.IndexOf(p.CurrentLocation);
            int end = locations.IndexOf(p.DestinationLocation);

            if (p.MailService == Package.SERVICE_TYPE.Air)
            {
                index = airPathMatrix[start, end];
                if (index == -1)
                    return Locations[end];
                return Locations[index];
            }
            index = groundPathMatrix[start, end];
            if (index == -1)
                return Locations[end];
            return Locations[index];
        }
        public bool movePackageToWarehouse(Moveable moveable, Warehouse warehouse, Package package)
        {
            if (!warehouse.addPackage(package))
                return false;

            package.takeSnapshot("Arrived at", warehouse);
            moveable.removePackage(package);
            package.CurrentLocation = warehouse;
            return true;
        }
        public bool movePackageToMoveable(Location location, Moveable moveable, Package package)
        {
            if (!moveable.addPackage(package))
                return false;

            StoreFront sf = location as StoreFront;

            if (sf == null)
            {
                (location as Warehouse).removePackage(package);
            }
            else
            {
                sf.removePackage(package);
            }
            package.takeSnapshot("Left from", location);
            return true;
        }
 public void deliverPackage(Package p)
 {
     DeliveryEmployee em = loggedInEmployee as DeliveryEmployee;
     p.Delivered = true;
     em.CurrentRoute.CurrentMoveable.removePackage(p);
 }
        public Package addPackage(int weight, float[] size, Package.SERVICE_TYPE mailService, bool fragile, bool irregular, bool perishable, Address source, Address destination)
        {
            Location destinationLocation = determineAbroad(destination.Zip);
            if (destinationLocation == null)
                return null;

            StoreFront sf = (LoggedInEmployee as AcceptanceEmployee).CurrentStoreFront;
            int travelTime = (mailService == Package.SERVICE_TYPE.Economy) ? determineGroundTravelTime(sf, destinationLocation) : determineAirTravelTime(sf, destinationLocation);

            Package p = new Package(weight, size, mailService, fragile, irregular, perishable, source, destination, sf, destinationLocation, travelTime);
            sf.addPackage(p);
            packages.Add(p);
            p.takeSnapshot("Package Accepted", sf);
            return p;
        }
 public void removePackage(Package package)
 {
     packages.Remove(package);
 }
 public void addPackage(Package package)
 {
     packages.Add(package);
 }