Files
MoonPro.net/MP-ADM/WebUserControls/cmp_ricercaGenerica.ascx.cs
Samuele Locatelli 61028fb668 MP-ADM
- porting Bootstrap4 --> bootstrap5
- vari fix (es search vocabolario)
2023-09-11 18:35:10 +02:00

110 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
namespace MP_ADM.WebUserControls
{
public partial class cmp_ricercaGenerica : ApplicationUserControl
{
#region Public Events
public event EventHandler eh_nuovaRicerca;
#endregion Public Events
#region Public Methods
/// <summary>
/// aggiorna il testo cercato
/// </summary>
public void updateText()
{
if (!string.IsNullOrEmpty(memLayer.ML.StringSessionObj("valoreSearch")) && !Page.IsPostBack)
{
testoRicerca = memLayer.ML.StringSessionObj("valoreSearch");
}
}
#endregion Public Methods
#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 void btnReset_Click(object sender, EventArgs e)
{
txtCerca.Text = "";
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))
{
memLayer.ML.emptySessionVal("valoreSearch");
}
else
{
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
}
}