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(); }
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 BrandVehicles ChoiseBusBrandse(Vehicle vehicle) { ManagmentApp.ShowMessage("Choise brand bus: 1 - Ikarus, 2 - Iveco, 3 - MCV, 4 - Otokar"); int choiseBrand = ChoiseTypeAndBrand.ChoiseType(); switch (choiseBrand) { case 1: vehicle.BrandVehicle = BrandVehicles.Ikarus; vehicle.RentalPrice = DataRentalPrice.IkarusRentalPrice; break; case 2: vehicle.BrandVehicle = BrandVehicles.Iveco; vehicle.RentalPrice = DataRentalPrice.IvecoRentalPrice; break; case 3: vehicle.BrandVehicle = BrandVehicles.MCV; vehicle.RentalPrice = DataRentalPrice.MCVRentalPrice; break; case 4: vehicle.BrandVehicle = BrandVehicles.Otokar; vehicle.RentalPrice = DataRentalPrice.OtokarRentalPrice; break; } while (vehicle.BrandVehicle == 0) { ChoiseBusBrandse(vehicle); } return(vehicle.BrandVehicle); }
public static BrandVehicles ChoiseMotorcycleBrandse(Vehicle vehicle) { ManagmentApp.ShowMessage("Choise brand motorcycle : 1 - BMW, 2 - Yamaha, 3 - Kawasaki, 4 - Ducati"); int choiseBrand = ChoiseTypeAndBrand.ChoiseType(); switch (choiseBrand) { case 1: vehicle.BrandVehicle = BrandVehicles.BMW; vehicle.RentalPrice = DataRentalPrice.BMWRentalPrice; break; case 2: vehicle.BrandVehicle = BrandVehicles.Yamaha; vehicle.RentalPrice = DataRentalPrice.YamahaRentalPrice; break; case 3: vehicle.BrandVehicle = BrandVehicles.Kawasaki; vehicle.RentalPrice = DataRentalPrice.KawasakiRentalPrice; break; case 4: vehicle.BrandVehicle = BrandVehicles.Ducati; vehicle.RentalPrice = DataRentalPrice.DucatiRentalPrice; break; } while (vehicle.BrandVehicle == 0) { ChoiseMotorcycleBrandse(vehicle); } return(vehicle.BrandVehicle); }
public static BrandVehicles ChoiseTruckBrandse(Vehicle vehicle) { ManagmentApp.ShowMessage("Choise brand truck : 1 - Otokar, 2 - Ural, 3 - MAZ, 4 - Magirus"); int choiseBrand = ChoiseTypeAndBrand.ChoiseType(); switch (choiseBrand) { case 1: vehicle.BrandVehicle = BrandVehicles.Otokar; vehicle.RentalPrice = DataRentalPrice.OtokarRentalPrice; break; case 2: vehicle.BrandVehicle = BrandVehicles.Ural; vehicle.RentalPrice = DataRentalPrice.UralRentalPrice; break; case 3: vehicle.BrandVehicle = BrandVehicles.MAZ; vehicle.RentalPrice = DataRentalPrice.MAZRentalPrice; break; case 4: vehicle.BrandVehicle = BrandVehicles.Magirus; vehicle.RentalPrice = DataRentalPrice.MagirusRentalPrice; break; } while (vehicle.BrandVehicle == 0) { ChoiseTruckBrandse(vehicle); } return(vehicle.BrandVehicle); }
public static TypeVichle TypeOfVehicles(Vehicle vehicle) { ManagmentApp.ShowMessage("Choise type vehicle: 1 - Motorcecles, 2 - PassengerCars, 3 - Buses, 4 - Trucks"); int typeCar = ChoiseType(); switch (typeCar) { case 1: vehicle.TypeVehicle = TypeVichle.Motorcecles; Motorcecles.ChoiseMotorcycleBrandse(vehicle); break; case 2: vehicle.TypeVehicle = TypeVichle.PassengerCars; PassengerCars.ChoiseCarMake(vehicle); break; case 3: vehicle.TypeVehicle = TypeVichle.Buses; Buses.ChoiseBusBrandse(vehicle); break; case 4: vehicle.TypeVehicle = TypeVichle.Trucks; Trucks.ChoiseTruckBrandse(vehicle); break; } while (vehicle.TypeVehicle == 0) { TypeOfVehicles(vehicle); } return(vehicle.TypeVehicle); }
public static void InformationVehicle(Vehicle vehicle) { ManagmentApp.ShowMessage( $"Vehicle ID: {vehicle.Id}", $"Type car: {vehicle.TypeVehicle}", $"Brand {vehicle.TypeVehicle}: {vehicle.BrandVehicle}", $"Renta price {vehicle.BrandVehicle}: {vehicle.RentalPrice}$ per 10 minutes"); }
public static int NoVehiclesWithId() { int Id = EnterIdVehicle(); while (!ShowVehicle.Vehicles.Exists(x => x.Id == Id)) { ManagmentApp.ShowErrorMsg("Enter correct ID"); Id = EnterIdVehicle(); } return(Id); }
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(); }
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(); } }
public static BrandVehicles ChoiseCarMake(Vehicle vehicle) { ManagmentApp.ShowMessage("Choise brand car: 1 - Audi, 2 - Cadillac, 3 - Honda, 4 - Nissan, 5 - Peugeot"); int choiseBrand = ChoiseTypeAndBrand.ChoiseType(); switch (choiseBrand) { case 1: vehicle.BrandVehicle = BrandVehicles.Audi; vehicle.RentalPrice = DataRentalPrice.AudiRentalPrice; break; case 2: vehicle.BrandVehicle = BrandVehicles.Cadillac; vehicle.RentalPrice = DataRentalPrice.CadillacRentalPrice; break; case 3: vehicle.BrandVehicle = BrandVehicles.Honda; vehicle.RentalPrice = DataRentalPrice.HondaRentalPrice; break; case 4: vehicle.BrandVehicle = BrandVehicles.Nissan; vehicle.RentalPrice = DataRentalPrice.NissanRentalPrice; break; case 5: vehicle.BrandVehicle = BrandVehicles.Peugeot; vehicle.RentalPrice = DataRentalPrice.PeugeotRentalPrice; break; } while (vehicle.BrandVehicle == 0) { ChoiseCarMake(vehicle); } return(vehicle.BrandVehicle); }
public static void Main() { ListVehicleOnParking.AddPassengerCars(); ManagmentApp.RunApplication(); }