Example #1
0
        public void ChangeInGargeStateOfVehicle(string i_VehicleLicenseNumber, string i_NewInGargeStateOfVehicle)
        {
            GarageVehicle ownerVehicle = GetGarageVehicleByLicenseNumber(i_VehicleLicenseNumber);

            try
            {
                GarageVehicle.eVehicleState newVehicleState = (GarageVehicle.eVehicleState)Enum.Parse(typeof(GarageVehicle.eVehicleState), i_NewInGargeStateOfVehicle);
                ownerVehicle.VehicleState = newVehicleState;
            }
            catch (OverflowException ex)
            {
                throw new FormatException(k_WrongVehicleStateMessege, ex.InnerException);
            }
        }
Example #2
0
 private void showVehiclesAccordingToState(string i_InGargeStateOfVehicleToFilterWith, StringBuilder i_ListOfVehiclesInGarage)
 {
     try
     {
         GarageVehicle.eVehicleState filterVehicleState = (GarageVehicle.eVehicleState)Enum.Parse(typeof(GarageVehicle.eVehicleState), i_InGargeStateOfVehicleToFilterWith);
         foreach (string key in m_VehiclesInGarage.Keys)
         {
             GarageVehicle currentVehicle = m_VehiclesInGarage[key];
             if (currentVehicle.VehicleState == filterVehicleState)
             {
                 i_ListOfVehiclesInGarage.AppendLine(currentVehicle.OwnerVehicle.LicenceNumber);
             }
         }
     }
     catch (OverflowException ex)
     {
         throw new FormatException(k_WrongVehicleStateMessege, ex.InnerException);
     }
     catch (ArgumentException ex)
     {
         throw new FormatException(k_WrongVehicleStateMessege, ex.InnerException);
     }
 }