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;
///
/// Verifica se c'è un valore in sessione di tipo operatore
///
protected void verificaOperatoreInSessione()
{
if (string.IsNullOrEmpty(user_std.UtSn.utente))
{
_validUserInSession = false;
}
else
{
_validUserInSession = true;
}
}
///
/// caricamento pagina!
///
///
///
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;
}
}
///
/// in caso di valore cercato...
///
///
///
protected void txtRicerca_TextChanged(object sender, EventArgs e)
{
valoreRicerca = txtSearch;
updateSearchProviders();
}
///
/// aggiorna i provider di ricerca con i valori consistenti trovati
///
private void updateSearchProviders()
{
memLayer.ML.setSessionVal("searchTerm", txtRicerca.Text.Trim());
mod_searchResults1.Visible = true;
}
///
/// testo contenuto nella textbox
///
public string txtSearch
{
get
{
return txtRicerca.Text.Trim();
}
set
{
txtRicerca.Text = value;
}
}
///
/// valore della scansione barcode
///
public string valoreRicerca
{
get
{
return memLayer.ML.StringSessionObj("searchValue");
}
set
{
memLayer.ML.setSessionVal("searchValue", value, false);
}
}
///
/// effettua logout...
///
///
///
protected void btnLoginPage_Click(object sender, EventArgs e)
{
TermUtils.TU.forceLogOut();
Response.Redirect("~/Barcode.aspx");
}
///
/// va alla pagina dei buttons principale
///
///
///
protected void btnButtonsHome_Click(object sender, EventArgs e)
{
Response.Redirect("~/Home.aspx");
}
}
}