示例#1
0
        /// <summary> Gets the given request. </summary>
        /// <param name="request"> The request. </param>
        /// <returns> A Task&lt;object&gt; </returns>
        public async Task<object> Get(GetReportStatistics request)
        {
            if (string.IsNullOrEmpty(request.IncludeItemTypes))
                return null;
            request.DisplayType = "Screen";
            var reportResult = await GetReportStatistic(request);

            return ToOptimizedResult(reportResult);
        }
示例#2
0
        /// <summary> Gets report statistic. </summary>
        /// <param name="request"> The request. </param>
        /// <returns> The report statistic. </returns>
        private async Task<ReportStatResult> GetReportStatistic(GetReportStatistics request)
        {
            ReportIncludeItemTypes reportRowType = ReportHelper.GetRowType(request.IncludeItemTypes);
            QueryResult<BaseItem> queryResult = await GetQueryResult(request).ConfigureAwait(false);

            ReportStatBuilder reportBuilder = new ReportStatBuilder(_libraryManager);
            ReportStatResult reportResult = reportBuilder.GetResult(queryResult.Items, ReportHelper.GetRowType(request.IncludeItemTypes), request.TopItems ?? 5);
            reportResult.TotalRecordCount = reportResult.Groups.Count();
            return reportResult;
        }
示例#3
0
        /// <summary> Gets the given request. </summary>
        /// <param name="request"> The request. </param>
        /// <returns> A Task&lt;object&gt; </returns>
        public async Task<object> Get(GetReportStatistics request)
        {
            if (string.IsNullOrEmpty(request.IncludeItemTypes))
                return null;
            request.DisplayType = "Screen";
            var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
            var reportResult = await GetReportStatistic(request, user);

            return ToOptimizedResult(reportResult);
        }