private void frmThongKe_Load(object sender, EventArgs e) { rdbMaSV.Checked = true; if (quyen == "Member") { groupBox5.Enabled = false; dgvSV.DataSource = dbSV.TimMaSinhVien(user); dgvSV.AllowUserToAddRows = false; dgvSV.ReadOnly = true; dgvSV.AutoGenerateColumns = false; rdbMaSV.Checked = true; dgvSV.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvSV.Columns.Remove("maLop"); dgvSV.Columns["ngaySinh"].Visible = false; dgvSV.Columns["gioiTinh"].Visible = false; dgvSV.Columns.Remove("diaChi"); dgvSV.Columns.Remove("Lop"); dgvSV.AllowUserToAddRows = false; } else { dgvSV.DataSource = dbSV.LaySinhVien(); dgvSV.AllowUserToAddRows = false; dgvSV.ReadOnly = true; dgvSV.AutoGenerateColumns = false; rdbMaSV.Checked = true; dgvSV.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvSV.Columns.Remove("maLop"); dgvSV.Columns["ngaySinh"].Visible = false; dgvSV.Columns["gioiTinh"].Visible = false; dgvSV.Columns.Remove("diaChi"); dgvSV.Columns.Remove("Lop"); dgvSV.AllowUserToAddRows = false; } }
void LoadDataSV() { if (quyen == "Admin") { dgvSV.DataSource = dbSV.LaySinhVien(); } else { dgvSV.DataSource = dbSV.TimMaSinhVien(user); } dgvSV.Columns.Remove("ngaySinh"); dgvSV.Columns.Remove("gioiTinh"); dgvSV.Columns.Remove("diaChi"); dgvSV.Columns["Lop"].Visible = false; dgvSV.Columns["maLop"].Visible = false; dgvSV.AllowUserToAddRows = false; dgvSV.ReadOnly = true; rdbMaSV.Checked = true; LoadComboKhoa(); LoadComboLop(cboKhoaHoc.Text); dgvSV.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvDiem.AllowUserToAddRows = false; dgvDiem.ReadOnly = true; dgvDiem.SelectionMode = DataGridViewSelectionMode.FullRowSelect; cbLop.DataSource = dbLop.LayLop(); cbLop.ValueMember = "maLop"; //cbLop.DisplayMember = "maLop"; cbMon.DataSource = dbMon.LayMon(); cbMon.ValueMember = "maMon"; // cbMon.DisplayMember = "maMon"; // Không cho thao tác trên các nút Lưu / Hủy this.btnSave.Enabled = false; this.btnCancel.Enabled = false; this.groupBox2.Enabled = false; // Cho thao tác trên các nút Thêm / Sửa / Xóa /Thoát this.btnAdd.Enabled = true; this.btnEdit.Enabled = true; this.btnDel.Enabled = true; this.btnExit.Enabled = true; phanquyen(); //resettextDiem(); }
private void btnTim_Click(object sender, EventArgs e) { if (rdbMaSV.Checked == true) { dgvDSSV.DataSource = dbSV.TimMaSinhVien(txtSearch.Text); } if (rdbHoTen.Checked == true) { dgvDSSV.DataSource = dbSV.TimTenSinhVien(txtSearch.Text); } }