137 lines
4.3 KiB
C#
137 lines
4.3 KiB
C#
using AppData;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Web.UI;
|
|
|
|
namespace C_TRACK.WebUserControls
|
|
{
|
|
public partial class mod_menuTopCompact : BaseUserControl
|
|
{
|
|
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");
|
|
}
|
|
/// <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 TASK corrente
|
|
/// </summary>
|
|
public string CurrNumTask
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("CurrNumTask");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Codice ART corrente
|
|
/// </summary>
|
|
public string CurrCodArt
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("CurrCodArt");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Codice postazione di lavoro
|
|
/// </summary>
|
|
public string DescPost
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
if (memLayer.ML.isInSessionObject("DescPost"))
|
|
{
|
|
answ = memLayer.ML.StringSessionObj("DescPost");
|
|
}
|
|
if (answ == "")
|
|
{
|
|
var tabPost = DLMan.taAP.getByKey(mUtils.CodPost);
|
|
if (tabPost.Rows.Count > 0)
|
|
{
|
|
answ = tabPost[0].Descrizione;
|
|
}
|
|
memLayer.ML.setSessionVal("DescPost", answ);
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Codice Operatore
|
|
/// </summary>
|
|
public string NomeOpr
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
if (memLayer.ML.isInSessionObject("NomeOpr"))
|
|
{
|
|
answ = memLayer.ML.StringSessionObj("NomeOpr");
|
|
}
|
|
if (answ == "")
|
|
{
|
|
var tabOpr = DLMan.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;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Forzo refresh pannello superiore
|
|
/// </summary>
|
|
public void doUpdate()
|
|
{
|
|
divCurr.DataBind();
|
|
}
|
|
}
|
|
} |