using AppData; using SteamWare; using System; using System.Web.UI.WebControls; namespace C_TRACK.WebUserControls { public partial class mod_btnComandi : BaseUserControl { /// /// Codice TASK corrente /// public string CurrNumTask { get { return memLayer.ML.StringSessionObj("CurrNumTask"); } set { memLayer.ML.setSessionVal("CurrNumTask", value); } } /// /// evento comando clicked /// public event EventHandler eh_clickComando; protected void Page_Load(object sender, EventArgs e) { updateBtn(); } /// /// segnala click su button comando /// public void segnalaClick() { eh_clickComando?.Invoke(this, new EventArgs()); } protected void lbtCmd_Click(object sender, EventArgs e) { // PROCEDO SOLO SE non ho veto... if (!hasVeto) { LinkButton lb = (LinkButton)sender; memLayer.ML.setSessionVal("btnCmdPress", lb.CommandArgument, false); segnalaClick(); } else { updateBtn(); } } public void updateBtn() { // verifico se ho comandi PREVALENTI (es: ho UNA FASE APERTA) if (mUtils.CodOpr != "") { var tabTR = DLMan.taTR.getAttiveByOpr(mUtils.CodOpr); if (tabTR.Rows.Count > 0) { // se NON HO una commessa attiva, SELEZIONO la PRIMA commessa aperta... if (CurrNumTask == "") { CurrNumTask = tabTR[0].NumTask; } } } // controllo se HO una fase corrente... repComandi.Visible = !hasVeto; if (!hasVeto) { // altrimenti imposto fasi da postazione... repComandi.DataBind(); } } /// /// Verifica btn siano abilitati e nel caso x css aggiunge DISABLED /// - ho una commessa /// - la commessa NON E' chiusa... /// public string datiCommessa { get { string answ = ""; // controllos e ho in sessione numTask altrimenti NON E' abilitato... if (CurrNumTask == "") { // se NON E' multi if (mUtils.postIsMulti) { answ = "<-- Gestione commesse"; } else { answ = "Manca Commessa"; } } else { answ = hasVeto ? "Commessa Chiusa: " + CurrNumTask.ToString() : ""; } return answ; } } /// /// Verifica se la commessa sia assente/chiusa /// public bool hasVeto { get { bool answ = false; bool noTask = CurrNumTask == ""; bool isChiuso = false; try { isChiuso = DLMan.taTL.getByKey(CurrNumTask)[0].Concluso; } catch { } // controllos e ho in sessione numTask altrimenti NON E' abilitato... answ = noTask || isChiuso; return answ; } } /// /// Verifica btn siano abilitati e nel caso x css aggiunge DISABLED /// - ho una commessa /// - la commessa NON E' chiusa... /// public string cssEnabled { get { string answ = ""; // controllos e ho in sessione numTask altrimenti NON E' abilitato... answ = hasVeto ? "disabled" : ""; return answ; } } } }