Exemple #1
0
        private object FindVehicleOnSystem(string registration)
        {
            IVehicleLogic  vehicleOperations = DummyProvider.GetInstance.GetVehicleOperations();
            List <Vehicle> vehicles          = vehicleOperations.GetVehicles();

            return(vehicles.Find(x => x.GetRegistration() == registration));
        }
Exemple #2
0
        private void CheckIfIsThereAnyVehicleInSystem()
        {
            IVehicleLogic vehicleOperations = Provider.GetInstance.GetVehicleOperations();
            var           vehicles          = vehicleOperations.GetVehicles();

            if (vehicles.Count() == 0)
            {
                this.labelError.Text    = "Currently there is not any subject in the system.";
                this.labelError.Visible = true;
            }
        }
Exemple #3
0
        public void ListVehicles()
        {
            IVehicleLogic vehicleOperations = DummyProvider.GetInstance.GetVehicleOperations();

            Vehicle vehicleOne   = new Vehicle("SBA1234", 10);
            Vehicle vehicleTwo   = new Vehicle("SBA5678", 15);
            Vehicle vehicleThree = new Vehicle("SBA9012", 20);

            vehicleOperations.AddVehicle(vehicleOne);
            vehicleOperations.AddVehicle(vehicleTwo);
            vehicleOperations.AddVehicle(vehicleThree);

            var vehicles = vehicleOperations.GetVehicles();

            Assert.IsTrue(vehicles.Count == 3);
        }
Exemple #4
0
 private void FillVehiclesComboBox()
 {
     try
     {
         IVehicleLogic vehicleOperations = Provider.GetInstance.GetVehicleOperations();
         var           vehicles          = vehicleOperations.GetVehicles();
         for (int index = 0; index < vehicles.Count; index++)
         {
             this.comboBoxSelectVehicleToModify.Items.Add(vehicles[index]);
         }
         this.comboBoxSelectVehicleToModify.DropDownStyle = ComboBoxStyle.DropDownList;
     }
     catch (CoreException ex)
     {
         this.labelError.Text    = ex.Message;
         this.labelError.Visible = true;
     }
 }
 private void FillListBoxAvailableVehicles()
 {
     try
     {
         IVehicleLogic vehicleOperations = Provider.GetInstance.GetVehicleOperations();
         var           availableVehicles = vehicleOperations.GetVehicles();
         for (int index = 0; index < availableVehicles.Count; index++)
         {
             this.listBoxAvailableVehicles.Items.Add(availableVehicles[index].GetFullToString());
         }
     }
     catch (CoreException ex)
     {
         this.labelError.Visible = true;
         this.labelError.Text    = ex.Message;
     }
     catch (Exception ex)
     {
         this.labelError.Visible = true;
         this.labelError.Text    = ex.Message;
     }
 }