135 lines
3.4 KiB
C#
135 lines
3.4 KiB
C#
using AppData;
|
|
using NKC_SDK;
|
|
using NKC_WF.Controllers;
|
|
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_secScreen : BaseUserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
showMode = true;
|
|
// recupero numero
|
|
currNum = ComLib.getSecScreenCode();
|
|
doUpdate();
|
|
pdfPath = "../temp/119752.pdf";
|
|
SheetId = 999999999;
|
|
}
|
|
}
|
|
|
|
public int currNum
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(hfNum.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfNum.Value = $"{value:000000}";
|
|
}
|
|
}
|
|
public int SheetId
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(hfSheetId.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfSheetId.Value = $"{value}";
|
|
hlShowCurrSheet.NavigateUrl = $"~/site/SvgFull?sheetId={value}";
|
|
}
|
|
}
|
|
public bool showMode
|
|
{
|
|
get
|
|
{
|
|
bool answ = false;
|
|
bool.TryParse(hfShowMode.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfShowMode.Value = value.ToString();
|
|
}
|
|
}
|
|
public string pdfPath
|
|
{
|
|
get
|
|
{
|
|
return lblPdf.Text;
|
|
}
|
|
set
|
|
{
|
|
// FIXME TODO necessario copiare in locale il pdf?
|
|
|
|
lblPdf.Text = value.Trim();
|
|
hlPdfOpener.NavigateUrl = value.Trim();
|
|
}
|
|
}
|
|
protected string codSSC
|
|
{
|
|
get
|
|
{
|
|
return $"SSC{currNum:000000}";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// restituisce URL immagine QRCode
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string getImageUrl()
|
|
{
|
|
string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val=";
|
|
string payload = "{'baseUrl':'{0}','parameters':['" + codSSC + "']}";
|
|
string answ = $"{baseUrl}{payload}";
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Aggiorna componente principale e child components
|
|
/// </summary>
|
|
public void doUpdate()
|
|
{
|
|
// genero nuovo QR
|
|
string qrUrl = getImageUrl();
|
|
divImg.Visible = showMode;
|
|
canvasPdf.Visible = !showMode;
|
|
imgQrSmall.Visible = !showMode;
|
|
// fix img!
|
|
if (showMode)
|
|
{
|
|
imgQrMain.ImageUrl = qrUrl;
|
|
}
|
|
else
|
|
{
|
|
imgQrSmall.ImageUrl = qrUrl;
|
|
}
|
|
}
|
|
|
|
protected void lbtScambia_Click(object sender, EventArgs e)
|
|
{
|
|
// valutato ma non usato pdf.js:
|
|
// https://mozilla.github.io/pdf.js/examples/index.html#interactive-examples
|
|
pdfPath = ComLib.getSecScreenRequest(codSSC);
|
|
showMode = !showMode;
|
|
doUpdate();
|
|
}
|
|
|
|
|
|
}
|
|
} |