示例#1
0
        public static int RemoveFromList()
        {
            ManagmentApp.ShowErrorMsg("Enter please ID vehicle that do you dismiss");
            int id = InputVerificationID.NoVehiclesWithId();

            var vehicle = ShowVehicle.Vehicles.SingleOrDefault(r => r.Id == id);

            if (vehicle != null)
            {
                ManagmentApp.ShowErrorMsg($"Vehicle delete with ID: {vehicle.Id}, Car make: {vehicle.BrandVehicle}, Type car: {vehicle.TypeVehicle}.");

                ShowVehicle.Vehicles.Remove(vehicle);

                EventLogWorking.message = $"You remove from parking list. Vehicle ID: {vehicle.Id}, " +
                                          $"brand vehicle: { vehicle.BrandVehicle}, " +
                                          $"renta price for vehicle: { vehicle.RentalPrice}$ per 10 minutes";

                vehicle.WriteToEventLog += EventLogWorking.InformationEventLog;
                vehicle.Message();
                return(id);
            }
            else
            {
                return(0);
            }
        }
        public static int NoVehiclesWithId()
        {
            int Id = EnterIdVehicle();

            while (!ShowVehicle.Vehicles.Exists(x => x.Id == Id))
            {
                ManagmentApp.ShowErrorMsg("Enter correct ID");
                Id = EnterIdVehicle();
            }
            return(Id);
        }
示例#3
0
        public static void ShowVehicleInformation()
        {
            int i = 1;
            var sortedVehichle = from empl in Vehicles
                                 orderby empl.Id
                                 select empl;

            foreach (Vehicle vehicle in sortedVehichle)
            {
                ManagmentApp.ShowErrorMsg($"********* Vehicle:  {vehicle.BrandVehicle}   *********");
                InformationVehicle(vehicle);
                i++;
            }
        }
        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();
        }
示例#5
0
        public static void ShowVehicleInParking()
        {
            var sortedVehicle = from vehicle in Vehicles
                                orderby vehicle.Id
                                select vehicle;

            foreach (Vehicle vehicle in sortedVehicle)
            {
                ManagmentApp.ShowErrorMsg($"ID: {vehicle.Id} // Type vehicle: {vehicle.TypeVehicle} // " +
                                          $"Brand vehicle: {vehicle.BrandVehicle} // Rental price: {vehicle.RentalPrice}$");

                EventLogWorking.message = $" Vehicle ID: {vehicle.Id}, brand vehicle: { vehicle.BrandVehicle}, " +
                                          $"renta price for vehicle: { vehicle.RentalPrice}$ per 10 minutes";

                vehicle.ShowMessage += EventLogWorking.InformationEventLog;
                vehicle.Message();
            }
        }