Files
NKC/NKC_WF/WebUserControls/cmp_MU_Items.ascx.cs
T
2020-08-07 13:31:46 +02:00

109 lines
2.8 KiB
C#

using SteamWare;
using System;
namespace NKC_WF.WebUserControls
{
public partial class cmp_MU_Items : System.Web.UI.UserControl
{
/// <summary>
/// Sheet corrente...
/// </summary>
public int SheetID
{
set
{
hfSheetID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfSheetID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
public string getImgUrl(object currId)
{
string baseUrl = $"{memLayer.ML.CRS("matrixUrl")}/HOME/QR_site/JSON?val=";
string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}";
string answ = $"{baseUrl}{payload}";
return answ;
}
protected void Page_Load(object sender, EventArgs e)
{
}
public void doUpdate()
{
grView.DataBind();
}
/// <summary>
/// Dimensione QRCode
/// </summary>
public int qrSize
{
get
{
int answ = 32;
int.TryParse(hfQrSize.Value, out answ);
return answ;
}
set
{
hfQrSize.Value = value.ToString();
doUpdate();
}
}
/// <summary>
/// Calcola css da statusID
/// </summary>
/// <param name="_statusID"></param>
/// <returns></returns>
public string cssByStatus(object _statusID)
{
string answ = "text-secondary";
int statusID = 0;
int.TryParse(_statusID.ToString(), out statusID);
switch (statusID)
{
case 1:
answ = "text-dark";
break;
case 2:
answ = "text-warning";
break;
case 3:
answ = "text-success";
break;
case 4:
answ = "text-info";
break;
default:
answ = "text-danger";
break;
}
return answ;
}
}
}