Пример #1
0
        static void Main(string[] args)
        {
            WineListCollection[] wineListItems = new WineListCollection[100];
//Grabbing the user input and converting it to a string to be used later.
            int    decision = wineListUI.GetUserInput();
            string invoke   = decision.ToString();

            while (invoke != "2")
            {
                if (invoke == "1")
                {
                    string ListOutput = "";

                    foreach (WineListCollection itemlist in wineListItems)
                    {
                        //Theoretically supposed to grab select fields from the CSV provided to allow the list to appear.
                        if (itemlist != null)
                        {
                            Console.WriteLine(ListOutput = itemlist.Id + " " + itemlist.Name + " " + itemlist.Cost);
                            Console.WriteLine(ListOutput);
                        }
                    }
                }
                else
                {
                    //This is to close the program down.
                    if (invoke == "2")
                    {
                        Console.WriteLine("Goodbye");
                        Console.WriteLine();
                    }
                }
            }
            ImportCSV("WineList.csv", wineListItems);
        }
Пример #2
0
//Item is built to display id, name and cost.
        static void itemProcesses(string readItem, WineListCollection[] wineListItems, int index)
        {
            string[] split = readItem.Split(',');
            string   id    = split[0];
            string   name  = split[1];
            int      cost  = Int32.Parse(split[2]);

            wineListItems[index] = new WineListCollection(id, name, cost);
        }