using AppData;
using NKC_SDK;
using NKC_WF.Controllers;
using SteamWare;
using System;
using System.Collections.Generic;
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;
doUpdate();
}
}
public int currNum
{
get
{
int answ = 0;
int.TryParse(hfNum.Value, out answ);
return answ;
}
set
{
hfNum.Value = $"{value:000000}";
}
}
public bool showMode
{
get
{
bool answ = false;
bool.TryParse(hfShowMode.Value, out answ);
return answ;
}
set
{
hfShowMode.Value =value.ToString();
}
}
///
/// restituisce URL immagine QRCode
///
///
public string getLoginUrl()
{
string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val=";
string codSSC = $"SSC{currNum:000000}";
string payload = "{'baseUrl':'{0}','parameters':['" + codSSC + "']}";
//string payload = "{'baseUrl':'{0}','parameters':['" + memLayer.ML.CRS("BaseUrl") + "']}";
string answ = $"{baseUrl}{payload}";
return answ;
}
///
/// Aggiorna componente principale e child components
///
public void doUpdate()
{
// recupero numero
currNum = ComLib.getSecScreenCode();
// genero nuovo QR
string qrUrl = getLoginUrl();
imgQrMain.Visible = showMode;
imgQrSmall.Visible = !showMode;
if (showMode)
{
imgQrMain.ImageUrl = qrUrl;
}
else
{
imgQrSmall.ImageUrl = qrUrl;
}
}
}
}