Files
NKC/NKC_WF/site/DBG_QRCode_Unload.aspx.cs
T
2020-08-07 13:31:46 +02:00

121 lines
3.3 KiB
C#

using AppData;
using SteamWare;
using System;
using System.Web.UI;
namespace NKC_WF.site
{
public partial class DBG_QRCode_Unload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
doUpdate();
}
}
/// <summary>
/// BatchId corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// SheetId corrente...
/// </summary>
public int SheetId
{
set
{
hfSheetID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfSheetID.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <returns></returns>
public string getLoginUrl()
{
string baseUrl = $"{memLayer.ML.CRS("matrixUrl")}/HOME/QR_site/JSON?val=";
string payload = "{'baseUrl':'{0}','parameters':['" + memLayer.ML.CRS("BaseUrl") + "']}";
string answ = $"{baseUrl}{payload}";
return answ;
}
protected int qrSize
{
get
{
int answ = 32;
int.TryParse(ddlQrSize.SelectedValue, out answ);
return answ;
}
}
/// <summary>
/// Aggiorna componente principale e child components
/// </summary>
private void doUpdate()
{
imgQrLogin.ImageUrl = getLoginUrl();
updateSize();
setCurrData();
// aggiorno child
cmp_MU_bins.ShowQr = true;
cmp_MU_bins.BatchId = BatchId;
cmp_MU_carts.ShowQr = true;
cmp_MU_carts.BatchId = BatchId;
cmp_MU_Items.ShowQr = true;
cmp_MU_Items.SheetID = SheetId;
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// </summary>
private void setCurrData()
{
// recupero bunk corrente...
DS_App.StackListRow currBunk = ComLib.getCurrBunk();
if (currBunk != null)
{
BatchId = currBunk.BatchID;
DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId);
if (currSheet != null)
{
SheetId = currSheet.SheetID;
}
}
}
protected void ddlQrSize_SelectedIndexChanged(object sender, EventArgs e)
{
updateSize();
}
private void updateSize()
{
imgQrLogin.Height = qrSize * 2;
cmp_MU_bins.qrSize = qrSize;
cmp_MU_carts.qrSize = qrSize;
cmp_MU_Items.qrSize = qrSize;
}
protected void timerRefresh_Tick(object sender, EventArgs e)
{
doUpdate();
}
}
}