Files
NKC/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx.cs
T
2020-01-21 16:25:27 +01:00

84 lines
2.0 KiB
C#

using AppData;
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_MU_svgViewer : System.Web.UI.UserControl
{
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Foglio corrente...
/// </summary>
public int SheetId
{
set
{
hfSheetId.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfSheetId.Value, out answ);
return answ;
}
}
public void doUpdate()
{
// recupero ID del foglio corrente
string answ = "";
string filename = "";
try
{
// FORSE 5/5?!?
var sheetList = DataLayer.man.taSHL.getByMLStatus(BatchId, 3, 5);
if (sheetList.Count > 0)
{
SheetId = sheetList[0].SheetID;
// lo leggo da file
string baseOrig = memLayer.ML.CRS("drawBaseBath").ToLower();
string baseCurr = memLayer.ML.CRS("srvDrawBaseBath").ToLower();
filename = sheetList[0].DrawFilePath.ToLower().Replace(baseOrig, baseCurr);
// NON DOVREBEB SERVIRE MAP se è già share di rete... anche se è su MEDESIMA macchina
//filename = Server.MapPath(filename);
answ = File.ReadAllText(filename);
}
}
catch
{ }
if (answ == "")
{
// 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)
{
}
}
}