/* * Nhập thông tin sản phẩm */ public void EnterProduct() { //Nhập số lượng sp Console.Write("+ Enter number of product: "); int num = ProManager.checkInt(); for (int i = 0; i < num; i++) { Product product = new Product(); Console.WriteLine("-Product 1:"); //nhập id sp Console.Write("\t--Please enter id number: "); product.IdPro = ProManager.checkid(); //nhập tên sp Console.Write("\t--Please enter name:"); product.NamePro = ProManager.checkname(); //nhập giá sp Console.Write("\t--Please enter price: "); product.Price = ProManager.checkPrice(); //nhập số lượng sp Console.Write("\t--Please enter quantity: "); product.Quantity = ProManager.checkquantity(); //thêm sp vào arraylist listPro.Add(product); Console.WriteLine("\n\tProduct added success!"); } }
public static void Main(string[] args) { ProManager pm = new ProManager(); while (true) { int exit = pm.Menu(); switch (exit) { case 1: { pm.EnterProduct(); break; } case 2: { pm.Output(); break; } case 0: { Console.WriteLine("See you again <3."); Console.WriteLine("\n\n\n-------------------------------END---------------------------------"); return; } } } }
/* * Hiển thị menu ra */ public int Menu() { Console.WriteLine("----------MENU----------"); Console.WriteLine("1.Input product."); Console.WriteLine("2.Show list product."); Console.WriteLine("0.Exit."); Console.Write("Please choose: "); int choose = ProManager.checkInt(); return(choose); }