using SteamWare; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace MoonProTablet.WebUserControls { public partial class cmp_goPrint : BaseUserControl { #region Protected Properties protected int MatrOpr { get { return memLayer.ML.IntSessionObj("MatrOpr"); } } protected int QtaUdc { get { int answ = 1; string codGrp = "IMB"; string codVal = "NUM_PZ_CONT"; // recupero dato da scheda tecnica della quantità per UDC var tabSTAR = DataLayerObj.taSTAR.getByGrpOdlLbl(codGrp, codVal, idxOdl); if (tabSTAR.Rows.Count > 0) { try { int.TryParse(tabSTAR[0].Value, out answ); } catch { } } return answ; } } protected string UserAuthKey { get { //cerco in sessione... string answ = memLayer.ML.StringSessionObj("UserAuthKey"); // se non trovo --> db if (string.IsNullOrEmpty(answ)) { var tabOpr = DataLayerObj.taOp.getByMatrOpr(MatrOpr); if (tabOpr.Rows.Count > 0) { answ = tabOpr[0].authKey; } } return answ; } } #endregion Protected Properties #region Protected Methods protected void Page_Load(object sender, EventArgs e) { // se abilitata stampa sistema il link di navigazione if (!Page.IsPostBack) { updateOdl(); var currUrl = Request.Url; string UrlTabJumpMag = memLayer.ML.cdv("UrlTabJumpMag"); if (string.IsNullOrEmpty(UrlTabJumpMag)) { UrlTabJumpMag = "MP/MAG/jumper"; } // compongo url come shcema + authority + jumpAddr + query params hlMagPrint.NavigateUrl = $"{currUrl.Scheme}://{currUrl.Authority}/{UrlTabJumpMag}?MatrOpr={MatrOpr}&UserAuthKey={UserAuthKey}&IdxOdl={idxOdl}&IdxMacchina={idxMacchina}&QtaUdc={QtaUdc}"; } } /// /// ODL correntemente sulla macchina /// - cerca in Redis (TTL 5 sec) /// - altrimenti recupera da DB... /// protected void updateOdl() { // userò ODL del turno int answ = 0; // cerco da redis... int.TryParse(DataLayerObj.currODL(idxMacchinaSel, true), out answ); // salvo! idxOdl = answ; } #endregion Protected Methods } }