/// <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>
 /// <returns></returns>
 public SecurityRoleCollection Roles()
 {
     SecurityRoleCollection collection = new SecurityRoleCollection();
     try
     {
         Poxy.SecurityRole[] roles = this.service.Roles();
         if (roles != null)
         {
             foreach (Poxy.SecurityRole sr in roles)
             {
                 Security.SecurityRole role = new Security.SecurityRole();
                 role.ParentRoleID = sr.ParentRoleID;
                 role.RoleID = sr.RoleID;
                 role.RoleName = sr.RoleName;
                 collection.Add(role);
             }
         }
     }
     catch (Exception e)
     {
         this.log.CreateErrorLog(e.Message);
         throw e;
     }
     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;
     }
 }
 /// <summary>
 /// 获取用户角色集合。
 /// </summary>
 /// <param name="systemID"></param>
 /// <param name="employeeID"></param>
 /// <returns></returns>
 public SecurityRoleCollection GetEmployeeRoles(string systemID, string employeeID)
 {
     SecurityRoleCollection collection = new SecurityRoleCollection();
     try
     {
         if (!string.IsNullOrEmpty(employeeID))
         {
             Poxy.SecurityRole[] roles = this.service.GetEmployeeRoles(systemID, employeeID);
             if (roles != null && roles.Length > 0)
             {
                 foreach (Poxy.SecurityRole sr in roles)
                 {
                     Security.SecurityRole role = new Security.SecurityRole();
                     role.RoleID = sr.RoleID;
                     role.RoleName = sr.RoleName;
                     role.ParentRoleID = sr.ParentRoleID;
                     collection.Add(role);
                 }
             }
         }
     }
     catch (Exception e)
     {
         this.log.CreateErrorLog(e.Message);
         throw e;
     }
     return collection;
 }