Exemplo n.º 1
0
        private static void TaoPhieuMuon(List <OChua> dsOChua, List <PhieuMuon> dsPhieuMuon, Dictionary <string, int> sl)
        {
            OChua ochua = new OChua();

            ochua.showLayout();
            PhieuMuon phieuMuon = new PhieuMuon();
            Program   program   = new Program();

            Console.WriteLine("Ma doc gia");
            string madocgia = Console.ReadLine();

            program.DSCoTheChoMuon(dsOChua);
            Console.WriteLine("Ma sach");
            string maS = Console.ReadLine();

            Console.WriteLine("Lay sach " + maS + " tu o chua :");
            for (int i = 0; i < dsOChua.Count; i++)
            {
                if (dsOChua[i].MaSach == maS)
                {
                    Console.WriteLine(dsOChua[i].MaO + "\n");
                }
            }
            string maOChua = Console.ReadLine();

            //lay sach tu o chua;
            ochua.LaySachTuO(dsOChua, maOChua, sl);

            DateTime ngaymuon = DateTime.Now;

            dsPhieuMuon.Add(new PhieuMuon(phieuMuon.genKey(), madocgia, maS, ngaymuon, " da cho muon"));
            Console.Clear();
            throw new NotImplementedException();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Sach                     sach        = new Sach();
            OChua                    ochua       = new OChua();
            PhieuMuon                phieuMuon   = new PhieuMuon();
            Program                  program     = new Program();
            int                      n           = 0;
            List <Sach>              dsSach      = new List <Sach>();
            List <OChua>             dsOChua     = new List <OChua>();
            List <PhieuMuon>         dsPhieuMuon = new List <PhieuMuon>();
            Dictionary <string, int> sl          = new Dictionary <string, int>();


            sach.showLayout();
            Console.WriteLine("Nhap so o chua :");
            n = int.Parse(Console.ReadLine());


            while (true)
            {
                sach.showLayout();
                int    chon    = 0;
                String luachon = "\nNhap lua chon :" +
                                 "\n1.Nhap sach " +
                                 "\n2.Lap phieu muon " +
                                 "\n3.Tim kiem theo ma sach " +
                                 "\n4.In danh sach sach ";
                Console.WriteLine(luachon);
                program.showFoot();
                chon = int.Parse(Console.ReadLine());
                switch (chon)
                {
                case 1:
                {
                    NhapSach(dsSach, sl, dsOChua, n);
                    break;
                }

                case 2:
                {
                    TaoPhieuMuon(dsOChua, dsPhieuMuon, sl);
                    break;
                }

                case 3:
                {
                    sach.showLayout();
                    Console.WriteLine("Nhap ma sach :");
                    string ms = Console.ReadLine();
                    program.TimKiem(dsSach, sl, dsOChua, ms);
                    break;
                }

                case 4:
                {
                    sach.showLayout();
                    program.DanhSachSach(dsSach, sl, dsOChua);
                    program.DanhSachOChua(dsOChua);
                    Console.ReadLine();
                    Console.Clear();
                    break;
                }

                case 0:
                    break;
                }
            }
            Console.ReadLine();
        }