public static void QLTU(Database database) { while (true) { Console.Clear(); ConsoleView.Menu("0:Thoat", "1:xoa", "2:them", "3:sua", "4:hoa don goi"); ThucUong.PrintTable(database.ThucUongs); Console.Write("chon mode:"); string i = Console.ReadLine(); if (i == "0") { break; } if (i == "1") { string id = NhapXoaID("ThucUong", database); if (id == string.Empty) { continue; } ThucUong.Delete(Console.ReadLine(), database); } if (i == "2") { string ID = NhapTaoID("ThucUong", database); if (ID == string.Empty) { continue; } Console.Write("nhap ten:"); string ten = Console.ReadLine(); Console.Write("nhap loai thuc uong:"); string loai = Console.ReadLine(); Console.Write("nhap gia:"); string gia = Console.ReadLine(); Console.Write("nhap so luong trong kho:"); string soluong = Console.ReadLine(); ThucUong.Add(new ThucUong(ID, ten, loai, Convert.ToInt32(soluong), Convert.ToInt32(gia)), database); } if (i == "3") { string ID = NhapXoaID("ThucUong", database); if (ID == string.Empty) { continue; } Console.Write("nhap ten:"); string ten = Console.ReadLine(); Console.Write("nhap loai thuc uong:"); string loai = Console.ReadLine(); Console.Write("nhap gia:"); string gia = Console.ReadLine(); Console.Write("nhap so luong trong kho:"); string soluong = Console.ReadLine(); ThucUong.Add(new ThucUong(ID, ten, loai, Convert.ToInt32(soluong), Convert.ToInt32(gia)), database); } if (i == "4") { string ID = NhapXoaID("ThucUong", database); if (ID == string.Empty) { continue; } ThucUong thucUong = ThucUong.Find(Console.ReadLine(), database); thucUong.HoaDons.ForEach(h => Console.WriteLine("- MaHD:{0,-10} Ngay:{1,-30}", h.ID, h.NgayLap)); Console.Read(); } } }
static void Main(string[] args) { Database database = new Database(); TaoDuLieu(database); while (true) { string cv; string mode; while (true) { cv = DangNhap(database); if (cv != null) { break; } } if (cv == "-1") { return; } if (cv == "ql") { while (true) { Console.Clear(); ConsoleView.Menu("0: Thoat", "1: Quan Ly Hoa Don", "2: Quan Ly Nhan Vien", "3: Quan Ly Phan Cong", "4: Quan ly Ban", "5: Quan Ly Thuc Uong", "6: Quan Ly Thu Ngan"); mode = Console.ReadLine(); if (mode == "0") { break; } if (mode == "1") { QLHD(database); } if (mode == "2") { QLNV(database); } if (mode == "3") { QLPC(database); } if (mode == "4") { QLB(database); } if (mode == "5") { QLTU(database); } if (mode == "6") { QLTN(database); } } } else { while (true) { Console.Clear(); ConsoleView.Menu("0: Thoat", "1: Quan Ly Hoa Don", "2: Xem Nhan Vien", "3: Xem Phan Cong", "4: Xem Ban", "5: Xem Thuc Uong"); mode = Console.ReadLine(); if (mode == "0") { break; } if (mode == "1") { QLHDTN(database); } if (mode == "2") { while (true) { Console.Clear(); ConsoleView.Menu("0:Thoat"); NhanVien.PrintTable(database.NhanViens); Console.Write("chon mode:"); string i = Console.ReadLine(); if (i == "0") { break; } } } if (mode == "3") { while (true) { Console.Clear(); ConsoleView.Menu("0:Thoat"); PhanCong.PrintTable(database.PhanCongs); Console.Write("chon mode:"); string i = Console.ReadLine(); if (i == "0") { break; } } } if (mode == "4") { while (true) { Console.Clear(); ConsoleView.Menu("0:Thoat"); Ban.PrintTable(database.Bans); Console.Write("chon mode:"); string i = Console.ReadLine(); if (i == "0") { break; } } } if (mode == "5") { while (true) { Console.Clear(); ConsoleView.Menu("0:Thoat"); ThucUong.PrintTable(database.ThucUongs); Console.Write("chon mode:"); string i = Console.ReadLine(); if (i == "0") { break; } } } } } } }