Exemplo n.º 1
0
        public async Task <ApiResponse <ReportExporterResponse> > GenerateReportAsync(
            ReportConfiguration reportConfiguration)
        {
            try
            {
                var reportGeneratorRequest = new ReportGeneratorRequest()
                {
                    ProjectId = reportConfiguration.ProjectId,
                    UserId    = reportConfiguration.UserId,
                };
                var apiResponse = await _workLogClientService.GetUserActivities(reportGeneratorRequest);

                if (!apiResponse.IsSuccess)
                {
                    return(apiResponse.ToFailed <ReportExporterResponse>());
                }

                var reportExportFile =
                    _reportExporter.GenerateReportForExport(apiResponse.Data, reportConfiguration.ReportFormatType);
                return(new ApiResponse <ReportExporterResponse>(reportExportFile));
            }
            catch (Exception e)
            {
                _logger.LogError(e, "");
                return(ApiResponse <ReportExporterResponse> .InternalError());
            }
        }
        public async Task <ApiResponse <ReportExporterResponse> > GenerateReportAsync(ReportConfiguration reportConfiguration)
        {
            var reportGeneratorRequest = new ReportGeneratorRequest()
            {
                ProjectId = reportConfiguration.ReportParameters.ProjectId,
                UserId    = reportConfiguration.ReportParameters.UserId,
            };
            var apiResponse = await _workLogClientService.GetUserActivities(reportGeneratorRequest);

            if (!apiResponse.IsSuccess)
            {
                return(apiResponse.ToFailed <ReportExporterResponse>());
            }
            var reportExportFile = _reportExporter.GenerateReportForExport(apiResponse.Data, reportConfiguration.ReportFormatType);

            return(new ApiResponse <ReportExporterResponse>(reportExportFile));
        }