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"; if (divSelected.Visible) { titleClass += " table-primary"; } divTitle.Attributes.Remove("class"); divTitle.Attributes.Add("class", titleClass); } /// /// Codice CSS in base a status... /// /// /// 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; } /// /// Converte il codice stato in effettivo campo /// /// /// public string BStatus(object _status) { string answ = ComLib.BatchStatusDescr(_status); return answ; } /// /// Converte il codice POSITION di un BATCH in traduzione /// /// /// public string BatchPositionStatus(object _status) { string answ = ComLib.PositionStatusDescr(_status); return answ; } /// /// comando reset /// /// /// protected void lbtReset_Click(object sender, EventArgs e) { resetSelezione(); } private void resetSelezione() { lblTakt.Text = ""; grView.SelectedIndex = -1; grView.DataBind(); checkVisibility(); raiseReset(); } /// /// BatchId selezionato /// 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 { } } /// /// Calcola il css x il blocco dato la positioj (logica) del TAKT /// /// /// 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; } } }