private void FormMain_Load(object sender, EventArgs e)
        {
            LoadSchedule();
            metroComboBoxSubject.DataSource    = DataUlti.DSMon();
            metroComboBoxSubject.DisplayMember = "TenMonHoc";
            metroComboBoxSubject.ValueMember   = "MaMonHoc";
            metroComboBoxSubject.SelectedIndex = 0;
            metroComboBoxGrade.SelectedIndex   = 0;

            dgvPractice.CellClick += DgvPractice_CellClick;
            dgvSchedule.CellClick += DgvSchedule_CellClick;


            metroComboBoxSubject.SelectedIndexChanged += MetroComboBoxSubject_SelectedIndexChanged;
            metroComboBoxGrade.SelectedIndexChanged   += MetroComboBoxGrade_SelectedIndexChanged;
            LoadPractice();
            LoadResult();
        }
        private void LoadSchedule()
        {
            dgvSchedule.AutoGenerateColumns = false;

            IList <KyThi> t = DataUlti.LayLichThi(MHS);

            dgvSchedule.DataSource = (from k in t
                                      from m in DataUlti.DSMon()
                                      where m.MaMonHoc == k.MonThi
                                      select new
            {
                k.MaKyThi,
                k.TenKyThi,
                k.NgayThi,
                k.ThoiGianLamBai,
                ThiThu = k.ThiThu == true ? "Thi thử" : "Chính thức",
                m.TenMonHoc,
                KetThuc = k.KetThuc == true ? "Đóng" : "Mở",
                war = "Thi"
            }).ToList();

            dgvSchedule.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dgvSchedule.RowHeadersVisible   = false;
            dgvSchedule.AutoGenerateColumns = false;
            DataGridViewTextBoxColumn dgvCol = new DataGridViewTextBoxColumn();

            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvCol.HeaderText       = "Mã kỳ thi     ";
            dgvCol.DataPropertyName = "MaKyThi";
            dgvSchedule.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Tên kỳ thi";
            dgvCol.DataPropertyName = "TenKyThi";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            dgvSchedule.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Ngày thi";
            dgvCol.DataPropertyName = "NgayThi";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.ColumnHeader;
            dgvSchedule.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Môn Thi";
            dgvCol.DataPropertyName = "TenMonHoc";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.ColumnHeader;
            dgvSchedule.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Thời gian";
            dgvCol.DataPropertyName = "ThoiGianLamBai";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.ColumnHeader;
            dgvSchedule.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Hình thức";
            dgvCol.DataPropertyName = "ThiThu";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.ColumnHeader;
            dgvSchedule.Columns.Add(dgvCol);

            dgvCol                  = new DataGridViewTextBoxColumn();
            dgvCol.HeaderText       = "Trạng thái";
            dgvCol.DataPropertyName = "KetThuc";
            dgvCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.ColumnHeader;
            dgvSchedule.Columns.Add(dgvCol);

            DataGridViewButtonColumn dgvBut = new DataGridViewButtonColumn();

            dgvBut.HeaderText       = "Thi          ";
            dgvBut.Name             = "war";
            dgvBut.AutoSizeMode     = DataGridViewAutoSizeColumnMode.ColumnHeader;
            dgvBut.DataPropertyName = "war";

            dgvSchedule.Columns.Add(dgvBut);
        }