140 lines
3.3 KiB
C#
140 lines
3.3 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Web.UI;
|
|
|
|
namespace ES3.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");
|
|
// 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").IndexOf(lastPage) < 0)
|
|
{
|
|
Response.Redirect("login");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
PagCorrente();
|
|
}
|
|
}
|
|
// controllo pagina...
|
|
bool pageAuth = devicesAuthProxy.stObj.isPageEnabled(lastPage);
|
|
// controllo pag auth...
|
|
if (!pageAuth)
|
|
{
|
|
Response.Redirect("~/login");
|
|
}
|
|
lblTitolo.Text = memLayer.ML.CRS("appName");
|
|
}
|
|
/// <summary>
|
|
/// salva in variabile pagina il nome della pagina corrente
|
|
/// </summary>
|
|
protected void PagCorrente()
|
|
{
|
|
string[] uri = Request.Url.LocalPath.Split('/');
|
|
// salvo pagina corrente
|
|
devicesAuthProxy.pagCorrente = uri.Last();
|
|
if (devicesAuthProxy.pagPrecedente == "")
|
|
{
|
|
devicesAuthProxy.pagPrecedente = devicesAuthProxy.pagCorrente;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Codice postazione di lavoro
|
|
/// </summary>
|
|
public string CodPost
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("CodPost");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Codice Operatore
|
|
/// </summary>
|
|
public string CodOpr
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("CodOpr");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Codice TASK corrente
|
|
/// </summary>
|
|
public string CurrNumTask
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("CurrNumTask");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Codice postazione di lavoro
|
|
/// </summary>
|
|
public string DescPost
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
#if false
|
|
if (memLayer.ML.isInSessionObject("DescPost"))
|
|
{
|
|
answ = memLayer.ML.StringSessionObj("DescPost");
|
|
}
|
|
if (answ == "")
|
|
{
|
|
var tabPost = dataLayer.man.taAP.getByKey(CodPost);
|
|
if (tabPost.Rows.Count > 0)
|
|
{
|
|
answ = tabPost[0].Descrizione;
|
|
}
|
|
memLayer.ML.setSessionVal("DescPost", answ);
|
|
}
|
|
#endif
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Codice Operatore
|
|
/// </summary>
|
|
public string NomeOpr
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
#if false
|
|
if (memLayer.ML.isInSessionObject("NomeOpr"))
|
|
{
|
|
answ = memLayer.ML.StringSessionObj("NomeOpr");
|
|
}
|
|
if (answ == "")
|
|
{
|
|
var tabOpr = dataLayer.man.taAO.getByKey(CodOpr);
|
|
if (tabOpr.Rows.Count > 0)
|
|
{
|
|
answ = string.Format("{0} {1}", tabOpr[0].Cognome, tabOpr[0].Nome);
|
|
}
|
|
memLayer.ML.setSessionVal("NomeOpr", answ);
|
|
}
|
|
#endif
|
|
return answ;
|
|
}
|
|
}
|
|
}
|
|
} |