Files
MoonPro.net/MP-TAB/WebUserControls/cmp_ST_objCheck.ascx.cs
T

188 lines
5.3 KiB
C#

using Microsoft.Ajax.Utilities;
using SteamWare;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MoonProTablet.WebUserControls
{
public partial class cmp_ST_objCheck : BaseUserControl
{
#region Public Properties
/// <summary>
/// Valore BCode acquisito
/// </summary>
public string BCodeVal
{
get
{
return txtInput.Text.Trim().ToUpper();
}
set
{
txtInput.Text = value;
}
}
/// <summary>
/// Cod Articolo selezionato
/// </summary>
public string CodArticolo
{
get
{
return hfCodArticolo.Value.Trim();
}
set
{
hfCodArticolo.Value = value.Trim();
checkInputData();
}
}
/// <summary>
/// oggetto comando locale alla classe formato RAW
/// </summary>
public string rawInput
{
get
{
string answ;
if (memLayer.ML.isInSessionObject("barcodeRaw"))
{
answ = memLayer.ML.StringSessionObj("barcodeRaw");
}
else
{
answ = "";
}
return answ;
}
set
{
memLayer.ML.setSessionVal("barcodeRaw", value, false);
}
}
#endregion Public Properties
#region Private Methods
private void checkInputData()
{
bool showInput = false;
try
{
showInput = DataLayerObj.taSTAR.getPendingByOdl(CodArticolo, idxOdl).Count > 0;
}
catch
{ }
divCheckData.Visible = showInput;
}
/// <summary>
/// procedura pricipale decodifica Barcode
/// </summary>
private void processInput()
{
bool found = false;
// per prima cosa recupero i valori "Pending" da leggere come candidati...
var tabRichieste = DataLayerObj.taSTAR.getPendingByOdl(CodArticolo, idxOdl);
if (tabRichieste != null && tabRichieste.Count > 0)
{
// cerco per EQ come primo step...
var trovatoEq = tabRichieste.Where(x => x.CheckType == "EQ" && x.Value == BCodeVal);
if (trovatoEq != null && trovatoEq.Count() > 0)
{
// recupero record..
var data = trovatoEq.FirstOrDefault();
// registro trovato
found = true;
// upsert controllo
DataLayerObj.taSTChk.upsertQuery(idxOdl, data.IdxST, data.Oggetto, data.Num, BCodeVal, BCodeVal, true, user_std.UtSn.utente);
}
// se non trovato
if (!found)
{
// controllo condizione tipo BATCH (speciale)
}
}
// sistemo visualizzaizone componente
BCodeVal = "";
checkInputData();
// sollevo evento
reportUpdate();
}
#endregion Private Methods
#region Protected Methods
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// barcode completato con invio...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtInput_TextChanged(object sender, EventArgs e)
{
processInput();
}
#endregion Protected Methods
#if false
/// <summary>
/// verifico se sia un valore compreso nell'elenco fornito
/// </summary>
private void isValore()
{
if (_tabValori.ContainsKey(BCodeVal)) // verifico se il comando digitato esista...
{
comando.isValid = true;
comando.valore = BCodeVal;
_tabValori.TryGetValue(BCodeVal, out comando.valoreTrad);
}
}
/// <summary>
/// verifica se il comando inserito sia valido
/// </summary>
private void isInputEvent()
{
if (_comandi.ContainsKey(BCodeVal)) // verifico se il comando digitato esista...
{
comando.isValid = true;
// salvo comando precedente (se c'è...)
comando.prevCmdIn = comando.currCmdIn;
comando.descrComandoPrev = comando.descrComando;
comando.currCmdIn = BCodeVal;
_comandi.TryGetValue(BCodeVal, out comando.descrComando);
}
}
/// <summary>
/// verifica quale browser usato e applica css corretto al div attorno al box
/// </summary>
private void DetectAgent()
{
System.Web.HttpBrowserCapabilities browser = Request.Browser;
if (browser.Browser == "IE")
{
pnlBarcodeBox.CssClass = "barcodeBoxIE";
}
else
{
pnlBarcodeBox.CssClass = "barcodeBoxOther";
}
}
#endif
}
}