Exemple #1
0
        private void frmMonHoc_Load(object sender, EventArgs e)
        {
            List <clsMonHoc> listAllMonHoc = new List <clsMonHoc>();
            List <MonHoc>    lstMonHoc     = new List <MonHoc>();

            if (khoiLop == 0)
            {
                lstMonHoc = monHoc.GetAllMonHoc();
            }
            else
            {
                lstMonHoc = monHoc.GetMonHocByID_Khoi(khoiLop);
            }

            if (lstMonHoc.Count != 0)
            {
                foreach (var item in lstMonHoc)
                {
                    clsMonHoc mh = new clsMonHoc();
                    mh.ID       = item.ID;
                    mh.Khoi     = (int)item.Khoi;
                    mh.MaMon    = item.MaMonHoc;
                    mh.TenMon   = item.TenMonHoc;
                    mh.SoCauHoi = (int)item.SoCauHoi;
                    mh.NgayTao  = (DateTime)item.CreateDate;
                    if (item.InUsed == true)
                    {
                        mh.TrangThai = "Đã sử dụng";
                    }
                    else
                    {
                        mh.TrangThai = "Chưa sử dụng";
                    }
                    listAllMonHoc.Add(mh);
                }
            }
            bindSource.DataSource = listAllMonHoc;
            grdMonHoc.DataSource  = bindSource.DataSource;
            grdMonHoc.RefreshDataSource();
        }