예제 #1
0
파일: clsDiem.cs 프로젝트: rovers0/VIDOK12
        public void NhapDiem(List <clsMonHoc> plstMonHoc, List <clsHocSinh> plstHocSinh)
        {
            int iLuaChonMH = 0, iLuaChonHS = 0;

            if ((plstHocSinh == null) || (plstMonHoc == null) || (plstHocSinh.Count == 0) || (plstMonHoc.Count == 0))
            {
                return;
            }
            clsMenu menuMonHoc  = new clsMenu();
            clsMenu menuHocSinh = new clsMenu();

            foreach (clsMonHoc mh in plstMonHoc)
            {
                menuMonHoc.AddItem(mh.MSMH);
            }

            iLuaChonMH = menuMonHoc.DisplayMenu();
            MSMH       = plstMonHoc[iLuaChonMH].MSMH;

            foreach (clsHocSinh hs in plstHocSinh)
            {
                menuHocSinh.AddItem(hs.MSHS + "-" + hs.HoTen);
            }
            iLuaChonHS = menuHocSinh.DisplayMenu();
            MSHS       = plstHocSinh[iLuaChonHS].MSHS;

            Console.Write("Nhap diem mon hoc {0} cho hoc sinh {1}: ", MSMH, MSHS);
            Diem = double.Parse(Console.ReadLine());
        }
예제 #2
0
        public static void Main(string[] args)
        {
            List <clsHocSinh> lstHocSinh = new List <clsHocSinh>();
            List <clsMonHoc>  lstMonHoc  = new List <clsMonHoc>();
            List <clsDiem>    lstDiem    = new List <clsDiem>();
            clsMenu           menu       = new clsMenu();
            int    iLuaChon;
            string sSoBaoDanh = "";

            menu.AddItem("Nhap Hoc Sinh");
            menu.AddItem("Nhap Mon Hoc");
            menu.AddItem("Nhap Diem");
            menu.AddItem("Danh Sach Diem Theo Mon Hoc");
            menu.AddItem("Danh Sach Diem Theo Hoc Sinh");
            menu.AddItem("Thoat");

            do
            {
                iLuaChon = menu.DisplayMenu();
                if (iLuaChon == 0)
                {
                    clsHocSinh hs = new clsHocSinh();
                    hs.NhapThongTin();
                    lstHocSinh.Add(hs);
                }
                else if (iLuaChon == 1)
                {
                    clsMonHoc mh = new clsMonHoc();
                    mh.NhapThongTin();
                    lstMonHoc.Add(mh);
                }
                else if (iLuaChon == 2)
                {
                    clsDiem diem = new clsDiem();
                    diem.NhapDiem(lstMonHoc, lstHocSinh);
                    lstDiem.Add(diem);
                }
                else if (iLuaChon == 3)
                {
                    foreach (clsDiem diem in lstDiem)
                    {
                        diem.InThongTin();
                    }
                    Console.ReadKey();
                }
                else if (iLuaChon == 4)
                {
                    foreach (var element in lstHocSinh)
                    {
                        element.InThongTin();
                    }
                    Console.ReadKey(true);
                }
            }while (iLuaChon != 5);
        }