コード例 #1
0
        private void LayDanhSachHV()
        {
            frmShow frm = new frmShow();


            string menuid = data.DrTable["sysMenuID"].ToString();

            frm.Text        = menuid.Equals("9912") ? "Điểm danh học viên" : "Điểm danh học viên lớp kết thúc";
            frm.isChonLopKT = menuid.Equals("9912") ? false : true;

            if (frm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            gv.ActiveFilterString = frm.isChonLopKT ? "MaLop = '" + frm.MaLop + "'" : "MaLop = '" + frm.MaLop + "' and Ngay >= #" + frm.dtFirst + "#";

            //if (gv.DataRowCount == 0)
            //{
            if (frm.dtHocVien == null)
            {
                return;
            }

            for (int i = 0; i < frm.dtHocVien.Rows.Count; i++)
            {
                DataRow row = frm.dtHocVien.Rows[i];
                gv.AddNewRow();

                gv.SetFocusedRowCellValue(gv.Columns["Ngay"], row["Ngay"]);
                gv.SetFocusedRowCellValue(gv.Columns["MaLop"], frm.MaLop);
                gv.SetFocusedRowCellValue(gv.Columns["MaHV"], row["HVID"].ToString());
                gv.SetFocusedRowCellValue(gv.Columns["NguonHV"], row["MaNguon"]);
                if (row["MaHV"] == DBNull.Value)
                {
                    gv.SetFocusedRowCellValue(gv.Columns["MaTV"], "HVTN");
                }
                gv.UpdateCurrentRow();
            }
            gv.BestFitColumns();
            //}

            gv.OptionsView.NewItemRowPosition = NewItemRowPosition.None;
            gv.CollapseAllGroups();
        }
コード例 #2
0
        private void LayDanhSachHV()
        {
            frmShow frm = new frmShow();

            frm.Text = "Điểm danh học viên";
            if (frm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            gv.ActiveFilterString = "MaLop = '" + frm.MaLop + "' and Ngay >= #" + frm.dtFirst + "#";

            //if (gv.DataRowCount == 0)
            //{
            if (frm.dtHocVien == null)
            {
                return;
            }

            for (int i = 0; i < frm.dtHocVien.Rows.Count; i++)
            {
                DataRow row = frm.dtHocVien.Rows[i];
                gv.AddNewRow();

                gv.SetFocusedRowCellValue(gv.Columns["Ngay"], row["Ngay"]);
                gv.SetFocusedRowCellValue(gv.Columns["MaLop"], frm.MaLop);
                gv.SetFocusedRowCellValue(gv.Columns["MaHV"], row["HVID"].ToString());
                gv.SetFocusedRowCellValue(gv.Columns["MaTV"], row["MaHV"].ToString());
                gv.UpdateCurrentRow();
            }
            gv.BestFitColumns();
            //}

            gv.OptionsView.NewItemRowPosition = NewItemRowPosition.None;
            gv.CollapseAllGroups();
        }