public void GetItemByProduceCodeAndAttribute(int id, string att) { Assert.NotNull(IBL.GetItemByProduceCodeAndAttribute(id, att)); }
public void DisplayAttribute(Customers Cus) { Console.Clear(); Item_BL IBL = new Item_BL(); User U = new User(); string[] choice = { "Không dây", "Thể thao", "In-Ear", "Gaming", "Earbud", "Trở về danh sách sản phẩm" }; int number = SubMenu("Danh sách sản phẩm theo thuộc tính", choice); List <Items> items = new List <Items>(); string ab = null; switch (number) { case 1: items = IBL.GetItemByAttribute("Không dây"); ab = "Không dây"; break; case 2: items = IBL.GetItemByAttribute("Thể thao"); ab = "Thể thao"; break; case 3: items = IBL.GetItemByAttribute("In-Ear"); ab = "In-Ear"; break; case 4: items = IBL.GetItemByAttribute("Gaming"); ab = "Gaming"; break; case 5: items = IBL.GetItemByAttribute("Earbud"); ab = "Earbud"; break; case 6: DisplayProduct(Cus); break; } Console.Clear(); table = new ConsoleTable("Mã sản phẩm", "Tên sản phẩm", "Hãng", "Thuộc tính", "Giá sản phẩm"); foreach (Items i in items) { table.AddRow(i.Produce_Code, i.Item_Name, i.Trademark, i.Attribute, U.FormatMoney(i.Item_Price)); } table.Write(Format.Alternative); string[] choice1 = { "Xem chi tiết sản phẩm", "Thêm vào giỏ hàng", "Quay về trang chính" }; int number1 = Product.SubMenu(null, choice1); switch (number1) { case 1: Console.Write("Chọn mã sản phẩm: "); int showdetal = input(Console.ReadLine()); while (IBL.GetItemByProduceCodeAndAttribute(showdetal, ab) == null) { string a; Console.WriteLine("Mã sản phẩm không tồn tại!"); Console.Write("Bạn có muốn nhập lại mã sản phẩm không ? (Y/N): "); a = Console.ReadLine().ToUpper(); while (true) { if (a != "Y" && a != "N") { Console.Write("Bạn chỉ được nhập (Y/N): "); a = Console.ReadLine().ToUpper(); continue; } break; } if (a == "Y" || a == "y") { Console.Write("\nChọn mã sản phẩm: "); showdetal = input(Console.ReadLine()); } else { DisplayProduct(Cus); } } DisplayItemDetails(showdetal, Cus); break; case 2: Console.Write("Chọn mã sản phẩm: "); int pc = input(Console.ReadLine()); while (IBL.GetItemByProduceCodeAndAttribute(pc, ab) == null) { string a; Console.WriteLine("Mã sản phẩm không tồn tại!"); Console.Write("Bạn có muốn nhập lại mã sản phẩm không ? (Y/N): "); a = Console.ReadLine().ToUpper(); while (true) { if (a != "Y" && a != "N") { Console.Write("Bạn chỉ được nhập (Y/N): "); a = Console.ReadLine().ToUpper(); continue; } break; } if (a == "Y" || a == "y") { Console.Write("\nChọn mã sản phẩm: "); pc = input(Console.ReadLine()); } else { DisplayProduct(Cus); } } Items item = IBL.GetItemByProduceCodeAndAttribute(pc, ab); InputQuantity(Cus, item, pc); break; case 3: U.UserMenu(Cus); break; } }