From d0f1e2b02590705a3b033a817405ff60a543e544 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 6 Aug 2020 12:20:08 +0200 Subject: [PATCH] SecScreen: check for pdf only + log --- NKC_WF/WebUserControls/cmp_secScreen.ascx.cs | 39 +++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/NKC_WF/WebUserControls/cmp_secScreen.ascx.cs b/NKC_WF/WebUserControls/cmp_secScreen.ascx.cs index d0912f9..e6b444d 100644 --- a/NKC_WF/WebUserControls/cmp_secScreen.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_secScreen.ascx.cs @@ -163,15 +163,34 @@ namespace NKC_WF.WebUserControls } set { - // poiché è necessario copiare in locale il pdf... - string nameOnly = $"~/temp/{itemCode}.pdf"; - hfItemPdf.Value = nameOnly; - // svuoto files vecchi... - removeOldTemp(); - // copio in locale file... - File.Copy(value.Trim(), Server.MapPath(nameOnly)); - // update... - hlPdfOpener.NavigateUrl = nameOnly; + // check preliminare: deve essere un file ".pdf..." + if (value.Trim().EndsWith(".pdf")) + { + // poiché è necessario copiare in locale il pdf... + string nameOnly = $"~/temp/{itemCode}.pdf"; + hfItemPdf.Value = nameOnly; + // svuoto files vecchi... + removeOldTemp(); + try + { + // loggo che sto x copiare + logger.lg.scriviLog($"Requested copy from {value.Trim()} --> Server.MapPath(nameOnly)"); + // copio in locale file... + File.Copy(value.Trim(), Server.MapPath(nameOnly)); + } + catch (Exception exc) + { + string fullMessage = $"SecScreed: Exception on setPdfPath:{Environment.NewLine}{exc}"; + logger.lg.scriviLog(fullMessage); + } + // update... + hlPdfOpener.NavigateUrl = nameOnly; + } + else + { + string fullMessage = $"SecScreed: Error on pdfPath set value: [{value}]"; + logger.lg.scriviLog(fullMessage); + } } } @@ -217,7 +236,7 @@ namespace NKC_WF.WebUserControls { // valutato ma non usato pdf.js: // https://mozilla.github.io/pdf.js/examples/index.html#interactive-examples - + // se è variato da current... if (newDtmx != itemDtmx) {