using AppData; using SteamWare; using System; using System.Linq; using System.Web.UI; namespace C_TRACK.WebUserControls { public partial class mod_menuTopCompact : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { string lastPage = Request.Url.LocalPath.Split('/').Last(); if (!Page.IsPostBack) { // fix visibilità TASK hlTask.Visible = devicesAuthProxy.stObj.userHasRight("CT_userStart"); hlReset.Visible = false; // se l'utente NON c'è torno a login... if (!devicesAuthProxy.stObj.isAuth) { if (lastPage != "" && lastPage != "login") { Session["nextPage"] = lastPage; } // SE non sono in "safe page" if (memLayer.ML.CRS("_loginPages").ToLower().IndexOf(lastPage.ToLower()) < 0) { Response.Redirect("~/login"); } } else { PagCorrente(); // leggo da conf SE mostrare logout... hlReset.Visible = memLayer.ML.CRB("enableLogOut"); } } // controllo pagina... bool pageAuth = devicesAuthProxy.stObj.isPageEnabled(lastPage); // controllo pag auth... if (!pageAuth && memLayer.ML.confReadString("_safePages").ToLower().IndexOf(lastPage.ToLower()) < 0) { Response.Redirect("~/login"); } lblTitolo.Text = memLayer.ML.CRS("appName"); } /// /// salva in variabile pagina il nome della pagina corrente /// protected void PagCorrente() { string[] uri = Request.Url.LocalPath.Split('/'); // salvo pagina corrente devicesAuthProxy.pagCorrente = uri.Last(); if (devicesAuthProxy.pagPrecedente == "") { devicesAuthProxy.pagPrecedente = devicesAuthProxy.pagCorrente; } } /// /// Codice TASK corrente /// public string CurrNumTask { get { return memLayer.ML.StringSessionObj("CurrNumTask"); } } /// /// Codice ART corrente /// public string CurrCodArt { get { return memLayer.ML.StringSessionObj("CurrCodArt"); } } /// /// Codice postazione di lavoro /// public string DescPost { get { string answ = ""; if (memLayer.ML.isInSessionObject("DescPost")) { answ = memLayer.ML.StringSessionObj("DescPost"); } if (answ == "") { var tabPost = dataLayer.man.taAP.getByKey(mUtils.CodPost); if (tabPost.Rows.Count > 0) { answ = tabPost[0].Descrizione; } memLayer.ML.setSessionVal("DescPost", answ); } return answ; } } /// /// Codice Operatore /// public string NomeOpr { get { string answ = ""; if (memLayer.ML.isInSessionObject("NomeOpr")) { answ = memLayer.ML.StringSessionObj("NomeOpr"); } if (answ == "") { var tabOpr = dataLayer.man.taAO.getByKey(mUtils.CodOpr); if (tabOpr.Rows.Count > 0) { answ = string.Format("{0} {1}", tabOpr[0].Cognome, tabOpr[0].Nome); } memLayer.ML.setSessionVal("NomeOpr", answ); } return answ; } } /// /// Forzo refresh pannello superiore /// public void doUpdate() { divCurr.DataBind(); } } }