151 lines
4.3 KiB
C#
151 lines
4.3 KiB
C#
using GPW_data;
|
|
using SteamWare;
|
|
using System;
|
|
|
|
namespace GPW_Commesse.WebUserControls
|
|
{
|
|
public partial class mod_menuTopFull : System.Web.UI.UserControl
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// url per ritorno a pagina precedente
|
|
/// </summary>
|
|
public string returnUrl
|
|
{
|
|
set
|
|
{
|
|
if (!string.IsNullOrEmpty(value))
|
|
{
|
|
memLayer.ML.setSessionVal("returnUrl", value);
|
|
lbHome.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// titolo pagina
|
|
/// </summary>
|
|
public string titolo
|
|
{
|
|
get
|
|
{
|
|
return lblCurrentPage.Text;
|
|
}
|
|
set
|
|
{
|
|
lblCurrentPage.Text = value;
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
private static void tryUserSetup()
|
|
{
|
|
// ricavo e salvo idxDipendente
|
|
int idxDip = -1;
|
|
try
|
|
{
|
|
idxDip = DataProxy.DP.taDipendenti.getByUserDominio(user_std.UtSn.dominio, user_std.UtSn.utente)[0].idxDipendente;
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
// loggo!
|
|
logger.lg.scriviLog($"Errore dipendente non trovato:{Environment.NewLine}dominio\\utente: {user_std.UtSn.dominio}\\{user_std.UtSn.utente}{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
|
|
}
|
|
DataProxy.idxDipendente = idxDip;
|
|
}
|
|
|
|
/// <summary>
|
|
/// verifica ci sia user in sessione...
|
|
/// </summary>
|
|
private void checkUser()
|
|
{
|
|
if (string.IsNullOrEmpty(user_std.UtSn.CognomeNome))
|
|
{
|
|
logger.lg.scriviLog($"CognomeNome non trovato, cerco dominio/utente", tipoLog.STARTUP);
|
|
// cerco se ho dipendente...
|
|
if (string.IsNullOrEmpty(user_std.UtSn.dominio) || string.IsNullOrEmpty(user_std.UtSn.utente))
|
|
{
|
|
// fix
|
|
memLayer.ML.setSessionVal("preUrlString", "", true);
|
|
memLayer.ML.setSessionVal("nextPage", "commesseUtente");
|
|
Session.Clear();
|
|
logger.lg.scriviLog($"dominio/utente idxDipendente non trovato, reset sessione e ritorno a login", tipoLog.STARTUP);
|
|
Response.Redirect("login");
|
|
}
|
|
else
|
|
{
|
|
tryUserSetup();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
tryUserSetup();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// redirect
|
|
/// </summary>
|
|
private void returnHome()
|
|
{
|
|
Response.Redirect(memLayer.ML.StringSessionObj("returnUrl"));
|
|
}
|
|
|
|
/// <summary>
|
|
/// imposta valori mostrati
|
|
/// </summary>
|
|
private void setMenuData()
|
|
{
|
|
string postazione_IP = Request.UserHostName;
|
|
lblPostazione.Text = "";
|
|
try
|
|
{
|
|
lblUtente.Text = user_std.UtSn.CognomeNome;
|
|
lblPostazione.Text += string.Format("{0}", dnsUtils.DetermineCompName(postazione_IP));
|
|
}
|
|
catch
|
|
{ }
|
|
try
|
|
{
|
|
lblPostazione.Text += string.Format(" ({0})", postazione_IP);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// rimanda a pagina precedente
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbHome_Click(object sender, EventArgs e)
|
|
{
|
|
returnHome();
|
|
}
|
|
|
|
/// <summary>
|
|
/// caricamento pagina
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
mod_reportUtenteAD1.Visible = memLayer.ML.CRB("showRepTimb");
|
|
checkUser();
|
|
}
|
|
setMenuData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |