示例#1
0
 public void UnPark(Vehical vehical)
 {
     if (vehical != null && vehical.slot != null)
     {
         var space = GetSpace(vehical.slot.parkingSpaceId);
         space.UnPark(vehical.licenseNumber);
         Console.WriteLine("Unparked from " + space.Id + "-" + vehical.slot.size + "" + vehical.slot.slotId);
     }
 }
示例#2
0
        public void Park(Vehical vehical)
        {
            var space = TryPark(vehical);

            if (space != null)
            {
                Console.WriteLine("Vehical Parked at " + space.Id + "-" + vehical.slot.size + "" + vehical.slot.slotId);
            }
        }
示例#3
0
        private void ParkVehical(Vehical vehical)
        {
            var slot = GetFreeSlot(vehical.size);

            slot.Park(vehical);
            vehical.Park(slot);

            AddToLicenseMaped(vehical.licenseNumber, slot);
            AddToColorMaped(vehical.color, slot);
        }
示例#4
0
        private ParkingSpace TryPark(Vehical vehical)
        {
            foreach (var space in parkingSpaces.Values)
            {
                if (space.Park(vehical))
                {
                    return(space);
                }
            }

            return(null);
        }
示例#5
0
        public bool Park(Vehical vehical)
        {
            try
            {
                if (!IsFull(vehical.size))
                {
                    ParkVehical(vehical);
                    return(true);
                }
            }
            catch (ParkingException ex) { System.Console.WriteLine(ex.Message); }

            return(false);
        }