예제 #1
0
        /// <summary>
        /// 获取模块列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        public DataTable GetDT(UserInfo userInfo)
        {
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.ModuleService_GetDT);
            var dataTable = new DataTable(PiModuleTable.TableName);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var moduleManager          = new PiModuleManager(dbProvider, userInfo);
                dataTable                  = moduleManager.GetDT(PiModuleTable.FieldDeleteMark, 0, PiModuleTable.FieldSortCode);
                dataTable.DefaultView.Sort = PiModuleTable.FieldSortCode;
                dataTable.TableName        = PiModuleTable.TableName;
            });
            return(dataTable);
        }
예제 #2
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);
        }
예제 #3
0
        /// <summary>
        /// 按主键数组获取列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">角色主键</param>
        /// <returns>数据表</returns>
        public DataTable GetDTByIds(UserInfo userInfo, string[] ids)
        {
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.RoleService_GetDTByIds);
            var dataTable = new DataTable(PiRoleTable.TableName);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var moduleManager   = new PiModuleManager(dbProvider, userInfo);
                dataTable           = moduleManager.GetDT(PiModuleTable.FieldId, ids, PiModuleTable.FieldSortCode);
                dataTable           = BusinessLogic.SetFilter(dataTable, PiModuleTable.FieldDeleteMark, "0");
                dataTable.TableName = PiModuleTable.TableName;
            });
            return(dataTable);
        }