Exemple #1
0
        //Load thông tin của dòng đang chọn hiện tại trên dgvNhanVien lên các controls
        private void Load_Info_RowSelected()
        {
            if (dgvNhanVien.Rows.Count <= 0)
            {
                return;
            }

            int r = dgvNhanVien.CurrentCell.RowIndex;

            if (r < 0 || r >= dgvNhanVien.Rows.Count)
            {
                return;
            }
            txtMaNV.Text     = dgvNhanVien.Rows[r].Cells[0].Value.ToString();
            txtHoNV.Text     = dgvNhanVien.Rows[r].Cells[1].Value.ToString();
            txtTenNV.Text    = dgvNhanVien.Rows[r].Cells[2].Value.ToString();
            dtpNgaySinh.Text = dgvNhanVien.Rows[r].Cells[3].Value.ToString();

            if (dgvNhanVien.Rows[r].Cells[4].Value.ToString() == "True")
            {
                rdbNu.Checked = true;
            }
            else
            {
                rdbNam.Checked = true;
            }

            dtpNgayNhanViec.Text = dgvNhanVien.Rows[r].Cells[5].Value.ToString();
            txtDiaChi.Text       = dgvNhanVien.Rows[r].Cells[6].Value.ToString();
            txtSoDT.Text         = dgvNhanVien.Rows[r].Cells[7].Value.ToString();
            txtLuong.Text        = dgvNhanVien.Rows[r].Cells[8].Value.ToString();


            if (dgvNhanVien.Rows[r].Cells[9].Value.ToString() == "True")
            {
                rdbCon.Checked = true;
            }
            else
            {
                rdbNgung.Checked = true;
            }

            if (dbNhanVien.getQuyenNhanVienTheoMaNV(dgvNhanVien.Rows[r].Cells[0].Value.ToString()) == 1)
            {
                rdbQuanLy.Checked = true;
            }
            else
            {
                rdbNhanVien.Checked = true;
            }
        }