private void btnThem_Click(object sender, EventArgs e)
        {
            if (XL2.KiemtraKetnoiCSDL() == false)
            {
                return;
            }

            TreeNode            node = treePhongBan.SelectedNode;
            frmThem_Capnhat_1NV frm  = new frmThem_Capnhat_1NV {
                StartPosition = FormStartPosition.CenterParent
            };

            frm.mode = 1;
            frm.ShowDialog();
            if (frm.IsReload)
            {
                string oldFilter = string.Empty;
                var    dataView  = dgrdDSNVTrgPhg.DataSource as DataView;
                if (dataView != null)
                {
                    oldFilter = dataView.RowFilter;
                }
                treePhongBan_AfterSelect(treePhongBan, new TreeViewEventArgs(node));
                dataView = dgrdDSNVTrgPhg.DataSource as DataView;
                if (dataView != null)
                {
                    dataView.RowFilter = oldFilter;
                }
            }
        }
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            #region lấy dsnv được chọn

            BindingContext[dgrdDSNVTrgPhg.DataSource].EndCurrentEdit();
            var checkRows = (from DataGridViewRow dataGridViewRow in dgrdDSNVTrgPhg.Rows
                             let row = (DataRowView)dataGridViewRow.DataBoundItem
                                       where dataGridViewRow.Cells["check"].FormattedValue != null && (bool)dataGridViewRow.Cells["check"].FormattedValue
                                       select row).ToList();

            #endregion

            #region chưa chọn nv thì báo và thoát

            if (checkRows.Count == 0)
            {
                ACMessageBox.Show(Resources.Text_ChuaChonNV, Resources.Caption_ThongBao, 2000);
                return;
            }

            #endregion

            TreeNode node      = treePhongBan.SelectedNode;
            string   oldFilter = string.Empty;

            if (checkRows.Count == 1)
            {
                frmThem_Capnhat_1NV frm = new frmThem_Capnhat_1NV {
                    StartPosition = FormStartPosition.CenterParent
                };
                frm.mode    = 0;
                frm.RowView = checkRows[0];
                frm.ShowDialog();
                if (frm.IsReload)
                {
                    var dataView = dgrdDSNVTrgPhg.DataSource as DataView;
                    if (dataView != null)
                    {
                        oldFilter = dataView.RowFilter;
                    }
                    treePhongBan_AfterSelect(treePhongBan, new TreeViewEventArgs(node));
                    dataView = dgrdDSNVTrgPhg.DataSource as DataView;
                    if (dataView != null)
                    {
                        dataView.RowFilter = oldFilter;
                    }
                }
            }
            else
            {
                frmCapNhatNVHangLoat frm = new frmCapNhatNVHangLoat {
                    StartPosition = FormStartPosition.CenterParent
                };
                frm.RowViews = checkRows;
                frm.ShowDialog();
                if (frm.IsReload)
                {
                    var dataView = dgrdDSNVTrgPhg.DataSource as DataView;
                    if (dataView != null)
                    {
                        oldFilter = dataView.RowFilter;
                    }
                    treePhongBan_AfterSelect(treePhongBan, new TreeViewEventArgs(node));
                    dataView = dgrdDSNVTrgPhg.DataSource as DataView;
                    if (dataView != null)
                    {
                        dataView.RowFilter = oldFilter;
                    }
                }
            }
        }