0df7a2cd81
Aggiunta api alive x cancellazione vecchi dati redis e mongoDB
102 lines
3.1 KiB
C#
102 lines
3.1 KiB
C#
using AppData;
|
|
using NKC_SDK;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_svgFull : BaseUserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if(!Page.IsPostBack)
|
|
{
|
|
filename = "../images/test.svg";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Foglio corrente...
|
|
/// </summary>
|
|
public int SheetId
|
|
{
|
|
set
|
|
{
|
|
hfSheetId.Value = value.ToString();
|
|
updateSvg();
|
|
}
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(hfSheetId.Value, out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Percorso file calcolato
|
|
/// </summary>
|
|
public string filename
|
|
{
|
|
get
|
|
{
|
|
return hfFilename.Value;
|
|
}
|
|
set
|
|
{
|
|
hfFilename.Value = value;
|
|
}
|
|
}
|
|
public void updateSvg()
|
|
{
|
|
// recupero ID del foglio corrente
|
|
string answ = "";
|
|
string baseOrig = memLayer.ML.CRS("nestBasePath").ToLower();
|
|
string baseCurr = memLayer.ML.CRS("servBasePath").ToLower();
|
|
try
|
|
{
|
|
if (SheetId > 0)
|
|
{
|
|
var tabSheets = DLMan.taSHL.getBySheetId(SheetId, "");
|
|
if (tabSheets.Count > 0)
|
|
{
|
|
filename = tabSheets[0].DrawFilePath.ToLower().Replace(baseOrig, baseCurr);
|
|
// la versioen da usare è la "_qr.svg", x cui faccio replace... tolgo ultimi 4 char e sostituisco...
|
|
int repPos = filename.LastIndexOf(".svg");
|
|
filename = filename.Remove(repPos) + "_qr.svg";
|
|
if (memLayer.ML.CRB("userVirtDir"))
|
|
{
|
|
filename = Server.MapPath(filename);
|
|
}
|
|
answ = File.ReadAllText(filename);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (File.Exists(filename))
|
|
{
|
|
answ = File.ReadAllText(filename);
|
|
}
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
if (string.IsNullOrEmpty(answ))
|
|
{
|
|
// loggo...
|
|
Log.Instance.Info($"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");
|
|
//filename = Server.MapPath("~/Images/NoData.svg");
|
|
answ = File.ReadAllText(filename);
|
|
}
|
|
// update componente svg!
|
|
svgTable.InnerHtml = answ;
|
|
}
|
|
}
|
|
} |