114 lines
2.2 KiB
C#
114 lines
2.2 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Web.UI;
|
|
|
|
namespace WebLCP.WUC
|
|
{
|
|
public partial class cmp_header : System.Web.UI.UserControl
|
|
{
|
|
public event EventHandler eh_doRefresh;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
showSearch = false;
|
|
searchVal = "";
|
|
ulLinks.DataBind();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// imposta visibilità search globale
|
|
/// </summary>
|
|
public bool showSearch
|
|
{
|
|
get
|
|
{
|
|
return divSearch.Visible;
|
|
}
|
|
set
|
|
{
|
|
divSearch.Visible = value;
|
|
}
|
|
}
|
|
|
|
protected void txtSearch_TextChanged(object sender, EventArgs e)
|
|
{
|
|
doSearch();
|
|
}
|
|
|
|
private void doSearch()
|
|
{
|
|
// se searchVal !=""
|
|
if (searchVal != "")
|
|
{
|
|
memLayer.ML.setSessionVal("valoreSearch", searchVal);
|
|
}
|
|
else
|
|
{
|
|
memLayer.ML.emptySessionVal("valoreSearch");
|
|
}
|
|
// se qualcuno ascolta sollevo evento nuovo valore...
|
|
if (eh_doRefresh != null)
|
|
{
|
|
eh_doRefresh(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Valore ricerca attivo
|
|
/// </summary>
|
|
protected string searchVal
|
|
{
|
|
get
|
|
{
|
|
return txtSearch.Text.Trim();
|
|
}
|
|
set
|
|
{
|
|
txtSearch.Text = value.Trim();
|
|
}
|
|
}
|
|
|
|
protected void lbtSearch_Click(object sender, EventArgs e)
|
|
{
|
|
doSearch();
|
|
}
|
|
|
|
public string checkPage(string tgtName)
|
|
{
|
|
string answ = "";
|
|
if (titolo == tgtName)
|
|
{
|
|
answ = "active";
|
|
}
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// titolo pagina
|
|
/// </summary>
|
|
public string titolo
|
|
{
|
|
get
|
|
{
|
|
return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", "");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// restituisce il nome della pagina corrente
|
|
/// </summary>
|
|
public static string getPage(Uri MyUrl)
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
answ = MyUrl.LocalPath.Split('/').Last();
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
logger.lg.scriviLog(exc.ToString(), tipoLog.EXCEPTION);
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
} |