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_batchDetail : System.Web.UI.UserControl { public event EventHandler eh_doRefresh; protected void Page_Load(object sender, EventArgs e) { } public int BatchId { set { hfBatchId.Value = value.ToString(); frmView.DataBind(); } get { int answ = 0; int.TryParse(hfBatchId.Value, out answ); return answ; } } public bool isNested(object _status) { bool answ = true; int status = -1; int.TryParse(_status.ToString(), out status); switch (status) { case 0: case 1: answ = false; break; default: break; } return answ; } /// /// Controlla se lo stato sia uguale a quello richiesto /// /// /// /// public bool checkStatus(object _status, ComLib.BatchStatus statusReq) { bool answ = false; int status = -1; int.TryParse(_status.ToString(), out status); answ = (status == (int)statusReq); return answ; } /// /// Converte il codice stato in effettivo campo /// /// /// public string BStatus(object _status) { string answ = ComLib.BatchStatusDescr(_status); return answ; } protected void lbtAccept_Click(object sender, EventArgs e) { // registro accettazione Nesting DataLayer.man.taBL.acceptBatch(BatchId, DataLayer.man.CodSoggCurrUser); raiseEvent(); } protected void lbtStopNesting_Click(object sender, EventArgs e) { // !!!FIXME!!! inviare a redis... // registro su DB nesting iniziato... DataLayer.man.taBL.updateStatus(BatchId, (int)ComLib.BatchStatus.Imported); raiseEvent(); } protected void lbtSendNesting_Click(object sender, EventArgs e) { // !!!FIXME!!! inviare a redis... // registro su DB nesting iniziato... DataLayer.man.taBL.updateStatus(BatchId, (int)ComLib.BatchStatus.NestRequested); raiseEvent(); } private void raiseEvent() { // se qualcuno ascolta sollevo evento nuovo valore... if (eh_doRefresh != null) { eh_doRefresh(this, new EventArgs()); } } } }