From 4848e25995a75c45dd00647dc80ab0bb3e4fd202 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 15 Mar 2018 09:12:27 +0100 Subject: [PATCH] Update gestione disegni (mostra se sono esistenti) + fix gitignore --- .gitignore | 3 +- MP-Tablet/Web.config | 2 + .../WebUserControls/mod_dettMacchina.ascx.cs | 40 ++++++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 67832f33..7fda704b 100644 --- a/.gitignore +++ b/.gitignore @@ -62,7 +62,8 @@ MP/logs/*.zip /MP-Tablet/obj/* /MP-Tablet/WebCharts/*.png /MP-Tablet/images/macchine/*.* - +/MP-Tablet/Files/Disegni/*.pdf +!/MP-Tablet/Files/Disegni/ND.pdf #-------------------------------- # Area MoonPro diff --git a/MP-Tablet/Web.config b/MP-Tablet/Web.config index 1854a51b..4e96bed9 100644 --- a/MP-Tablet/Web.config +++ b/MP-Tablet/Web.config @@ -52,6 +52,8 @@ + + diff --git a/MP-Tablet/WebUserControls/mod_dettMacchina.ascx.cs b/MP-Tablet/WebUserControls/mod_dettMacchina.ascx.cs index 9039a394..3bdf117b 100644 --- a/MP-Tablet/WebUserControls/mod_dettMacchina.ascx.cs +++ b/MP-Tablet/WebUserControls/mod_dettMacchina.ascx.cs @@ -134,12 +134,48 @@ namespace MoonProTablet.WebUserControls public string urlDisegno(object _codArticolo) { // default รจ ND... - string answ= "~/Files/Disegni/ND.pdf"; + string answ = "~/Files/Disegni/ND.pdf"; // recupero da anagrafica articoli... try { DS_ProdTempi.AnagArticoliRow riga = DataLayer.obj.taAnagArt.getByCod(_codArticolo.ToString())[0]; - answ = string.Format("~/Files/Disegni/{0}.pdf", riga.Disegno); + // se disegno presente... + if (docPresente(riga.Disegno)) + { + answ = string.Format("~/Files/Disegni/{0}.pdf", riga.Disegno); + } + } + catch + { } + return answ; + } + + + /// + /// path completo documento su filesystem + /// + /// Nome disegno + /// + protected string docFilePath(string Disegno) + { + string answ = ""; + answ = string.Format(memLayer.ML.confReadString("urlDisegni"), Disegno); + // rimetto ".pdf" finale se non ci fosse... + if (answ.IndexOf(".pdf") < 0) Disegno += ".pdf"; + // tolgo eventuale "~/" iniziale + answ = answ.Replace("~/", ""); + return answ; + } + /// + /// verifica se il documento sia presente + /// + public bool docPresente(string Disegno) + { + bool answ = false; + try + { + fileMover.obj.setDirectory(""); + answ = fileMover.obj.fileExist(docFilePath(Disegno)); } catch { }