163 lines
3.9 KiB
C#
163 lines
3.9 KiB
C#
using AppData;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Web.UI;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_menuTop : BaseUserControl
|
|
{
|
|
#region Protected Properties
|
|
|
|
/// <summary>
|
|
/// Valore ricerca attivo
|
|
/// </summary>
|
|
protected string searchVal
|
|
{
|
|
get
|
|
{
|
|
return txtSearch.Text.Trim();
|
|
}
|
|
set
|
|
{
|
|
txtSearch.Text = value.Trim();
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Abilitazione esecuzione anonima
|
|
/// </summary>
|
|
public bool enableAnonym
|
|
{
|
|
get
|
|
{
|
|
bool answ = false;
|
|
bool.TryParse(hfAnonym.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfAnonym.Value = value.ToString();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// imposta visibilità search globale
|
|
/// </summary>
|
|
public bool showSearch
|
|
{
|
|
get
|
|
{
|
|
return divSearch.Visible;
|
|
}
|
|
set
|
|
{
|
|
divSearch.Visible = value;
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void checkAuth()
|
|
{
|
|
// in primis SOLO SE non è permesso login anonymous...
|
|
if (!enableAnonym)
|
|
{
|
|
if (!Page.User.Identity.IsAuthenticated)
|
|
{
|
|
Response.Redirect("default");
|
|
}
|
|
}
|
|
}
|
|
|
|
private void doSearch()
|
|
{
|
|
// se searchVal !=""
|
|
if (!string.IsNullOrEmpty(searchVal))
|
|
{
|
|
memLayer.ML.setSessionVal("valoreSearch", searchVal);
|
|
}
|
|
else
|
|
{
|
|
memLayer.ML.emptySessionVal("valoreSearch");
|
|
}
|
|
raiseEvent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// aggiornamento del menù
|
|
/// </summary>
|
|
private void updateTreeMenu()
|
|
{
|
|
// SOLO SE è permesso login anonymous --> nascondo menù!
|
|
if (enableAnonym)
|
|
{
|
|
menu.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(user_std.UtSn.mappaSito))
|
|
{
|
|
Response.Redirect("Default", true);
|
|
}
|
|
XmlMenu.Data = user_std.UtSn.mappaSito;
|
|
XmlMenu.XPath = "mainMenu/menu";
|
|
XmlMenu.DataBind();
|
|
}
|
|
catch
|
|
{
|
|
Response.Redirect("default", true);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// click su pagina corrente, fa update!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbnUpdate_Click(object sender, EventArgs e)
|
|
{
|
|
// SOLO SE non è permesso login anonymous...
|
|
if (!enableAnonym)
|
|
{
|
|
Response.Redirect("default");
|
|
}
|
|
}
|
|
|
|
protected void lbtSearch_Click(object sender, EventArgs e)
|
|
{
|
|
doSearch();
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
checkAuth();
|
|
searchVal = "";
|
|
doSearch();
|
|
updateTreeMenu();
|
|
}
|
|
}
|
|
|
|
protected void txtSearch_TextChanged(object sender, EventArgs e)
|
|
{
|
|
doSearch();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |