/// <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.º 2
0
        public object Get(GetActivityLogs request)
        {
            DateTime?minDate = string.IsNullOrWhiteSpace(request.MinDate) ?
                               (DateTime?)null :
                               DateTime.Parse(request.MinDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();

            var filterFunc = new Func <IQueryable <ActivityLog>, IQueryable <ActivityLog> >(
                entries => entries.Where(entry => entry.DateCreated >= minDate));

            var result = _activityManager.GetPagedResult(filterFunc, request.StartIndex, request.Limit);

            return(ToOptimizedResult(result));
        }
Exemplo n.º 3
0
        public ActionResult <QueryResult <ActivityLogEntry> > GetLogEntries(
            [FromQuery] int?startIndex,
            [FromQuery] int?limit,
            [FromQuery] DateTime?minDate,
            [FromQuery] bool?hasUserId)
        {
            var filterFunc = new Func <IQueryable <ActivityLog>, IQueryable <ActivityLog> >(
                entries => entries.Where(entry => entry.DateCreated >= minDate &&
                                         (!hasUserId.HasValue || (hasUserId.Value
                                                      ? entry.UserId != Guid.Empty
                                                      : entry.UserId == Guid.Empty))));

            return(_activityManager.GetPagedResult(filterFunc, startIndex, limit));
        }