コード例 #1
0
        public ProductManagement(MyLists currentList)
        {
            currentList.Products.Add(new Computers
            {
                Manufacturer       = "Microsoft",
                ModelName          = "Surface Pro 5",
                Price              = 14999,
                Bought             = false,
                ProductInformation = "The computer that can replace your tablet, desktop and laptop."
            });

            currentList.Products.Add(new CellPhones
            {
                Manufacturer       = "Microsoft",
                ModelName          = "Surface Phone Pro",
                Price              = 7999,
                Bought             = false,
                ProductInformation = "The phone that can replace your Surface Pro."
            });

            currentList.Products.Add(new Hifi
            {
                Manufacturer       = "Sonos",
                ModelName          = "Soundbar",
                Price              = 3699,
                Bought             = false,
                ProductInformation = "Big sound in a small package."
            });
        }
コード例 #2
0
        internal void EditShoppingCart(MyLists currentList)
        {
            bool shoppingCartLoop = true;

            while (shoppingCartLoop)
            {
                Console.Clear();
                ShowCurrentWares(currentList);
                Console.WriteLine();
                Console.WriteLine("Which product would you like to add to the cart?");
                Console.WriteLine("Type 0 to check current cart.");
                int input = int.Parse(Console.ReadLine());
                input--;

                if (input == -1)
                {
                    ShowCurrentShoppingCart(currentList);
                }
                else if (input > currentList.Products.Count())
                {
                    Console.WriteLine("That product does not exist, try again.");
                    Console.ReadLine();
                }
                else
                {
                    Console.WriteLine("That product exists");
                    currentList.Products[input].Bought = true;
                    shoppingCartLoop = false;
                    Console.ReadLine();
                }
            }
        }
コード例 #3
0
        internal void RemoveWare(MyLists currentList)
        {
            Console.WriteLine("Which ware would you like to remove?");
            int input = int.Parse(Console.ReadLine());

            currentList.Products.RemoveAt(input - 1);
        }
コード例 #4
0
        internal void Start()
        {
            var userInterface     = new UserInterfaces();
            var currentList       = new MyLists();
            var productManagement = new ProductManagement(currentList);

            while (true)
            {
                userInterface.MainMenu(productManagement, currentList);
            }
        }
コード例 #5
0
        internal void Start()
        {
            MyLists myLists = new MyLists();

            while (true)
            {
                Console.Clear();
                Console.Write("Search for author: ");
                string input = Console.ReadLine();

                var searchResultsInBooks     = myLists.Books.Where(author => author.Author.Name == input);
                var searchResultsInPapers    = myLists.Papers.Where(author => author.Author.Name == input);
                var searchResultsInMagazines = myLists.Magazines.Where(author => author.Author.Name == input);

                Console.WriteLine("\nBooks by {0}", input);
                foreach (var item in searchResultsInBooks)
                {
                    Console.Write("{0} - {1} pages. {2}. Released: ", item.Title, item.Pages, item.Genre);
                    Console.Write(String.Format("{0:yyyy/MM/dd} ", item.ReleaseDate));
                    Console.WriteLine("by {0}", item.Author.Name);
                }
                if (!searchResultsInBooks.Any())
                {
                    Console.WriteLine("No results for {0} in Books.", input);
                }


                Console.WriteLine("\nPapers by {0}", input);
                foreach (var item in searchResultsInPapers)
                {
                    Console.Write("{0} - Released: ", item.Title);
                    Console.Write(String.Format("{0:yyyy/MM/dd} ", item.ReleaseDate));
                    Console.WriteLine("by {0}", item.Author.Name);
                }
                if (!searchResultsInPapers.Any())
                {
                    Console.WriteLine("No results for {0} in Papers.", input);
                }

                Console.WriteLine("\nMagazines by {0}", input);
                foreach (var item in searchResultsInMagazines)
                {
                    Console.Write("{0} - Released: ", item.Title);
                    Console.Write(String.Format("{0:yyyy/MM/dd} ", item.ReleaseDate));
                    Console.WriteLine("by {0}", item.Author.Name);
                }
                if (!searchResultsInMagazines.Any())
                {
                    Console.WriteLine("No results for {0} in Magazines.", input);
                }
                Console.ReadLine();
            }
        }
コード例 #6
0
        internal void ShowCurrentWares(MyLists currentList)
        {
            int i = 0;

            Console.WriteLine("---");
            foreach (var product in currentList.Products)
            {
                Console.WriteLine("{3}. {0} {1} - {2}", product.Manufacturer, product.ModelName, product.ProductInformation, i + 1);
                Console.WriteLine("{0} SEK.", product.Price);
                i++;
            }
            Console.WriteLine("---");
        }
コード例 #7
0
ファイル: StartUp.cs プロジェクト: skorae/SoftUni-kdinev
        static void Main(string[] args)
        {
            string[] arr = Console.ReadLine().Split();
            int      n   = int.Parse(Console.ReadLine());

            AddCollections      collection = new AddCollections();
            AddRemoveCollection addRemove  = new AddRemoveCollection();
            MyLists             myList     = new MyLists();

            collection.Add(arr);
            addRemove.Add(arr);
            myList.Add(arr);
            addRemove.Remove(n);
            myList.Remove(n);
        }
