static void showStock() { foreach (ProductInfo p in MP3.GetPlayers()) { Console.WriteLine("MP3 Player " + p.intId + ""); Console.WriteLine("Stock: " + p.intStock + "\n"); } ShowMenu(); }
static void showProducts() { foreach (ProductInfo p in MP3.GetPlayers()) { Console.WriteLine("MP3 Player " + p.intId + "\n"); Console.WriteLine("Make:\t\t" + p.strMake); Console.WriteLine("Model:\t\t" + p.strModel); Console.WriteLine("Size(Mb):\t" + p.dblSize); Console.WriteLine("Price:\t\t$" + p.dblPrice + "\n"); } ShowMenu(); }
static void Mp3Add() { Console.WriteLine("Enter a new Mp3 player"); foreach (ProductInfo p in MP3.GetPlayers()) { Console.WriteLine("Make: "); string make = Console.ReadLine(); Console.WriteLine("Model: "); string model = Console.ReadLine(); Console.WriteLine("Mb Size: "); double size = double.Parse(Console.ReadLine()); Console.WriteLine("Price: "); double price = double.Parse(Console.ReadLine()); int id = MP3.Product.Count + 1; MP3.Product.Add(new ProductInfo(id, make, model, size, price)); ShowMenu(); } }
static void NewStock() { Console.WriteLine("Vul het ID in van de MP3 speler: "); string mutateID = Console.ReadLine(); if (string.IsNullOrEmpty(mutateID) || !mutateID.All(char.IsDigit)) { Console.WriteLine("Wrong ID input!"); NewStock(); } else { int intMutateID = int.Parse(mutateID); foreach (ProductInfo p in MP3.GetPlayers()) { if (intMutateID == p.intId) { Console.WriteLine("Vul nieuwe stock waarde in:"); string strStock = Console.ReadLine(); int intNewStock = int.Parse(strStock); if (strStock == string.Empty) { Console.WriteLine("You didn't enter anything"); } else if (!strStock.All(char.IsDigit)) { Console.WriteLine("You entered an invalid new stock!"); } else { p.Storage = intNewStock; Console.WriteLine("You have succesfully updated the stock for MP3 player {0} to {1}", p.intId, p.intStock); ShowMenu(); } } } } ShowMenu(); }