129 lines
3.8 KiB
C#
129 lines
3.8 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;
|
|
using GMW_data;
|
|
|
|
|
|
namespace GMW_Term.WebUserControls
|
|
{
|
|
public partial class mod_search : System.Web.UI.UserControl
|
|
{
|
|
// variabile per verificare se è operatore
|
|
bool _validUserInSession = false;
|
|
/// <summary>
|
|
/// Verifica se c'è un valore in sessione di tipo operatore
|
|
/// </summary>
|
|
protected void verificaOperatoreInSessione()
|
|
{
|
|
if (string.IsNullOrEmpty(user_std.UtSn.utente))
|
|
{
|
|
_validUserInSession = false;
|
|
}
|
|
else
|
|
{
|
|
_validUserInSession = true;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// caricamento pagina!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
// scrive label e text bottoni
|
|
btnLoginPage.Text = "[7]-LogOut";
|
|
btnLoginPage.AccessKey = "7";
|
|
btnButtonsHome.Text = "[9]-Home";
|
|
btnButtonsHome.AccessKey = "9";
|
|
// se username è valorizzato...
|
|
verificaOperatoreInSessione();
|
|
if (_validUserInSession)
|
|
{
|
|
btnLoginPage.Visible = memLayer.ML.confReadBool("showLogout");
|
|
btnButtonsHome.Visible = true;
|
|
}
|
|
// se non è valorizzato chiede di effettuare login...
|
|
else
|
|
{
|
|
Response.Redirect("Home.aspx");
|
|
}
|
|
if (!Page.IsPostBack)
|
|
{
|
|
memLayer.ML.emptySessionVal("searchTerm");
|
|
txtRicerca.Focus();
|
|
mod_searchResults1.Visible = false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// in caso di valore cercato...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void txtRicerca_TextChanged(object sender, EventArgs e)
|
|
{
|
|
valoreRicerca = txtSearch;
|
|
updateSearchProviders();
|
|
}
|
|
/// <summary>
|
|
/// aggiorna i provider di ricerca con i valori consistenti trovati
|
|
/// </summary>
|
|
private void updateSearchProviders()
|
|
{
|
|
memLayer.ML.setSessionVal("searchTerm", txtRicerca.Text.Trim());
|
|
mod_searchResults1.Visible = true;
|
|
}
|
|
/// <summary>
|
|
/// testo contenuto nella textbox
|
|
/// </summary>
|
|
public string txtSearch
|
|
{
|
|
get
|
|
{
|
|
return txtRicerca.Text.Trim();
|
|
}
|
|
set
|
|
{
|
|
txtRicerca.Text = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// valore della scansione barcode
|
|
/// </summary>
|
|
public string valoreRicerca
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("searchValue");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("searchValue", value, false);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua logout...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnLoginPage_Click(object sender, EventArgs e)
|
|
{
|
|
TermUtils.TU.forceLogOut();
|
|
Response.Redirect("~/Barcode.aspx");
|
|
}
|
|
/// <summary>
|
|
/// va alla pagina dei buttons principale
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnButtonsHome_Click(object sender, EventArgs e)
|
|
{
|
|
Response.Redirect("~/Home.aspx");
|
|
}
|
|
}
|
|
} |