コード例 #8
0
    void Start()
    {
        Word           = Resources.Load("Button");
        myLists        = new MyLists();
        wordsOrPhrases = new WordsOrPhrases();

        numTwo   = new string[myLists.scoreTwo.Count];
        numOne   = new string[myLists.scoreOne.Count];
        numThree = new string[myLists.scoreThree.Count];
        numFour  = new string[myLists.scoreFour.Count];
        numFive  = new string[myLists.scoreFive.Count];

        //Debug.Log("numOne = " + numOne.Length);
        //Debug.Log("numTwo = " + numTwo.Length);
        //Debug.Log("numThree = " + numThree.Length);
        //Debug.Log("numFour = " + numFour.Length);
        //Debug.Log("numFive = " + numFive.Length);
    }
コード例 #9
0
        private void ShowCurrentShoppingCart(MyLists currentList)
        {
            Console.Clear();
            int i           = 0;
            int boughtValue = 0;

            Console.WriteLine("---");
            foreach (var product in currentList.Products)
            {
                if (product.Bought == true)
                {
                    Console.WriteLine("{3}. {0} {1} - {2}", product.Manufacturer, product.ModelName, product.ProductInformation, i + 1);
                    boughtValue = boughtValue + product.Price;
                    i++;
                }
            }
            Console.WriteLine("---");
            Console.WriteLine("Current cart value is {0} SEK", boughtValue);
            Console.WriteLine("---");

            /*Console.WriteLine("Would you like to remove something (y/n)");
             * string inputYesNo = Console.ReadLine().ToLower();
             *
             * if (inputYesNo == "y")
             * {
             *  Console.WriteLine("Which item would you like to remove?");
             *  int inputWhatToRemove = int.Parse(Console.ReadLine());
             *
             *  foreach (var product in currentList.Products)
             *  {
             *      currentList.Products[inputWhatToRemove -1].Bought = false;
             *      boughtValue = boughtValue - currentList.Products[inputWhatToRemove -1].Price;
             *  }
             *
             *  //currentList.Products[inputWhatToRemove].Bought = false;
             *  //boughtValue = boughtValue - currentList.Products[inputWhatToRemove].Price;
             *  Console.WriteLine("Done.");
             *  Console.ReadLine();
             *
             *
             * }*/
        }
コード例 #10
0
        internal void AddWare(MyLists currentList)
        {
            Console.WriteLine("What type of product do you want to add?");
            Console.WriteLine("1. Computer");
            Console.WriteLine("2. Cellphone");
            Console.WriteLine("3. Hifi");
            Console.WriteLine("4. Return to main menu.");

            var input = Console.ReadKey(true).Key;

            bool addWareLoop = true;

            while (addWareLoop)
            {
                switch (input)
                {
                case ConsoleKey.D1:
                    AddWareStepTwo(1, currentList);
                    addWareLoop = false;
                    break;

                case ConsoleKey.D2:
                    AddWareStepTwo(2, currentList);
                    addWareLoop = false;
                    break;

                case ConsoleKey.D3:
                    AddWareStepTwo(3, currentList);
                    addWareLoop = false;
                    break;

                case ConsoleKey.D4:
                    addWareLoop = false;
                    break;

                default:
                    Console.WriteLine("Not a valid choice. Try again.");
                    break;
                }
            }
        }
コード例 #11
0
        private void AddWareStepTwo(int addType, MyLists currentList)
        {
            AddWareInformationGathering();

            if (addType == 1)
            {
                currentList.Products.Add(new Computers
                {
                    Manufacturer       = NewManufacturer,
                    ModelName          = NewModel,
                    Price              = NewPrice,
                    ProductInformation = NewProductDescription,
                    Bought             = false
                });
            }
            else if (addType == 2)
            {
                currentList.Products.Add(new CellPhones
                {
                    Manufacturer       = NewManufacturer,
                    ModelName          = NewModel,
                    Price              = NewPrice,
                    ProductInformation = NewProductDescription,
                    Bought             = false
                });
            }
            else if (addType == 3)
            {
                currentList.Products.Add(new Hifi
                {
                    Manufacturer       = NewManufacturer,
                    ModelName          = NewModel,
                    Price              = NewPrice,
                    ProductInformation = NewProductDescription,
                    Bought             = false
                });
            }

            Console.WriteLine("Done!");
        }
コード例 #12
0
        internal void MainMenu(ProductManagement productManagement, MyLists currentList)
        {
            Console.WriteLine("What do you want:");
            Console.WriteLine("1. Show products");
            Console.WriteLine("2. Add product");
            Console.WriteLine("3. Remove Product");
            Console.WriteLine("4. Handle shopping cart");

            var input = Console.ReadKey(true).Key;

            switch (input)
            {
            case ConsoleKey.D1:
                productManagement.ShowCurrentWares(currentList);
                Console.ReadLine();
                break;

            case ConsoleKey.D2:
                productManagement.AddWare(currentList);
                break;

            case ConsoleKey.D3:
                productManagement.ShowCurrentWares(currentList);
                productManagement.RemoveWare(currentList);
                Console.ReadLine();
                break;

            case ConsoleKey.D4:
                productManagement.EditShoppingCart(currentList);
                break;

            default:
                Console.WriteLine("Not a valid input, try again.");
                Console.ReadLine();
                Console.Clear();
                break;
            }
        }
コード例 #13
0
 public void WhenIClickRecentlyViewedButton()
 {
     myLists = new MyLists(driver, scenarioContext);
     myLists.ClickRecentlyViewedButton();
 }