public virtual FileResult GetDocument(string docNum)
        {
            if (string.IsNullOrEmpty(docNum))
            {
                return(null);
            }
            try
            {
                var downloadResponse = _docManagementService.Download(new DownloadRequest
                {
                    DocumentNumber = docNum,
                    Library        = string.Empty,
                    Version        = string.Empty
                });

                if (!downloadResponse.IsValid)
                {
                    throw new Exception("The file could not be retrieved from IDBDocs.");
                }

                CommonDocument documentObject = new CommonDocument();
                var            contentType    = documentObject.GetContentType(downloadResponse.Document.FileName);
                return(File(downloadResponse.Document.File, contentType, downloadResponse.Document.FileName));
            }
            catch (Exception e)
            {
                Logger.GetLogger().WriteError(
                    "EvaluationTracking", "Error when get document Evaluation Tracking: ", e);
                throw;
            }
        }
Ejemplo n.º 2
0
        public virtual ActionResult GetDocument(DownloadRequest request)
        {
            try
            {
                var document = _docManagementService.Download(request);

                if (document == null)
                {
                    throw new Exception("The file could not be retrieved.");
                }

                CommonDocument documentObject = new CommonDocument();
                var            contentType    = documentObject.GetContentType(document.Document.FileName);
                return(File(document.Document.File, contentType, document.Document.FileName));
            }
            catch (Exception e)
            {
                Logger.GetLogger().WriteError(
                    "PMRPublicController", "Error when getting report: ", e);
                throw;
            }
        }