/// <summary> /// 获取委托列表 /// </summary> /// <param name="permissionItemCode">操作权限编号</param> /// <param name="userId">用户主键</param> /// <returns>数据表</returns> public DataTable GetAuthorizeDT(string permissionItemCode, string userId = null) { if (userId == null) { userId = this.UserInfo.Id; } // 获取别人委托我的列表 string permissionItemId = string.Empty; BasePermissionItemManager permissionItemManager = new BasePermissionItemManager(this.UserInfo); permissionItemId = permissionItemManager.GetIdByCode(permissionItemCode); BasePermissionScopeManager permissionScopeManager = new BasePermissionScopeManager(this.UserInfo); string[] names = new string[] { BasePermissionScopeEntity.FieldDeletionStateCode , BasePermissionScopeEntity.FieldEnabled , BasePermissionScopeEntity.FieldResourceCategory , BasePermissionScopeEntity.FieldPermissionItemId , BasePermissionScopeEntity.FieldTargetCategory , BasePermissionScopeEntity.FieldTargetId }; Object[] values = new Object[] { 0, 1, BaseUserEntity.TableName, permissionItemId, BaseUserEntity.TableName, userId }; // 排除过期的,此方法有性能问题,已经放到后台的Sql中处理。 comment by zgl on 2011-10-27 //DataTable dt = permissionScopeManager.GetDataTable(names, values); //for (int i = 0; i < dt.Rows.Count; i++) //{ // if (!string.IsNullOrEmpty(dt.Rows[i][BasePermissionScopeEntity.FieldEndDate].ToString())) // { // // 过期的不显示 // if (DateTime.Parse(dt.Rows[i][BasePermissionScopeEntity.FieldEndDate].ToString()).Date < DateTime.Now.Date) // { // dt.Rows.RemoveAt(i); // // dt 行数会减少 // i--; // } // } //} //排除过期的,已经放到后台的Sql中处理。 DataTable dt = permissionScopeManager.GetAuthoriedList(BaseUserEntity.TableName, permissionItemId, BaseUserEntity.TableName, userId); string[] userIds = BaseBusinessLogic.FieldToArray(dt, BasePermissionScopeEntity.FieldResourceId); BaseUserManager userManager = new BaseUserManager(this.UserInfo); return(userManager.GetDataTable(userIds)); }