示例#1
0
        public static void TaoDuLieu(Database database)
        {
            Ban.Add(new Ban("ban01", 3, new PhanCong(), new List <HoaDon>()), database);
            Ban.Add(new Ban("ban02", 2, new PhanCong(), new List <HoaDon>()), database);
            NhanVien.Add(new NhanVien("nv01", "Minh Duc", DateTime.Now), database);
            NhanVien.Add(new NhanVien("nv02", "Thanh Long", DateTime.Now), database);
            PhanCong.Add(new PhanCong(NhanVien.Find("nv01", database), Ban.Find("ban01", database), "ca4", DateTime.Now), database);
            PhanCong.Add(new PhanCong(NhanVien.Find("nv02", database), Ban.Find("ban02", database), "ca4", DateTime.Now), database);
            QuanLy.Add(new QuanLy("ql01", "Thanh Lam", DateTime.Now, "123123"), database);
            ThuNgan.Add(new ThuNgan("tn01", "Hieu Vo", DateTime.Now, "123123"), database);
            ThucUong.Add(new ThucUong("tu01", "Bia Sai Gon", "Co Con", 100, 200000), database);
            ThucUong.Add(new ThucUong("tu02", "Sinh To Buoi", "Sinh To", 20, 40000), database);
            ThucUong.Add(new ThucUong("tu03", "cocacola", "nuoc ngot", 100, 20000), database);
            List <ThucUong> thucUongs = new List <ThucUong>();

            thucUongs.Add(ThucUong.Find("tu01", database));
            thucUongs.Add(ThucUong.Find("tu02", database));
            List <ThucUong> thucUongs2 = new List <ThucUong>();

            thucUongs2.Add(ThucUong.Find("tu01", database));
            HoaDon.Add(new HoaDon("hd01", DateTime.Now, Ban.Find("ban01", database), NhanVien.Find("nv01", database), thucUongs), database);
            HoaDon.Add(new HoaDon("hd02", DateTime.Now, Ban.Find("ban02", database), NhanVien.Find("nv02", database), thucUongs2), database);
        }
示例#2
0
 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();
         }
     }
 }