/// <summary> /// 按部门获取用户列表 /// </summary> /// <param name="userInfo">用户</param> /// <param name="departmentId">部门主键</param> /// <param name="containChildren">含子部门</param> /// <returns>数据表</returns> public DataTable GetDataTableByDepartment(BaseUserInfo userInfo, string departmentId, bool containChildren) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = new DataTable(BaseStaffEntity.TableName); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); if (containChildren) { dataTable = userManager.GetChildrenUsers(departmentId); } else { dataTable = userManager.GetDataTableByDepartment(departmentId); } dataTable.TableName = BaseUserEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.UserService_GetDataTableByDepartment, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return dataTable; }