using AppData; using SteamWare; using System; using System.IO; using System.Web.UI; namespace NKC_WF.WebUserControls { public partial class cmp_MU_svgViewer : BaseUserControl { /// /// BatchId corrente... /// public int BatchId { set { if (hfBatchId.Value != value.ToString()) { hfBatchId.Value = value.ToString(); } } get { int answ = 0; int.TryParse(hfBatchId.Value, out answ); return answ; } } /// /// Foglio corrente... /// public int SheetId { set { if (hfSheetId.Value != value.ToString()) { hfSheetId.Value = value.ToString(); } } get { int answ = 0; int.TryParse(hfSheetId.Value, out answ); return answ; } } /// /// Percorso file calcolato /// public string filename { get { return hfFilename.Value; } set { hfFilename.Value = value; } } public void doUpdate() { // recupero ID del foglio corrente string answ = ""; string baseOrig = memLayer.ML.CRS("nestBasePath").ToLower(); string baseCurr = memLayer.ML.CRS("servBasePath").ToLower(); try { var tabSheets = DataLayer.man.taSHL.getBySheetId(SheetId); if (tabSheets.Count > 0) { filename = tabSheets[0].DrawFilePath.ToLower().Replace(baseOrig, baseCurr); if (memLayer.ML.CRB("userVirtDir")) { filename = Server.MapPath(filename); } answ = File.ReadAllText(filename); } } catch { } if (string.IsNullOrEmpty(answ)) { // loggo... logger.lg.scriviLog($"SVG not found | filename: {filename} | baseOrig: {baseOrig} | baseCurr: {baseCurr} | used default SVG"); // leggo SVG DI DEFAULT che indica NON PRESENTE... filename = Server.MapPath("~/Images/NoData.svg"); answ = File.ReadAllText(filename); } // update componente svg! svgTable.InnerHtml = answ; } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // scrivo valore revisione batch! hfCurrBunkRev.Value = ComLib.getSheetRevByBunk(BatchId).ToString(); } } } }