Exemplo n.º 1
0
        public GetReportStatusResponse GetReportStatus(string platform, long id, int?userId)
        {
            var result = new GetReportStatusResponse();

            try
            {
                using (new RequestTimer(result))
                {
                    result.Data = _asyncReportGeneratorService.GetStatus(id);
                    if (result.Data.DateCompleted != null)
                    {
                        string fileName = string.Format(Configuration.Exports.FileNameFormat, id);
                        string fullName = Path.Combine(Configuration.Exports.FilePath, fileName);
                        result.FilePath = fullName;
                        result.FileName = fileName;
                    }
                }
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
                _logger.LogException(ex);
            }
            return(result);
        }
Exemplo n.º 2
0
        public GetReportStatusResponse GetReportStatus(string platform, long id, int?userId = null)
        {
            var result = new GetReportStatusResponse();

            try
            {
                // GET
                var apiRequest = CreateRequest(Method.GET, "{platform}/reports/{id}");
                apiRequest.AddUrlSegment("platform", platform);
                apiRequest.AddParameter("id", id, ParameterType.QueryString);
                if (userId != null)
                {
                    apiRequest.AddParameter("userid", userId, ParameterType.QueryString);
                }

                var response = Execute <GetReportStatusResponse>(apiRequest);
                return(response);
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
            }
            return(result);
        }