Files
GPW/GPW_Commesse/WebUserControls/mod_ricercaGenerica.ascx.cs
Samuele E. Locatelli cdfecedb4f refresh progetto
2021-01-07 10:45:22 +01:00

105 lines
2.4 KiB
C#

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SteamWare;
public partial class mod_ricercaGenerica : ApplicationUserControl
{
#region Public Events
public event EventHandler eh_nuovaRicerca;
#endregion Public Events
#region Protected Properties
/// <summary>
/// testo ricerca trimmato da spazi
/// </summary>
protected string testoRicerca
{
get
{
return txtCerca.Text.Trim();
}
set
{
txtCerca.Text = value;
}
}
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// pressione del button di ricerca
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCerca_Click(object sender, EventArgs e)
{
salvaCerca();
}
protected override void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
updateText();
btnCerca.Text = traduci("lblCerca");
}
/// <summary>
/// effettua salvataggio ricerca
/// </summary>
protected void salvaCerca()
{
if (string.IsNullOrEmpty(testoRicerca))
{
SteamWare.memLayer.ML.emptySessionVal("valoreSearch");
}
else
{
SteamWare.memLayer.ML.setSessionVal("valoreSearch", testoRicerca);
// raise dell'evento
if (eh_nuovaRicerca != null)
{
eh_nuovaRicerca(this, new EventArgs());
}
}
}
/// <summary>
/// cambiato valore in ricerca
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtCerca_TextChanged(object sender, EventArgs e)
{
salvaCerca();
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// aggiorna il testo cercato
/// </summary>
public void updateText()
{
if (!string.IsNullOrEmpty(memLayer.ML.StringSessionObj("valoreSearch")) && !Page.IsPostBack)
{
testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreSearch");
}
}
#endregion Public Methods
}