public void LoadDanhMucMHM()
        {
            MonHocMoDAL monHocMoDAL = new MonHocMoDAL(dbConnection);

            DanhMucMHM = monHocMoDAL.ReadMonHocsByHocKyAndNamHoc(phieuDKHP.HocKy, phieuDKHP.NamHoc);
            OnPropertyChanged("DanhMucMHM");
            NewCtPhieuDKHPs();
        }
        private void LoadDanhMucMonHocMo()
        {
            if (dsMonHocMo.HocKy == 0)
            {
                MessageBox.Show("\nHọc Kỳ không hợp lệ", "ERROR");
                return;
            }
            DsMonHocMoDAL dsMonHocMoDAL = new DsMonHocMoDAL(dbConnection);

            if (!dsMonHocMoDAL.IsExistedByHocKyAndNamHoc(dsMonHocMo))
            {
                dsMonHocMoDAL.CreateItemByHocKyAndNamHoc(dsMonHocMo);
            }
            dsMonHocMo = dsMonHocMoDAL.ReadItemByHocKyAndNamHoc(dsMonHocMo);
            OnPropertyChanged("DsMonHocMo");
            MonHocMoDAL monHocMoDAL = new MonHocMoDAL(dbConnection);

            DanhMucMonHocMo = monHocMoDAL.ReadItemsByDsDataTable(dsMonHocMo.MaDsMonHocMo);
            OnPropertyChanged("DanhMucMonHocMo");
        }
        private void XacNhanLuuDsMonHocMo()
        {
            string errorString = "";

            if (dsMonHocMo.HocKy == 0)
            {
                errorString = "\nHọc Kỳ không hợp lệ";
                MessageBox.Show(errorString, "ERROR");
                return;
            }

            List <MonHocMo> monHocMos = new List <MonHocMo>();

            foreach (DataRow row in DanhMucMonHocMo.Rows)
            {
                MonHocMo monHocMo = new MonHocMo();
                int      number;
                if (!int.TryParse(row["MonHoc"].ToString(), out number))
                {
                    continue;
                }
                monHocMo.MonHoc = number;
                monHocMos.Add(monHocMo);
            }
            errorString = CheckThongTinDsMonHocMo(monHocMos);
            if (errorString == "")
            {
                MonHocMoDAL monHocMoDAL = new MonHocMoDAL(dbConnection);
                monHocMoDAL.DeleteItemsByDs(dsMonHocMo.MaDsMonHocMo);
                foreach (MonHocMo monHocMo in monHocMos)
                {
                    monHocMoDAL.CreateItem(monHocMo);
                }
                MessageBox.Show("Lưu Danh sách Môn Học Mở thành công");
            }
            else
            {
                MessageBox.Show(errorString, "ERROR");
            }
        }