private List <ChucNang_LoaiTaiKhoanDTO> LayDanhSachCheckBoxChucNang(bool themLoaiTaiKhoan) { int maLoaiTaiKhoan; if (themLoaiTaiKhoan) { maLoaiTaiKhoan = LoaiTaiKhoanBUS.LayMaLoaiTaiKhoanMoiNhat() + 1; } else { maLoaiTaiKhoan = Convert.ToInt32(txtMaLoaiTaiKhoan.Text); } List <ChucNang_LoaiTaiKhoanDTO> lsChucNang_LoaiTaiKhoan = new List <ChucNang_LoaiTaiKhoanDTO>(); foreach (Control ctrl in gpbChucNang.Controls) { if (ctrl.GetType() == typeof(MetroCheckBox)) { if (((MetroCheckBox)ctrl).Checked) { ChucNang_LoaiTaiKhoanDTO chucNang_LoaiTaiKhoan = new ChucNang_LoaiTaiKhoanDTO(); chucNang_LoaiTaiKhoan.MaChucNang = Convert.ToInt32(ctrl.AccessibleName); chucNang_LoaiTaiKhoan.MaLoaiTaiKhoan = maLoaiTaiKhoan; lsChucNang_LoaiTaiKhoan.Add(chucNang_LoaiTaiKhoan); } } } return(lsChucNang_LoaiTaiKhoan); }
private void LamMoiLoaiTaiKhoan(bool state = true) { txtMaLoaiTaiKhoan.Text = LoaiTaiKhoanBUS.LayMaLoaiTaiKhoanMoiNhat() + 1 + ""; txtTenLoaiTaiKhoan.Text = string.Empty; txtTenLoaiTaiKhoan.Enabled = true; btnThemLoaiTaiKhoan.Enabled = state; btnXoaLoaiTaiKhoan.Enabled = !state; btnSuaLoaiTaiKhoan.Enabled = !state; btnKhoiPhucLoaiTaiKhoan.Enabled = !state; gpbChucNang.Enabled = true; foreach (Control ctrl in gpbChucNang.Controls) { if (ctrl.GetType() == typeof(MetroCheckBox)) { ((MetroCheckBox)ctrl).Checked = false; } } }