using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SteamWare; using XPS_data; namespace XPST.WebUserControls { public partial class mod_btnComandi : System.Web.UI.UserControl { /// /// evento comando clicked /// public event EventHandler eh_clickComando; protected void Page_Load(object sender, EventArgs e) { setupComandiBarcode(); disegnaBtn(); } /// /// effettua disegno dei buttons /// private void disegnaBtn() { // carico i comandi nei buttons btn1.Text = comandiAmmessi["04"]; btn2.Text = comandiAmmessi["05"]; btn3.Text = comandiAmmessi["06"]; btn5.Text = comandiAmmessi["ok"]; btn6.Text = comandiAmmessi["ko"]; } /// /// carico da tab i comandi ammessi per il barcode... /// private void setupComandiBarcode() { XPS_data.DS_applicazioneTableAdapters.TraEv2StatiTableAdapter taTrEv2St = new XPS_data.DS_applicazioneTableAdapters.TraEv2StatiTableAdapter(); DS_applicazione.TraEv2StatiDataTable _tabTran = taTrEv2St.getByCodMappa("E_BC"); Dictionary comandi = new Dictionary(); foreach (DS_applicazione.TraEv2StatiRow riga in _tabTran) { comandi.Add(riga.CodEvento, user_std.UtSn.Traduci(riga.text2show)); } // impongo i comandi al barcode... comandiAmmessi = comandi; } /// /// dictionary comandi ammessi /// protected Dictionary _comandi = new Dictionary(); /// /// elenco dei comandi riconosciuti /// public Dictionary comandiAmmessi { get { return _comandi; } set { _comandi = value; } } /// /// segnala click su button comando /// public void segnalaClick() { if (eh_clickComando != null) { eh_clickComando(this, new EventArgs()); } } protected void btn1_Click(object sender, EventArgs e) { memLayer.ML.setSessionVal("btnCmdPress", "04", false); segnalaClick(); } protected void btn2_Click(object sender, EventArgs e) { memLayer.ML.setSessionVal("btnCmdPress", "05", false); segnalaClick(); } protected void btn3_Click(object sender, EventArgs e) { memLayer.ML.setSessionVal("btnCmdPress", "06", false); segnalaClick(); } protected void btn4_Click(object sender, EventArgs e) { } protected void btn5_Click(object sender, EventArgs e) { memLayer.ML.setSessionVal("btnCmdPress", "ok", false); segnalaClick(); } protected void btn6_Click(object sender, EventArgs e) { memLayer.ML.setSessionVal("btnCmdPress", "ko", false); segnalaClick(); } } }