Exemplo n.º 1
0
        /// <summary>
        /// 获取教师和学生。
        /// </summary>
        /// <param name="employeeID"></param>
        /// <returns></returns>
        public OrgEmployeeCollection GetAllEmployee(string employeeID)
        {
            OrgEmployeeCollection collection = new OrgEmployeeCollection();
            //教师。
            OrgEmployeeCollection teachers = this.teacherEntity.GetAllEmployee(employeeID);
            if (teachers != null && teachers.Count > 0)
                collection.Add(teachers);
            //学生。
            OrgEmployeeCollection schools = this.studentsEntity.GetAllEmployee(employeeID);
            if (schools != null && schools.Count > 0)
                collection.Add(schools);

            return collection;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 绑定用户。
        /// </summary>
        /// <returns></returns>
        public IListControlsData BindEmployees(string departmentName, string sexName, string employeeName, params string[] ignoreEmployeeID)
        {
            if (this.orgFactory != null)
            {
                OrgEmployeeCollection collection = this.orgFactory.GetAllEmployee(employeeName);
                if (collection != null && collection.Count > 0)
                {
                    OrgDepartmentCollection departmentCollection = this.orgFactory.GetAllDepartment(departmentName);
                    if (departmentCollection != null && departmentCollection.Count > 0)
                    {
                        OrgEmployeeCollection employeeCollection = new OrgEmployeeCollection();
                        foreach (OrgDepartment d in departmentCollection)
                        {
                            OrgEmployeeCollection employees = collection.FindByDepartment(d.DepartmentID);
                            if (employees != null && employees.Count > 0)
                                employeeCollection.Add(employees);
                        }
                        collection = new OrgEmployeeCollection();
                        collection.Add(employeeCollection);
                    }

                    if (collection.Count > 0 && ignoreEmployeeID != null && ignoreEmployeeID.Length > 0)
                    {
                        foreach (string eid in ignoreEmployeeID)
                        {
                            OrgEmployee item = collection[eid];
                            if (item != null)
                            {
                                collection.Remove(item);
                                if (collection.Count == 0)
                                    break;
                            }
                        }
                    }

                    if (collection.Count > 0)
                    {
                        foreach (OrgEmployee item in collection)
                            item.EmployeeName = item.ToString();
                    }
                }
                return new ListControlsDataSource("EmployeeName", "EmployeeID", collection);
            }
            return null;
        }
Exemplo n.º 3
0
 /// <summary>
 /// 获取所有的用户数据。
 /// </summary>
 /// <param name="employeeID">用户ID。</param>
 /// <returns></returns>
 public OrgEmployeeCollection GetAllEmployee(string employeeID)
 {
     try
     {
         OrgEmployeeCollection collection = new OrgEmployeeCollection();
         OrgEmployee[] employees = this.poxy.GetAllEmployee(employeeID);
         if (employees != null && employees.Length > 0)
         {
             foreach (OrgEmployee e in employees)
             {
                 Org.OrgEmployee item = new Org.OrgEmployee();
                 item.EmployeeID = e.EmployeeID;
                 item.EmployeeSign = e.EmployeSign;
                 item.EmployeeName = e.EmployeeName;
                 item.Order = e.order;
                 item.DepartmentID = e.DepartmentID;
                 item.PostID = e.PostID;
                 collection.Add(item);
             }
         }
         return collection;
     }
     catch (Exception e)
     {
         this.log.CreateErrorLog(e.Message);
         throw e;
     }
 }
        /// <summary>
        /// 根据角色ID获取用户信息。
        /// </summary>
        /// <param name="roleID">角色ID。</param>
        /// <returns></returns>
        public OrgEmployeeCollection GetAllEmployeeByRole(string roleID)
        {
            lock (this)
            {
                OrgEmployeeCollection collection = new OrgEmployeeCollection();
                IOrgFactory factory = ModuleConfiguration.ModuleConfig.OrgFactory;
                if (factory != null)
                {
                    //角色下用户。
                    List<GUIDEx> listEmployeeID = new SecurityRoleEmployeeEntity().GetAllEmployee(roleID);
                    //角色下岗位级别。
                    List<GUIDEx> listRankID = new SecurityRoleRankEntity().GetAllRank(roleID);
                    //角色下岗位。
                    List<GUIDEx> listPostID = new SecurityRolePostEntity().GetAllPost(roleID);
                    //角色下部门。
                    List<GUIDEx> listDepartmentID = new SecurityRoleDepartmentEntity().GetAllDeprtment(roleID);

                    #region 角色下用户。
                    if (listEmployeeID != null && listEmployeeID.Count > 0)
                    {
                        foreach (GUIDEx eid in listEmployeeID)
                        {
                            OrgEmployeeCollection employeeCollection = factory.GetAllEmployee(eid);
                            if (employeeCollection != null && employeeCollection.Count == 1)
                            {
                                collection.Add(employeeCollection[0]);
                            }
                        }
                    }
                    #endregion

                    #region 岗位级别。
                    if (listRankID != null && listRankID.Count > 0)
                    {
                        OrgPostCollection postCollection = factory.GetAllPost(null);
                        if (postCollection != null && postCollection.Count > 0)
                        {
                            if (listPostID == null)
                                listPostID = new List<GUIDEx>();
                            foreach (GUIDEx rankID in listRankID)
                            {
                                OrgPostCollection posts = postCollection.FindByRank(rankID);
                                if (posts != null && posts.Count > 0)
                                {
                                    foreach (OrgPost p in posts)
                                    {
                                        if (!listPostID.Contains(p.PostID))
                                            listPostID.Add(p.PostID);
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    OrgEmployeeCollection allEmployeeCollection = null;

                    #region 岗位下用户。
                    if (listPostID != null && listPostID.Count > 0)
                    {
                        if (allEmployeeCollection == null)
                            allEmployeeCollection = factory.GetAllEmployee(null);

                        foreach (GUIDEx postID in listPostID)
                        {
                            OrgEmployeeCollection employees = allEmployeeCollection.FindByPost(postID);
                            if (employees != null && employees.Count > 0)
                            {
                                collection.Add(employees);
                            }
                        }
                    }
                    #endregion

                    #region 部门下用户。
                    if (listDepartmentID != null && listDepartmentID.Count > 0)
                    {
                        if (allEmployeeCollection == null)
                            allEmployeeCollection = factory.GetAllEmployee(null);

                        foreach (GUIDEx deptID in listDepartmentID)
                        {
                            OrgEmployeeCollection employees = allEmployeeCollection.FindByDepartment(deptID);
                            if (employees != null && employees.Count > 0)
                            {
                                collection.Add(employees);
                            }
                        }
                    }
                    #endregion
                }
                return collection;
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 根据用户ID查找用户信息.
 /// </summary>
 /// <param name="employeeID">用户ID。</param>
 /// <returns>用户信息集合(用户ID,用户姓名)。</returns>
 public IListControlsData FindByEmployeeID(string[] employeeID)
 {
     if (employeeID != null && employeeID.Length > 0)
     {
         OrgEmployeeCollection collection = new OrgEmployeeCollection();
         foreach (string eid in employeeID)
         {
             OrgEmployeeCollection employeeCollection = this.orgFactory.GetAllEmployee(eid);
             if (employeeCollection != null && employeeCollection.Count == 1)
                 collection.Add(employeeCollection);
         }
         if (collection.Count > 0)
         {
             foreach (OrgEmployee item in collection)
                 item.EmployeeName = item.ToString();
         }
         return new ListControlsDataSource("EmployeeName", "EmployeeID", collection);
     }
     return null;
 }
Exemplo n.º 6
0
 /// <summary>
 /// 根据角色ID获取用户信息。
 /// </summary>
 /// <param name="roleID">角色ID。</param>
 /// <returns></returns>
 public OrgEmployeeCollection GetAllEmployeeByRole(string roleID)
 {
     OrgEmployeeCollection collection = new OrgEmployeeCollection();
     try
     {
         Poxy.OrgEmployee[] employees = this.service.GetAllEmployeeByRole(roleID);
         if (employees != null)
         {
             foreach (Poxy.OrgEmployee employee in employees)
             {
                 Org.OrgEmployee oe = new Org.OrgEmployee();
                 oe.DepartmentID = employee.DepartmentID;
                 oe.EmployeeID = employee.EmployeeID;
                 oe.EmployeeName = employee.EmployeeName;
                 oe.PostID = employee.PostID;
                 collection.Add(oe);
             }
         }
     }
     catch (Exception e)
     {
         this.log.CreateErrorLog(e.Message);
         throw e;
     }
     return collection;
 }