/// <summary> /// Load danh sach cac quyen khac ngoai vai tro ma nguoi dung duoc cap /// </summary> /// <Modified> /// Author Date Comments /// Cuongdb 15/2/2008 Tạo mới /// </Modified> private void LoadPermissionAssignedData() { try { // Add Permission to lstQuyenDuocCap UserPermission objUserPermission = new UserPermission(); objUserPermission.UserName = _strUserName; DataView tabUserPermission = new DataView(objUserPermission.GetUserPermissionFull()); //new DataView(objUserPermission.GetUserPermissionFull());//Thay chỉ lấy quyền gán không lấy quyền trong vai trò! Jira 288 --> Vẫn cho phụ thuộc vai trò lstQuyenDuocCap.DataSource = null; lstQuyenDuocCap.DisplayMember = "PERMISSION_NAME"; lstQuyenDuocCap.ValueMember = "PERMISSION_ID"; lstQuyenDuocCap.DataSource = tabUserPermission; // Load cac quyen khong duoc cap con lai trong he thong objUserPermission.UserName = _strUserName; DataTable tabPermissionNotInUser = objUserPermission.GetPermissionNotInUser(); //Bổ xung thêm các quyền cha DataTable dtPermission = (new Permission()).GetAll(); bool bNotExist; for (int i = dtPermission.Rows.Count - 1; i >= 0; i--) { bNotExist = true; for (int j = 0; j < tabPermissionNotInUser.Rows.Count; j++) { if (tabPermissionNotInUser.Rows[j]["PERMISSION_ID"].ToString().IndexOf( dtPermission.Rows[i]["PERMISSION_ID"].ToString()) == 0) { bNotExist = false; break; } } if (bNotExist) { dtPermission.Rows.RemoveAt(i); } } lstQuyenKhongDuocCap.DataSource = null; lstQuyenKhongDuocCap.DisplayMember = "PERMISSION_NAME"; lstQuyenKhongDuocCap.ValueMember = "PERMISSION_ID"; lstQuyenKhongDuocCap.DataSource = dtPermission; objUserPermission = null; } catch (Exception ex) { LogError.WriteLogError("LoadPermissionAssignedData: ", ex); } }
/// <summary> /// Load danh sach cac quyen khac ngoai vai tro ma nguoi dung duoc cap /// </summary> /// <Modified> /// Author Date Comments /// Cuongdb 15/2/2008 Tạo mới /// </Modified> private void LoadPermissionAssignedData() { // Add Permission to lstQuyenDuocCap UserPermission objUserPermission = new UserPermission(); DataView tabUserPermission; objUserPermission.UserName = strUserName; tabUserPermission = new DataView(objUserPermission.GetUserPermissionFull()); //tabUserPermission.RowFilter = "GRANT_USER_ID = '" + strUserName + "'"; lstQuyenDuocCap.DataSource = null; lstQuyenDuocCap.DisplayMember = "PERMISSION_NAME"; lstQuyenDuocCap.ValueMember = "PERMISSION_ID"; lstQuyenDuocCap.DataSource = tabUserPermission; // Load cac quyen khong duoc cap con lai trong he thong DataTable tabPermissionNotInUser; objUserPermission.UserName = strUserName; tabPermissionNotInUser = objUserPermission.GetPermissionNotInUser(); //Bổ xung thêm các quyền cha DataTable dtPermission = (new Permission()).GetAll(); bool bNotExist; for (int i = dtPermission.Rows.Count - 1; i >= 0; i--) { bNotExist = true; for (int j = 0; j < tabPermissionNotInUser.Rows.Count; j++) { if (tabPermissionNotInUser.Rows[j]["PERMISSION_ID"].ToString().IndexOf( dtPermission.Rows[i]["PERMISSION_ID"].ToString()) == 0) { bNotExist = false; break; } } if (bNotExist) { dtPermission.Rows.RemoveAt(i); } } lstQuyenKhongDuocCap.DataSource = null; lstQuyenKhongDuocCap.DisplayMember = "PERMISSION_NAME"; lstQuyenKhongDuocCap.ValueMember = "PERMISSION_ID"; lstQuyenKhongDuocCap.DataSource = dtPermission; objUserPermission = null; }