126 lines
3.6 KiB
C#
126 lines
3.6 KiB
C#
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_stackList : BaseUserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
checkVisibility();
|
|
}
|
|
}
|
|
|
|
private void checkVisibility()
|
|
{
|
|
divSelected.Visible = StackIdSel > 0;
|
|
grView.Visible = !divSelected.Visible;
|
|
// imposto css titolo...
|
|
string titleClass = "row mx-0";
|
|
if (divSelected.Visible)
|
|
{
|
|
titleClass += " table-info";
|
|
}
|
|
divTitle.Attributes.Remove("class");
|
|
divTitle.Attributes.Add("class", titleClass);
|
|
}
|
|
public int BatchId
|
|
{
|
|
set
|
|
{
|
|
hfBatchId.Value = value.ToString();
|
|
grView.DataBind();
|
|
}
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(hfBatchId.Value, out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
checkVisibility();
|
|
raiseEvent();
|
|
}
|
|
/// <summary>
|
|
/// comando reset
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtReset_Click(object sender, EventArgs e)
|
|
{
|
|
resetSelezione();
|
|
}
|
|
|
|
public void resetSelezione()
|
|
{
|
|
lblStack.Text = "";
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
checkVisibility();
|
|
raiseEvent();
|
|
}
|
|
/// <summary>
|
|
/// StackId selezionato
|
|
/// </summary>
|
|
public int StackIdSel
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
try
|
|
{
|
|
if (grView.SelectedValue != null)
|
|
{
|
|
int.TryParse(grView.SelectedValue.ToString(), out answ);
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
|
|
{
|
|
// recupero argomento = Takt...
|
|
try
|
|
{
|
|
string stack = e.CommandArgument.ToString();
|
|
lblStack.Text = stack;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
/// <summary>
|
|
/// Calcola il css x il blocco dato la condizione del num di sheets totali e preparati
|
|
/// </summary>
|
|
/// <param name="_numSheets"></param>
|
|
/// <param name="_numPrepared"></param>
|
|
/// <returns></returns>
|
|
public string cssByPrepared(object _numSheets, object _numPrepared)
|
|
{
|
|
string answ = "table-secondary border border-secondary border-thick rounded";
|
|
int numSheets = 0;
|
|
int numPrepared = 0;
|
|
int.TryParse(_numSheets.ToString(), out numSheets);
|
|
int.TryParse(_numPrepared.ToString(), out numPrepared);
|
|
if (numPrepared > 0)
|
|
{
|
|
if (numPrepared == numSheets)
|
|
{
|
|
answ = "table-success border border-success border-thick rounded";
|
|
}
|
|
else
|
|
{
|
|
answ = "table-primary flashColor rounded";
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
} |