private static void PrepareNewOrder(Clients klienci, Albums albumy, Instruments instrumenty, Accesories akcesoria, Orders zamowienia) { klienci.PrintClients(); Console.WriteLine("|==============================================|"); Console.WriteLine("|Czy klient jest zarejestrowany? |"); Console.WriteLine("|==============================================|"); Console.WriteLine("|1.Tak |"); Console.WriteLine("|2.nie |"); Console.WriteLine("|==============================================|"); int FirstChoice = Convert.ToInt32(Console.ReadLine()); List <string> nazwa = new List <string>(); List <double> ceny = new List <double>(); bool working = true; int SecondChoice = 0; switch (FirstChoice) { case 1: Console.WriteLine("|==============================================|"); Console.WriteLine("|Podaj Id klienta |"); Console.WriteLine("|==============================================|"); SecondChoice = Convert.ToInt32(Console.ReadLine()); break; case 2: Console.WriteLine("|==============================================|"); Console.WriteLine("|Tworzenie nowego klienta |"); Console.WriteLine("|==============================================|"); klienci.AddNewClient(GetClientFirstName(), GetClientLastName()); SecondChoice = klienci.GetCounter(); break; } do { Console.WriteLine("|==============================================|"); Console.WriteLine("|Jaką operację chcesz dokonać? |"); Console.WriteLine("|==============================================|"); Console.WriteLine("|1.Dodaj produkt do rachunku |"); Console.WriteLine("|2.Zakończ |"); Console.WriteLine("|==============================================|"); int action = Convert.ToInt32(Console.ReadLine()); switch (action) { case 1: Console.WriteLine("|==============================================|"); Console.WriteLine("|Z jakiej Kategorii chcesz dodać? |"); Console.WriteLine("|==============================================|"); Console.WriteLine("|1.Albumy |"); Console.WriteLine("|2.Instrumenty |"); Console.WriteLine("|3.Akcesoria |"); Console.WriteLine("|==============================================|"); int choice = Convert.ToInt32(Console.ReadLine()); int id = 0; switch (choice) { case 1: albumy.PrintAlbums(); Console.WriteLine("|==============================================|"); Console.WriteLine("|Podaj id Produktu |"); Console.WriteLine("|==============================================|"); id = Convert.ToInt32(Console.ReadLine()); nazwa.Add(albumy.GetAlbumString(id)); ceny.Add(albumy.GetAlbumPrice(id)); break; case 2: instrumenty.PrintInstruments(); Console.WriteLine("|==============================================|"); Console.WriteLine("|Podaj id Produktu |"); Console.WriteLine("|==============================================|"); id = Convert.ToInt32(Console.ReadLine()); nazwa.Add(instrumenty.GetInstrumentsString(id)); ceny.Add(instrumenty.GetInstrumentsPrice(id)); break; case 3: akcesoria.PrintAccesories(); Console.WriteLine("|==============================================|"); Console.WriteLine("|Podaj id Produktu |"); Console.WriteLine("|==============================================|"); id = Convert.ToInt32(Console.ReadLine()); nazwa.Add(akcesoria.GetAccesoriesString(id)); ceny.Add(akcesoria.GetAccesoriesPrice(id)); break; } break; case 2: zamowienia.AddNewOrder(SecondChoice, nazwa, ceny); working = false; break; } } while (working); }
private static void Main(string[] args) { #region Tworzenie Obiektów Clients Klienci = new Clients(); Klienci.AddNewClient("Mateusz", "Galos"); Klienci.AddNewClient("Mariusz", "Galos"); Klienci.AddNewClient("olgierd", "Galos"); Klienci.AddNewClient("ivan", "Galos"); Albums Albumy = new Albums(); Albumy.AddNewAlbums("After Hours", "The Weeknd"); Albumy.AddNewAlbums("To pimp a butterfly", "Kendric Lamar"); Albumy.AddNewAlbums("The Life Of Pablo", "Kanye West"); Albumy.AddNewAlbums("The Money Store", "Death Grips"); Instruments Instrumenty = new Instruments(); Instrumenty.AddNewInstruments("Gitara", "UKM-03945G", "Yamaha", 259.99); Instrumenty.AddNewInstruments("Gitara", "FAE-4332G", "Epiphone", 829.99); Instrumenty.AddNewInstruments("Gitara", "MEA-A4325", "Sterling", 3259.99); Instrumenty.AddNewInstruments("Keyboard", "FSEW-123", "Yamaha", 599.99); Instrumenty.AddNewInstruments("Perkusja", "TASFSA-12312", "Mapex", 1699.99); Accesories Akcesoria = new Accesories(); Akcesoria.AddNewAccesories("Pianka akustyczna", "Foamex", 99.99); Orders Zamowienia = new Orders(); Zamowienia.AddNewOrder(2, new List <string>() { "Gitara UKM-03945G Yamaha", "After Hours The Weeknd" }, new List <double> { 259.99, 29.99 });; #endregion do { PrintMainMenu(); int action = Convert.ToInt32(Console.ReadLine()); switch (action) { case 0: //Zamykanie Terminala Console.WriteLine("shutting down..."); Environment.Exit(0); break; case 1: Klienci.PrintClients(); break; case 2: Klienci.AddNewClient(GetClientFirstName(), GetClientLastName()); break; case 3: Zamowienia.PrintOders(); break; case 4: PrepareNewOrder(Klienci, Albumy, Instrumenty, Akcesoria, Zamowienia); break; case 5: AddNewProducts(Albumy, Instrumenty, Akcesoria); break; case 6: ShowProducts(Albumy, Instrumenty, Akcesoria); break; case 7: ModifyProducts(Albumy, Instrumenty, Akcesoria); break; case 8: RemoveProducts(Albumy, Instrumenty, Akcesoria); break; } } while (true); }