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_MU_bins : System.Web.UI.UserControl
{
///
/// Batch corrente...
///
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
///
/// Indica se mostrare o meno QRCode
///
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
///
/// restituisce URL immagine QRCode
///
///
///
public string getImgUrl(object currId)
{
string baseUrl = "https://qrcode.steamware.net/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();
}
///
/// Calcola il rapporto tra 2 valori
///
///
///
///
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;
}
///
/// determina CSS x colore testo da perc svuotamento...
///
///
///
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;
}
///
/// Dimensione QRCode
///
public int qrSize
{
get
{
int answ = 32;
int.TryParse(hfQrSize.Value, out answ);
return answ;
}
set
{
hfQrSize.Value = value.ToString();
doUpdate();
}
}
}
}