Files
b2bcondomini.it/PUB/WebUserContols/tpl_header.ascx.cs
T
2018-05-17 16:13:35 +02:00

130 lines
2.6 KiB
C#

using SteamWare;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace PUB.WebUserContols
{
public partial class tpl_header : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
doUpdate();
}
}
public void doUpdate()
{
lnkPAM.Visible = false;
lnkPAZ.Visible = false;
lnkPBO.Visible = false;
lnkPCO.Visible = false;
switch (UserRole)
{
case "amministratore":
lnkPAM.Visible = true;
break;
case "azienda":
lnkPAZ.Visible = true;
break;
case "condomini.it":
lnkPBO.Visible = true;
break;
case "condominio":
lnkPCO.Visible = true;
break;
default:
break;
}
#if false
lnkPAM.Visible = isPAM;
lnkPAZ.Visible = isPAZ;
lnkPBO.Visible = isPBO;
lnkPCO.Visible = isPCO;
#endif
hlUser.CssClass = string.Format("nav-link {0}", userClass);
}
/// <summary>
/// Ruolo utente
/// </summary>
public string UserRole
{
get
{
return memLayer.ML.StringSessionObj("UserRole");
}
set
{
memLayer.ML.setSessionVal("UserRole", value);
}
}
public string userClass
{
get
{
string answ = "";
switch (UserRole)
{
case "amministratore":
answ = "text-danger";
break;
case "azienda":
answ = "text-warning";
break;
case "condomini.it":
answ = "text-info";
break;
case "condominio":
answ = "text-primary";
break;
default:
answ = "text-primary";
break;
}
return answ;
}
}
public bool isPAM
{
get
{
return Page.Request.Url.AbsolutePath.Contains("PAM");
}
}
public bool isPAZ
{
get
{
return Page.Request.Url.AbsolutePath.Contains("PAZ");
}
}
public bool isPBO
{
get
{
return Page.Request.Url.AbsolutePath.Contains("PBO");
}
}
public bool isPCO
{
get
{
return Page.Request.Url.AbsolutePath.Contains("PCO");
}
}
protected void txtSearch_TextChanged(object sender, EventArgs e)
{
// salvo ricerca
memLayer.ML.setSessionVal("siteSearchVal", txtSearch.Text.Trim());
}
}
}