104 lines
2.5 KiB
C#
104 lines
2.5 KiB
C#
using AppData;
|
|
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_stats : System.Web.UI.UserControl
|
|
{
|
|
/// <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;
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
public void doUpdate()
|
|
{
|
|
|
|
// fix x BIN
|
|
cmp_MU_singleStatBin.BatchId = BatchId;
|
|
cmp_MU_singleStatBin.statLevel = (int)StatType.BIN;
|
|
cmp_MU_singleStatBin.titleCss = "bg-primary text-light";
|
|
|
|
|
|
// fix x BATCH
|
|
cmp_MU_singleStatBatch.BatchId = BatchId;
|
|
cmp_MU_singleStatBatch.statLevel = (int)StatType.BATCH;
|
|
cmp_MU_singleStatBatch.titleCss = "bg-info";
|
|
|
|
// fix x BUNK
|
|
cmp_MU_singleStatBunk.BatchId = BatchId;
|
|
cmp_MU_singleStatBunk.statLevel = (int)StatType.BUNK;
|
|
cmp_MU_singleStatBunk.titleCss = "bg-secondary text-light";
|
|
|
|
|
|
// fix x SHEET
|
|
cmp_MU_singleStatSheet.BatchId = BatchId;
|
|
cmp_MU_singleStatSheet.statLevel = (int)StatType.SHEET;
|
|
cmp_MU_singleStatSheet.titleCss = "bg-warning";
|
|
|
|
// fix x CART
|
|
cmp_MU_singleStatCart.BatchId = BatchId;
|
|
cmp_MU_singleStatCart.statLevel = (int)StatType.CART;
|
|
cmp_MU_singleStatCart.titleCss = "bg-success";
|
|
|
|
}
|
|
/// <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;
|
|
}
|
|
}
|
|
} |