Exemplo n.º 1
0
 public Ban(string maBan, int soGhe, PhanCong phanCong, List <HoaDon> hoaDon)
 {
     MaBan    = maBan;
     SoGhe    = soGhe;
     PhanCong = phanCong;
     HoaDons  = hoaDon;
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public static void QLPC(Database database)
        {
            while (true)
            {
                Console.Clear();
                ConsoleView.Menu("0:Thoat", "1:xoa", "2:them", "3:sua");
                PhanCong.PrintTable(database.PhanCongs);
                Console.Write("chon mode:");
                string i = Console.ReadLine();
                if (i == "0")
                {
                    break;
                }
                if (i == "1")
                {
                    string idnv = NhapXoaID("NhanVien", database);
                    if (idnv == string.Empty)
                    {
                        continue;
                    }
                    string idb = NhapXoaID("Ban", database);
                    if (idb == string.Empty)
                    {
                        continue;
                    }
                    if (PhanCong.Find(idnv, idb, database) == null)
                    {
                        continue;
                    }
                    PhanCong.Delete(idnv, idb, database);
                }
                if (i == "2")
                {
                    string ID = NhapXoaID("NhanVien", database);
                    if (ID == string.Empty)
                    {
                        continue;
                    }
                    string idban = NhapXoaID("Ban", database);
                    if (idban == string.Empty)
                    {
                        continue;
                    }
                    if (Ban.Find(idban, database).PhanCong.NhanVien != null)
                    {
                        Console.WriteLine("Ban Nay Da Co NV Phu Trach");
                        Console.Read();
                        continue;
                    }
                    if (PhanCong.Find(ID, idban, database) != null)
                    {
                        Console.WriteLine("Da Ton Tai Phan Cong Nay");
                        Console.Read();
                        continue;
                    }

                    Console.Write("Nhap ca lam");
                    string ca = Console.ReadLine();
                    PhanCong.Add(new PhanCong(NhanVien.Find(ID, database), Ban.Find(idban, database), ca, DateTime.Now), database);
                }
                if (i == "3")
                {
                    string ID = NhapXoaID("NhanVien", database);
                    if (ID == string.Empty)
                    {
                        continue;
                    }
                    string idban = NhapXoaID("Ban", database);
                    if (idban == string.Empty)
                    {
                        continue;
                    }
                    if (PhanCong.Find(ID, idban, database) == null)
                    {
                        Console.WriteLine("Khong ton tai phan khong nay");
                        Console.Read();
                        continue;
                    }
                    Console.Write("nhap ca lam:");
                    string ca = Console.ReadLine();
                    PhanCong.Update(ID, idban, new PhanCong(NhanVien.Find(ID, database), Ban.Find(idban, database), ca, DateTime.Now), database);
                }
            }
        }
Exemplo n.º 4
0
        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;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
 public static void Update(string maNV, string maBan, PhanCong phanCong, Database database)
 {
     Delete(maNV, maBan, database);
     Add(phanCong, database);
 }
Exemplo n.º 6
0
 public static void Add(PhanCong phanCong, Database database)
 {
     database.PhanCongs.Add(phanCong);
     NhanVien.Find(phanCong.NhanVien.GetID(), database).PhanCongs.Add(phanCong);
     Ban.Find(phanCong.Ban.MaBan, database).PhanCong = phanCong;
 }