Exemplo n.º 1
0
        /// <summary> Gets report activities. </summary>
        /// <param name="request"> The request. </param>
        /// <returns> The report activities. </returns>
        private Task <ReportResult> GetReportActivities(IReportsDownload request)
        {
            return(Task <ReportResult> .Run(() =>
            {
                DateTime?minDate = string.IsNullOrWhiteSpace(request.MinDate) ?
                                   (DateTime?)null :
                                   DateTime.Parse(request.MinDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();

                QueryResult <ActivityLogEntry> queryResult;
                if (request.HasQueryLimit)
                {
                    queryResult = _repo.GetActivityLogEntries(minDate, request.StartIndex, request.Limit);
                }
                else
                {
                    queryResult = _repo.GetActivityLogEntries(minDate, request.StartIndex, null);
                }
                //var queryResult = _activityManager.GetActivityLogEntries(minDate, request.StartIndex, request.Limit);

                ReportActivitiesBuilder builder = new ReportActivitiesBuilder(_libraryManager, _userManager);
                var result = builder.GetResult(queryResult, request);
                result.TotalRecordCount = queryResult.TotalRecordCount;
                return result;
            }));
        }
        /// <summary> Gets report activities. </summary>
        /// <param name="request"> The request. </param>
        /// <returns> The report activities. </returns>
        private async Task <ReportResult> GetReportActivities(IReportsDownload request)
        {
            var activityLogQuery = new ActivityLogQuery
            {
                StartIndex = request.StartIndex,
                Limit      = request.HasQueryLimit ? request.Limit : null
            };

            var queryResult = await _activityManager.GetPagedResultAsync(activityLogQuery).ConfigureAwait(false);

            ReportActivitiesBuilder builder = new ReportActivitiesBuilder(_libraryManager, _userManager);
            var result = builder.GetResult(queryResult, request);

            result.TotalRecordCount = queryResult.TotalRecordCount;
            return(result);
        }
        /// <summary> Gets report activities. </summary>
        /// <param name="request"> The request. </param>
        /// <returns> The report activities. </returns>
        private ReportResult GetReportActivities(IReportsDownload request)
        {
            QueryResult <ActivityLogEntry> queryResult;

            if (request.HasQueryLimit)
            {
                queryResult = _activityManager.GetPagedResult(request.StartIndex, request.Limit);
            }
            else
            {
                queryResult = _activityManager.GetPagedResult(request.StartIndex, null);
            }

            ReportActivitiesBuilder builder = new ReportActivitiesBuilder(_libraryManager, _userManager);
            var result = builder.GetResult(queryResult, request);

            result.TotalRecordCount = queryResult.TotalRecordCount;
            return(result);
        }
Exemplo n.º 4
0
        /// <summary> Gets report activities. </summary>
        /// <param name="request"> The request. </param>
        /// <returns> The report activities. </returns>
        private Task<ReportResult> GetReportActivities(IReportsDownload request)
        {
            return Task<ReportResult>.Run(() =>
            {
                DateTime? minDate = string.IsNullOrWhiteSpace(request.MinDate) ?
                (DateTime?)null :
                DateTime.Parse(request.MinDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();

                QueryResult<ActivityLogEntry> queryResult;
                 if (request.HasQueryLimit)   
                   queryResult = _repo.GetActivityLogEntries(minDate, request.StartIndex, request.Limit);
                 else
                     queryResult = _repo.GetActivityLogEntries(minDate, request.StartIndex, null);
                //var queryResult = _activityManager.GetActivityLogEntries(minDate, request.StartIndex, request.Limit);

                ReportActivitiesBuilder builder = new ReportActivitiesBuilder(_libraryManager, _userManager);
                var result = builder.GetResult(queryResult, request);
                result.TotalRecordCount = queryResult.TotalRecordCount;
                return result;

            });

        }