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; } }
public virtual FileResult DownloadDocument(DownloadRequest request) { TimeSpan stop; TimeSpan start = new TimeSpan(DateTime.Now.Ticks); if (!string.IsNullOrWhiteSpace(request.DocumentNumber)) { var downloadResponse = _docManagementService.Download(request); if (!downloadResponse.IsValid) { return(File(downloadResponse.Document.File, MimeMapping.GetMimeMapping(downloadResponse.Document.FileName), downloadResponse.Document.FileName)); } } stop = new TimeSpan(DateTime.Now.Ticks); var resultado = stop.Subtract(start).Seconds; return(null); }
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; } }