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

208 lines
5.3 KiB
C#

using SteamWare;
using System;
namespace NKC_WF.WebUserControls
{
public partial class cmp_paint_bins : System.Web.UI.UserControl
{
/// <summary>
/// Testo titolo...
/// </summary>
public string titleText
{
set
{
lblTitle.Text = value;
}
get
{
return lblTitle.Text;
}
}
/// <summary>
/// Classe css titolo...
/// </summary>
public string titleClass
{
set
{
lblTitle.CssClass = value;
}
get
{
return lblTitle.CssClass;
}
}
/// <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>
/// Indica se mostrare o meno BatchID
/// </summary>
public bool ShowBatch
{
set
{
hfShowBatch.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowBatch.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno BinDtmx
/// </summary>
public bool ShowBinDtmx
{
set
{
hfShowBinDtmx.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowBinDtmx.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>
/// Indica se mostrare o meno COMPLETED
/// </summary>
public bool ShowComplete
{
set
{
hfShowComplete.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowComplete.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno PAINTED
/// </summary>
public bool ShowPainted
{
set
{
hfShowPainted.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowPainted.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>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
public double getRatio(object _dividendo, object _divisore)
{
double ratio = 0;
double dividendo = 0;
double divisore = 1;
double.TryParse(_dividendo.ToString(), out dividendo);
double.TryParse(_divisore.ToString(), out divisore);
ratio = dividendo / divisore;
return ratio;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
public string getCssByRatio(double ratio)
{
string answ = "text-dark";
if (ratio == 0)
{
answ = "text-danger";
}
else if (ratio == 1)
{
answ = "text-success";
}
else
{
answ = "text-warning";
}
return answ;
}
/// <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();
}
}
}
}