Ejemplo n.º 1
0
        /// <summary>
        /// 获得指定用户有权限访问的模块
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>模块数据表</returns>
        public DataTable GetModuleDTByUserId(UserInfo userInfo, string userId)
        {
            var dataTable = new DataTable(PiModuleTable.TableName);
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.PermissionService_GetModuleDTByUserId);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var moduleManager   = new PiModuleManager(dbProvider, userInfo);
                dataTable           = userInfo.IsAdministrator ? moduleManager.GetDT(PiModuleTable.FieldDeleteMark, 0, PiModuleTable.FieldEnabled, 1, PiModuleTable.FieldSortCode) : moduleManager.GetDTByUser(userId);
                dataTable.TableName = PiModuleTable.TableName;
            });

            return(dataTable);
        }