/// <summary> /// 获取角色集合。 /// </summary> /// <returns></returns> public SecurityRoleCollection Roles() { lock (this) { SecurityRoleCollection collection = new SecurityRoleCollection(); DataTable dtSource = this.securityRoleEntity.GetAllRecord(); if (dtSource != null) { collection.InitAssignment(dtSource); } return collection; } }
/// <summary> /// 获取用户角色集合。 /// </summary> /// <param name="systemID">系统ID。</param> /// <param name="employeeID">用户ID。</param> /// <returns></returns> public SecurityRoleCollection GetEmployeeRoles(string systemID, string employeeID) { lock (this) { SecurityRoleCollection collection = new SecurityRoleCollection(); if (!string.IsNullOrEmpty(systemID) && !string.IsNullOrEmpty(employeeID)) { IOrgFactory factory = ModuleConfiguration.ModuleConfig.OrgFactory; if (factory != null) { OrgEmployeeCollection employees = factory.GetAllEmployee(employeeID); if (employees != null && employees.Count > 0) { string departmentID = employees[0].DepartmentID; string postID = employees[0].PostID; string rankID = string.Empty; if (!string.IsNullOrEmpty(postID)) { OrgPostCollection posts = factory.GetAllPost(postID); if (posts != null && posts.Count > 0) rankID = posts[0].RankID; } DataTable dtSource = this.securityRoleEntity.GetEmployeeRoles(systemID, employeeID, departmentID, rankID, postID); if (dtSource != null) collection.InitAssignment(dtSource); } } } return collection; } }