コード例 #1
0
 public void GetListItemsTest()
 {
     Assert.NotNull(shoesBL.GetListShoes(1));
 }
コード例 #2
0
        public void ShowlistItems()
        {
            Console.Clear();
            List <Shoes> shoes = null;

            shoes = shoesBL.GetListShoes(1);
            if (shoes == null)
            {
                Console.ReadKey();
            }
            else
            {
                while (true)
                {
                    // int? idItem;
                    string[] listcol = { "Select Product", "Search", "Enter Page", "Back" };
                    int      choice  = Utility.showListItems("List Shoes", listcol, shoes, customer.UserID);
                    switch (choice)
                    {
                    case 1:
                        if (shoes.Count <= 0)
                        {
                            Console.WriteLine("No Shoes");
                            Console.WriteLine("Press any key to display the shoe list");
                            Console.ReadKey();
                            shoes = shoesBL.GetListShoes(1);
                        }
                        else
                        {
                            var      stringTest = Utility.SelectAnItem(shoes);
                            string[] tokens     = stringTest.Split(',');
                            var      id         = Convert.ToInt32(tokens[1]);

                            var amount = Convert.ToInt32(tokens[0]);


                            ShowAnItem(id, amount);
                        }
                        continue;

                    case 2:
                        Console.Write("Enter Shoes' Name: ");
                        Console.InputEncoding  = Encoding.Unicode;
                        Console.OutputEncoding = Encoding.Unicode;
                        string itemName = Console.ReadLine();
                        shoes = shoesBL.SearchShoesName(itemName);
                        continue;

                    case 3:
                        Console.Write(" Enter Page:");
                        var pageIndex = Convert.ToInt32(Console.ReadLine());
                        shoes = shoesBL.GetListShoes(pageIndex);
                        continue;

                    case 4:
                        break;
                    }
                    break;
                }
            }
        }