Ejemplo n.º 1
0
 public Route(string id, float durationInDays, Location one, Location two, Moveable move)
 {
     locations = new Location[] { one, two };
     Id = id;
     DurationInDays = durationInDays;
     CurrentMoveable = move;
 }
        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 bool addRoute(String id, float duration, Location one, Location two, Moveable move)
 {
     Route r = new Route(id, duration, one, two, move);
     if (routes.Contains(r))
         return false;
     move.assignRoute(r);
     routes.Add(r);
     move.changeLocation();
     foreach (Location rLocation in r.Locations)
     {
         if (rLocation is StoreFront)
             (rLocation as StoreFront).addRoute(r);
         else if (rLocation is Warehouse)
             (rLocation as Warehouse).addRoute(r);
     }
     return true;
 }
Ejemplo n.º 5
0
        private void moveableEditButton_Click(object sender, EventArgs e)
        {
            moveableTypeComboBox.Enabled = false;
            moveableAddButton.Text = SAVE;
            addMoveable = false;

            currentMoveable = moveablesListBox.SelectedItem as Moveable;
            moveablesListBox.ClearSelected();

            moveableIdTextBox.Text = currentMoveable.Id;
            moveableVolumeTextBox.Text = currentMoveable.VolumeCapacity + "";
            moveableWeightTextBox.Text = currentMoveable.WeightCapacity + "";

            moveableTransportTypeComboBox.Enabled = moveableTemperatureCheckBox.Enabled = currentMoveable is Transport;

            if (moveableTransportTypeComboBox.Enabled)
            {
                Transport t = currentMoveable as Transport;

                moveableTransportTypeComboBox.SelectedIndex = (int)t.TransportType;
                moveableTemperatureCheckBox.Checked = t.TempControlled;
            }
        }