166 lines
4.0 KiB
C#
166 lines
4.0 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_taktList : BaseUserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if(!Page.IsPostBack)
|
|
{
|
|
checkVisibility();
|
|
}
|
|
}
|
|
|
|
private void checkVisibility()
|
|
{
|
|
divSelected.Visible = BatchIdSel > 0;
|
|
grView.Visible = !divSelected.Visible;
|
|
// imposto css titolo...
|
|
string titleClass = "row font-weight-bold";
|
|
if(divSelected.Visible)
|
|
{
|
|
titleClass += " table-primary";
|
|
}
|
|
divTitle.Attributes.Remove("class");
|
|
divTitle.Attributes.Add("class", titleClass);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Codice CSS in base a status...
|
|
/// </summary>
|
|
/// <param name="_status"></param>
|
|
/// <returns></returns>
|
|
public string cssByStatus(object _status)
|
|
{
|
|
string answ = "text-muted";
|
|
int status = -1;
|
|
int.TryParse(_status.ToString(), out status);
|
|
switch (status)
|
|
{
|
|
case 1:
|
|
answ = "font-weight-bold text-info";
|
|
break;
|
|
case 2:
|
|
answ = "font-weight-bold text-primary";
|
|
break;
|
|
case 3:
|
|
answ = "font-weight-bold text-warning";
|
|
break;
|
|
case 4:
|
|
answ = "font-weight-bold text-danger";
|
|
break;
|
|
case 5:
|
|
answ = "font-weight-bold text-success";
|
|
break;
|
|
case 6:
|
|
answ = "font-weight-bold text-secondary";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// Converte il codice stato in effettivo campo
|
|
/// </summary>
|
|
/// <param name="_status"></param>
|
|
/// <returns></returns>
|
|
public string BStatus(object _status)
|
|
{
|
|
string answ = ComLib.BatchStatusDescr(_status);
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// Converte il codice POSITION in effettivo campo
|
|
/// </summary>
|
|
/// <param name="_status"></param>
|
|
/// <returns></returns>
|
|
public string PStatus(object _status)
|
|
{
|
|
string answ = ComLib.PositionStatusDescr(_status);
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// comando reset
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtReset_Click(object sender, EventArgs e)
|
|
{
|
|
resetSelezione();
|
|
}
|
|
|
|
private void resetSelezione()
|
|
{
|
|
lblTakt.Text = "";
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
checkVisibility();
|
|
raiseReset();
|
|
}
|
|
/// <summary>
|
|
/// BatchId selezionato
|
|
/// </summary>
|
|
public int BatchIdSel
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
try
|
|
{
|
|
int.TryParse(grView.SelectedValue.ToString(), out answ);
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
checkVisibility();
|
|
raiseEvent();
|
|
}
|
|
|
|
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
|
|
{
|
|
// recupero argomento = Takt...
|
|
try
|
|
{
|
|
string takt = e.CommandArgument.ToString();
|
|
lblTakt.Text = takt;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
/// <summary>
|
|
/// Calcola il css x il blocco dato la positioj (logica) del TAKT
|
|
/// </summary>
|
|
/// <param name="_Position"></param>
|
|
/// <returns></returns>
|
|
public string cssByPosition(object _Position)
|
|
{
|
|
string answ = "table-secondary border border-secondary border-thick rounded";
|
|
int Position = 0;
|
|
int.TryParse(_Position.ToString(), out Position);
|
|
switch (Position)
|
|
{
|
|
case 1:
|
|
answ = "table-primary flashColor rounded";
|
|
break;
|
|
case 2:
|
|
answ = "table-success border border-success border-thick rounded";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
} |