private static void ShoppingMenu(Lists lists, Economy economy, Economic.BuyingSellingMethods buySell) { bool shoppingMenuLoop = true; while (shoppingMenuLoop) { Console.Clear(); Console.WriteLine("Bildatabasen"); Console.WriteLine("Vad vill du göra"); Console.WriteLine("1. Köpa fordon"); Console.WriteLine("2. Sälja fordon"); Console.WriteLine("3. Gå tillbaka till huvudmenyn"); Console.WriteLine("---"); Console.WriteLine("Just nu {0} fordon i lager.", lists.TotalStock.Count()); Console.WriteLine("Ekonomisk situation: {0}", economy.TotalAmountOfCash); var input = Console.ReadKey(true).Key; switch (input) { case ConsoleKey.D1: case ConsoleKey.NumPad1: buySell.CarBuyer(economy, lists); break; case ConsoleKey.D2: case ConsoleKey.NumPad2: buySell.CarSeller(economy, lists); break; case ConsoleKey.D3: case ConsoleKey.NumPad3: shoppingMenuLoop = false; break; default: Console.WriteLine("Du kan enbart använda 1, 2 eller 3."); Console.WriteLine("(Tryck enter för att återgå och försöka igen)"); Console.ReadLine(); break; } } }
private static void AddCarMenu(Lists lists, Economy economy) { bool addCarMenuLoop = true; while (addCarMenuLoop) { Console.Clear(); Console.WriteLine("Bildatabasen"); lists.SimplePresentation(); Console.WriteLine("---"); Console.WriteLine("Finns bilen redan i databasen?"); Console.WriteLine("J - Lägg till i saldo"); Console.WriteLine("N - Lägg till nytt fordon."); Console.WriteLine("A - Avbryt."); var input = Console.ReadKey(true).Key; switch (input) { case ConsoleKey.J: lists.ListAddToExistingVehicle(); break; case ConsoleKey.N: lists.ListAddNewVehicle(lists, economy); break; case ConsoleKey.A: addCarMenuLoop = false; break; default: Console.WriteLine("Du kan enbart använda J, N eller A."); Console.WriteLine("(Tryck enter för att återgå och försöka igen)"); Console.ReadLine(); break; } } }
private void AddingAnotherVehicleFinalStep(Lists lists, Economy economy) { Console.Clear(); if (newVehicleUsedOrNew == "Begagnad") { Console.WriteLine("Begagnat fordon"); } else { Console.WriteLine("Nytt fordon"); } Console.WriteLine("---"); Console.Write("{0}ns tillverkare: ", newVehicleCarorMotorcycle); string newVehicleManufacturer = Console.ReadLine(); Console.Write("{0}ns modell: ", newVehicleCarorMotorcycle); string newVehicleModel = Console.ReadLine(); Console.Write("{0}ns pris: ", newVehicleCarorMotorcycle); int newVehiclePrice = int.Parse(Console.ReadLine()); Console.Write("{0}ns tillverkningsår: ", newVehicleCarorMotorcycle); int newVehicleManufacturedYear = int.Parse(Console.ReadLine()); Console.Write("Antal fordon att lägga till av modellen: "); int newVehicleAmount = int.Parse(Console.ReadLine()); if (newVehicleUsedOrNew == "Begagnad") { Console.Write("Antal tidigare ägare: "); int newVehiclePreviousOwners = int.Parse(Console.ReadLine()); if (newVehicleCarorMotorcycle == "Bile") { Console.WriteLine("Lagrar följande: {0} {1}. {2} kronor. {3} tidigare ägare från {4}. {5} stycken till lagret.", newVehicleManufacturer, newVehicleModel, newVehiclePrice, newVehiclePreviousOwners, newVehicleManufacturedYear, newVehicleAmount); UsedVehicle.Add(new UsedCar((newVehiclePrice + economy.RandomizedCreatedCarPrice()), newVehicleManufacturedYear, newVehicleManufacturer, newVehicleModel, newVehiclePreviousOwners, newVehicleAmount)); ForSaleUsedVehicle.Add(new ForSaleUsedCar((newVehiclePrice + economy.RandomizedCreatedCarPrice()), newVehicleManufacturedYear, newVehicleManufacturer, newVehicleModel, newVehiclePreviousOwners, 1000)); } else if (newVehicleCarorMotorcycle == "Motorcykel") { Console.WriteLine("Lagrar följande: {0} {1}. {2} kronor. {3} tidigare ägare från {4}. {5} stycken till lagret.", newVehicleManufacturer, newVehicleModel, newVehiclePrice, newVehiclePreviousOwners, newVehicleManufacturedYear, newVehicleAmount); UsedVehicle.Add(new UsedMotorCycle((newVehiclePrice + economy.RandomizedCreatedCarPrice()), newVehicleManufacturedYear, newVehicleManufacturer, newVehicleModel, newVehiclePreviousOwners, newVehicleAmount)); ForSaleUsedVehicle.Add(new ForSaleUsedMotorCycle((newVehiclePrice + economy.RandomizedCreatedCarPrice()), newVehicleManufacturedYear, newVehicleManufacturer, newVehicleModel, newVehiclePreviousOwners, 1000)); } } else if (newVehicleUsedOrNew == "Ny") { Console.Write("Garantiperiod: "); int newVehicleWarrantyPeriod = int.Parse(Console.ReadLine()); if (newVehicleCarorMotorcycle == "Bile") { Console.WriteLine("Lagrar följande: {0} {1}. {2} kronor. {3} års garanti. Tillverkad {4}. {5} stycken till lagret.", newVehicleManufacturer, newVehicleModel, newVehiclePrice, newVehicleWarrantyPeriod, newVehicleManufacturedYear, newVehicleAmount); NewVehicle.Add(new Car((newVehiclePrice + economy.RandomizedCreatedCarPrice()), newVehicleManufacturedYear, newVehicleManufacturer, newVehicleModel, newVehicleWarrantyPeriod, newVehicleAmount)); ForSaleNewVehicle.Add(new ForSaleCar((newVehiclePrice + economy.RandomizedCreatedCarPrice()), newVehicleManufacturedYear, newVehicleManufacturer, newVehicleModel, newVehicleWarrantyPeriod, 1000)); } else if (newVehicleCarorMotorcycle == "Motorcykel") { Console.WriteLine("Lagrar följande: {0} {1}. {2} kronor. {3} års garanti. Tillverkad {4}. {5} stycken till lagret.", newVehicleManufacturer, newVehicleModel, newVehiclePrice, newVehicleWarrantyPeriod, newVehicleManufacturedYear, newVehicleAmount); NewVehicle.Add(new Motorcycle((newVehiclePrice + economy.RandomizedCreatedCarPrice()), newVehicleManufacturedYear, newVehicleManufacturer, newVehicleModel, newVehicleWarrantyPeriod, newVehicleAmount)); ForSaleNewVehicle.Add(new ForSaleMotorcycle((newVehiclePrice + economy.RandomizedCreatedCarPrice()), newVehicleManufacturedYear, newVehicleManufacturer, newVehicleModel, newVehicleWarrantyPeriod, 1000)); } } listAddAnotherVehicleLoop = false; listAddNewVehicle = false; ListUpdater(); Console.WriteLine("(Tryck Enter för att återgå till menysystemet)"); Console.ReadLine(); }