111 lines
2.4 KiB
C#
111 lines
2.4 KiB
C#
using System;
|
|
using System.Web.UI;
|
|
|
|
public partial class mod_ricercaGenerica : SteamWare.UserControl
|
|
{
|
|
|
|
#region gestione eventi
|
|
|
|
public event EventHandler eh_nuovaRicerca;
|
|
|
|
#endregion
|
|
|
|
# region area protected
|
|
|
|
#region area ricerche dettaglio specifiche
|
|
|
|
protected bool _cercaMatricole = false;
|
|
protected bool _cercaUsername = false;
|
|
//protected bool _cercaManufacturer = false;
|
|
//protected bool _cercaCategorie = false;
|
|
protected bool _cercaModelli = false;
|
|
protected bool _cercaMag = false;
|
|
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
updateText();
|
|
}
|
|
/// <summary>
|
|
/// cambiato valore in ricerca
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void txtCerca_TextChanged(object sender, EventArgs e)
|
|
{
|
|
salvaCerca();
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettuato reset
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lnkReset_Click(object sender, EventArgs e)
|
|
{
|
|
txtCerca.Text = "";
|
|
salvaCerca();
|
|
}
|
|
/// <summary>
|
|
/// pressione del button di ricerca
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnCerca_Click(object sender, EventArgs e)
|
|
{
|
|
salvaCerca();
|
|
}
|
|
/// <summary>
|
|
/// testo ricerca trimmato da spazi
|
|
/// </summary>
|
|
protected string testoRicerca
|
|
{
|
|
get
|
|
{
|
|
return txtCerca.Text.Trim();
|
|
}
|
|
set
|
|
{
|
|
txtCerca.Text = value;
|
|
}
|
|
}
|
|
|
|
protected void salvaCerca()
|
|
{
|
|
if (testoRicerca == "")
|
|
{
|
|
SteamWare.memLayer.ML.emptySessionVal("valoreCercato");
|
|
}
|
|
else
|
|
{
|
|
SteamWare.memLayer.ML.setSessionVal("valoreCercato", testoRicerca);
|
|
// raise dell'evento
|
|
if (eh_nuovaRicerca != null)
|
|
{
|
|
eh_nuovaRicerca(this, new EventArgs());
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region area public
|
|
|
|
/// <summary>
|
|
/// aggiorna il testo cercato
|
|
/// </summary>
|
|
public void updateText()
|
|
{
|
|
if (SteamWare.memLayer.ML.StringSessionObj("valoreCercato") != "" && !Page.IsPostBack)
|
|
{
|
|
testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreCercato");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|