Ejemplo n.º 1
0
        public static void AddNewListVehicle()
        {
            Vehicle vehicle = new Vehicle();

            ManagmentApp.ShowMessage("Enter Id");

            vehicle.Id = InputVerificationID.EnterIdVehicle();

            while (ShowVehicle.Vehicles.Exists(veh => veh.Id == vehicle.Id))
            {
                ManagmentApp.ShowMessage("Enter new ID");
                vehicle.Id = InputVerificationID.EnterIdVehicle();
            }

            ChoiseTypeAndBrand.TypeOfVehicles(vehicle);
            ShowVehicle.InformationVehicle(vehicle);

            ShowVehicle.Vehicles.Add(new Vehicle(vehicle.Id, vehicle.BrandVehicle, vehicle.TypeVehicle, vehicle.RentalPrice));
            EventLogWorking.message = $"Add new vehicle. Vehicle ID: {vehicle.Id}, " +
                                      $"brand vehicle: { vehicle.BrandVehicle}, " +
                                      $"renta price for vehicle: { vehicle.RentalPrice}$ per 10 minutes";
            vehicle.WriteToEventLog += EventLogWorking.InformationEventLog;
            vehicle.ShowMessage     += ShowVehicle.WriteToFile;
            vehicle.Message();
        }
Ejemplo n.º 2
0
        public static void ApplyCommand(int command)
        {
            switch ((Menu)command)
            {
            case Menu.AddVehicle:
                AddNewVehicle.AddNewListVehicle();
                break;

            case Menu.ChoiseVehicle:
                RentVehicle.ChoosingCarForRent();
                break;

            case Menu.ShowVehiclesPArking:
                ShowVehicle.ShowVehicleInParking();
                break;

            case Menu.RemoveVehicle:
                RemoveFromListVehicle.RemoveFromList();
                break;

            case Menu.Clear:
                Console.Clear();
                break;

            case Menu.Exit:
                RequestedExit = true;
                break;
            }
        }
        public static void ChoosingCarForRent()
        {
            ManagmentApp.ShowMessage("\nEnter ID vehicle do you want rent:");
            int Id      = InputVerificationID.NoVehiclesWithId();
            var vehicle = ShowVehicle.Vehicles.SingleOrDefault(r => r.Id == Id);

            ManagmentApp.ShowErrorMsg($"Your vehicle that you rented.");

            ShowVehicle.Vehicles.Remove(vehicle);

            ShowVehicle.InformationVehicle(vehicle);
            EventLogWorking.message  = $" You rented {vehicle.TypeVehicle}, brand: {vehicle.BrandVehicle}, price {vehicle.RentalPrice}$ per 10 minutes.";
            vehicle.WriteToEventLog += EventLogWorking.InformationEventLog;
            vehicle.Message();
        }