fix comportamento buttons barcode
This commit is contained in:
@@ -7,257 +7,257 @@ using SteamWare;
|
||||
|
||||
namespace XPST.WebUserControls
|
||||
{
|
||||
public partial class mod_barcode : System.Web.UI.UserControl
|
||||
public partial class mod_barcode : System.Web.UI.UserControl
|
||||
{
|
||||
#region area protected
|
||||
|
||||
/// <summary>
|
||||
/// dictionary comandi ammessi
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> _comandi = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// dictionary dei valori ammessi
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> _tabValori = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// oggetto comando locale alla classe
|
||||
/// </summary>
|
||||
protected inputComando comando
|
||||
{
|
||||
#region area protected
|
||||
|
||||
/// <summary>
|
||||
/// dictionary comandi ammessi
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> _comandi = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// dictionary dei valori ammessi
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> _tabValori = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// oggetto comando locale alla classe
|
||||
/// </summary>
|
||||
protected inputComando comando
|
||||
get
|
||||
{
|
||||
inputComando answ;
|
||||
if (memLayer.ML.isInSessionObject("barcodeCmd"))
|
||||
{
|
||||
get
|
||||
{
|
||||
inputComando answ;
|
||||
if (memLayer.ML.isInSessionObject("barcodeCmd"))
|
||||
{
|
||||
answ = (inputComando)memLayer.ML.objSessionObj("barcodeCmd");
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = new inputComando();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("barcodeCmd", value, false);
|
||||
}
|
||||
answ = (inputComando)memLayer.ML.objSessionObj("barcodeCmd");
|
||||
}
|
||||
/// <summary>
|
||||
/// al caricamento della pagina...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
else
|
||||
{
|
||||
DetectAgent();
|
||||
myInitialize();
|
||||
answ = new inputComando();
|
||||
}
|
||||
/// <summary>
|
||||
/// inizializzazione specifica barcode
|
||||
/// </summary>
|
||||
private void myInitialize()
|
||||
{
|
||||
lblInput.Text = traduci("PregoInserireBarcode");
|
||||
if (!Page.IsPostBack) comando = new inputComando();
|
||||
}
|
||||
/// <summary>
|
||||
/// barcode completato con invio...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
processInput();
|
||||
}
|
||||
|
||||
private void processInput()
|
||||
{
|
||||
// verifico se sia un comando o un valore valido...
|
||||
isInputEvent();
|
||||
isValore();
|
||||
// verifico se c'è stato input evento
|
||||
if (comando.isValid)
|
||||
{
|
||||
if (comando.currCmdIn != "")
|
||||
{
|
||||
txtInput2show = comando.descrComando;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput2show = "---";
|
||||
}
|
||||
if (comando.valore != "")
|
||||
{
|
||||
txtVal2show = comando.valoreTrad;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtVal2show = "---";
|
||||
}
|
||||
if (eh_comandoRegistrato != null)
|
||||
{
|
||||
eh_comandoRegistrato(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lblInput.Text = traduci("ComandoSconosciuto");
|
||||
lblValore.Text = txtInput.Text;
|
||||
comando = new inputComando();
|
||||
}
|
||||
txtInput.Text = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// verifico se sia un valore compreso nell'elenco fornito
|
||||
/// </summary>
|
||||
private void isValore()
|
||||
{
|
||||
if (_tabValori.ContainsKey(txtInput.Text)) // verifico se il comando digitato esista...
|
||||
{
|
||||
comando.isValid = true;
|
||||
comando.valore = txtInput.Text;
|
||||
_tabValori.TryGetValue(txtInput.Text, out comando.valoreTrad);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se il comando inserito sia valido
|
||||
/// </summary>
|
||||
private void isInputEvent()
|
||||
{
|
||||
if (_comandi.ContainsKey(txtInput.Text)) // verifico se il comando digitato esista...
|
||||
{
|
||||
comando.isValid = true;
|
||||
// salvo comando precedente (se c'è...)
|
||||
comando.prevCmdIn = comando.currCmdIn;
|
||||
comando.descrComandoPrev = comando.descrComando;
|
||||
comando.currCmdIn = txtInput.Text;
|
||||
_comandi.TryGetValue(txtInput.Text, 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";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region area public
|
||||
|
||||
/// <summary>
|
||||
/// effettua al ettura da sessione del comando cliccato e lo inserisce come fosse barcode
|
||||
/// </summary>
|
||||
public void loadBtnClickComando()
|
||||
{
|
||||
txtInput.Text = memLayer.ML.StringSessionObj("btnCmdPress");
|
||||
memLayer.ML.emptySessionVal("btnCmdPress");
|
||||
processInput();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// elenco dei comandi riconosciuti
|
||||
/// </summary>
|
||||
public Dictionary<string, string> comandiAmmessi
|
||||
{
|
||||
get
|
||||
{
|
||||
return _comandi;
|
||||
}
|
||||
set
|
||||
{
|
||||
_comandi = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// tabella di valori ammissibili
|
||||
/// </summary>
|
||||
public Dictionary<string, string> tabValori
|
||||
{
|
||||
get
|
||||
{
|
||||
return _tabValori;
|
||||
}
|
||||
set
|
||||
{
|
||||
_tabValori = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// evento comando registrato
|
||||
/// </summary>
|
||||
public event EventHandler eh_comandoRegistrato;
|
||||
/// <summary>
|
||||
/// comando registrato dal barcode
|
||||
/// </summary>
|
||||
public inputComando comandoRegistrato
|
||||
{
|
||||
get
|
||||
{
|
||||
return comando;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// scrive nella label input
|
||||
/// </summary>
|
||||
public string txtInput2show
|
||||
{
|
||||
set
|
||||
{
|
||||
lblInput.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// scrive nella label valore
|
||||
/// </summary>
|
||||
public string txtVal2show
|
||||
{
|
||||
set
|
||||
{
|
||||
lblValore.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// scrive nella label richiesta
|
||||
/// </summary>
|
||||
public string txtRich2show
|
||||
{
|
||||
set
|
||||
{
|
||||
lblRichiesta.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// reset del controllo
|
||||
/// </summary>
|
||||
public void resetMe()
|
||||
{
|
||||
comando = new inputComando();
|
||||
txtInput2show = "Prego inserire barcode";
|
||||
txtVal2show = "";
|
||||
txtRich2show = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper traduzione termini
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("barcodeCmd", value, false);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// al caricamento della pagina...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
DetectAgent();
|
||||
myInitialize();
|
||||
}
|
||||
/// <summary>
|
||||
/// inizializzazione specifica barcode
|
||||
/// </summary>
|
||||
private void myInitialize()
|
||||
{
|
||||
lblInput.Text = traduci("PregoInserireBarcode");
|
||||
if (!Page.IsPostBack) comando = new inputComando();
|
||||
}
|
||||
/// <summary>
|
||||
/// barcode completato con invio...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
processInput();
|
||||
}
|
||||
|
||||
private void processInput()
|
||||
{
|
||||
// verifico se sia un comando o un valore valido...
|
||||
isInputEvent();
|
||||
isValore();
|
||||
// verifico se c'è stato input evento
|
||||
if (comando.isValid)
|
||||
{
|
||||
if (comando.currCmdIn != "")
|
||||
{
|
||||
txtInput2show = comando.descrComando;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput2show = "---";
|
||||
}
|
||||
if (comando.valore != "")
|
||||
{
|
||||
txtVal2show = comando.valoreTrad;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtVal2show = "---";
|
||||
}
|
||||
if (eh_comandoRegistrato != null)
|
||||
{
|
||||
eh_comandoRegistrato(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lblInput.Text = traduci("ComandoSconosciuto");
|
||||
lblValore.Text = txtInput.Text;
|
||||
comando = new inputComando();
|
||||
}
|
||||
txtInput.Text = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// verifico se sia un valore compreso nell'elenco fornito
|
||||
/// </summary>
|
||||
private void isValore()
|
||||
{
|
||||
if (_tabValori.ContainsKey(txtInput.Text)) // verifico se il comando digitato esista...
|
||||
{
|
||||
comando.isValid = true;
|
||||
comando.valore = txtInput.Text;
|
||||
_tabValori.TryGetValue(txtInput.Text, out comando.valoreTrad);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se il comando inserito sia valido
|
||||
/// </summary>
|
||||
private void isInputEvent()
|
||||
{
|
||||
if (_comandi.ContainsKey(txtInput.Text)) // verifico se il comando digitato esista...
|
||||
{
|
||||
comando.isValid = true;
|
||||
// salvo comando precedente (se c'è...)
|
||||
comando.prevCmdIn = comando.currCmdIn;
|
||||
comando.descrComandoPrev = comando.descrComando;
|
||||
comando.currCmdIn = txtInput.Text;
|
||||
_comandi.TryGetValue(txtInput.Text, 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";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region area public
|
||||
|
||||
/// <summary>
|
||||
/// effettua al ettura da sessione del comando cliccato e lo inserisce come fosse barcode
|
||||
/// </summary>
|
||||
public void loadBtnClickComando()
|
||||
{
|
||||
txtInput.Text = memLayer.ML.StringSessionObj("btnCmdPress");
|
||||
memLayer.ML.emptySessionVal("btnCmdPress");
|
||||
processInput();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// elenco dei comandi riconosciuti
|
||||
/// </summary>
|
||||
public Dictionary<string, string> comandiAmmessi
|
||||
{
|
||||
get
|
||||
{
|
||||
return _comandi;
|
||||
}
|
||||
set
|
||||
{
|
||||
_comandi = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// tabella di valori ammissibili
|
||||
/// </summary>
|
||||
public Dictionary<string, string> tabValori
|
||||
{
|
||||
get
|
||||
{
|
||||
return _tabValori;
|
||||
}
|
||||
set
|
||||
{
|
||||
_tabValori = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// evento comando registrato
|
||||
/// </summary>
|
||||
public event EventHandler eh_comandoRegistrato;
|
||||
/// <summary>
|
||||
/// comando registrato dal barcode
|
||||
/// </summary>
|
||||
public inputComando comandoRegistrato
|
||||
{
|
||||
get
|
||||
{
|
||||
return comando;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// scrive nella label input
|
||||
/// </summary>
|
||||
public string txtInput2show
|
||||
{
|
||||
set
|
||||
{
|
||||
lblInput.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// scrive nella label valore
|
||||
/// </summary>
|
||||
public string txtVal2show
|
||||
{
|
||||
set
|
||||
{
|
||||
lblValore.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// scrive nella label richiesta
|
||||
/// </summary>
|
||||
public string txtRich2show
|
||||
{
|
||||
set
|
||||
{
|
||||
lblRichiesta.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// reset del controllo
|
||||
/// </summary>
|
||||
public void resetMe()
|
||||
{
|
||||
comando = new inputComando();
|
||||
txtInput2show = "Prego inserire barcode";
|
||||
txtVal2show = "";
|
||||
txtRich2show = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper traduzione termini
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,6 @@ namespace XPST.WebUserControls
|
||||
lbt2.Enabled = false;
|
||||
lbt3.Enabled = false;
|
||||
lbt4.Enabled = false;
|
||||
|
||||
break;
|
||||
case 4:
|
||||
lbt1.Enabled = false;
|
||||
@@ -95,11 +94,6 @@ namespace XPST.WebUserControls
|
||||
lbt4.Enabled = true;
|
||||
break;
|
||||
case 6:
|
||||
lbt1.Enabled = false;
|
||||
lbt2.Enabled = false;
|
||||
lbt3.Enabled = false;
|
||||
lbt4.Enabled = true;
|
||||
break;
|
||||
case 7:
|
||||
lbt1.Enabled = false;
|
||||
lbt2.Enabled = false;
|
||||
@@ -114,7 +108,17 @@ namespace XPST.WebUserControls
|
||||
break;
|
||||
}
|
||||
|
||||
// fix CSS...
|
||||
// fix CSS... inizio togliendo disabled...
|
||||
lbt1.CssClass = lbt1.CssClass.Replace("disabled", "").Trim();
|
||||
lbt2.CssClass = lbt2.CssClass.Replace("disabled", "").Trim();
|
||||
lbt3.CssClass = lbt3.CssClass.Replace("disabled", "").Trim();
|
||||
lbt4.CssClass = lbt4.CssClass.Replace("disabled", "").Trim();
|
||||
lbt5.CssClass = lbt5.CssClass.Replace("disabled", "").Trim();
|
||||
lbt6.CssClass = lbt6.CssClass.Replace("disabled", "").Trim();
|
||||
|
||||
|
||||
|
||||
// rimetto dove serve disabled...
|
||||
if (!lbt1.Enabled) lbt1.CssClass += " disabled";
|
||||
if (!lbt2.Enabled) lbt2.CssClass += " disabled";
|
||||
if (!lbt3.Enabled) lbt3.CssClass += " disabled";
|
||||
|
||||
@@ -437,6 +437,7 @@
|
||||
<Content Include="Resources\ChangeLog.html" />
|
||||
<Content Include="Resources\logoSteamware.png" />
|
||||
<Content Include="Resources\manifest.xml" />
|
||||
<None Include="Resources\Note.txt" />
|
||||
<Content Include="Scripts\bootstrap.bundle.js" />
|
||||
<Content Include="Scripts\bootstrap.bundle.min.js" />
|
||||
<Content Include="Scripts\bootstrap.js" />
|
||||
|
||||
@@ -233,7 +233,7 @@ public partial class barcode : System.Web.UI.Page
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
// Avvio...
|
||||
stopwatch.Start();
|
||||
//processo
|
||||
// carico dati!
|
||||
if (logLevel > 5) logger.lg.scriviLog("Inizio setup valori Barcode", tipoLog.INFO);
|
||||
Dictionary<string, string> valori = new Dictionary<string, string>();
|
||||
XPS_data.DS_applicazioneTableAdapters.v_commesseTableAdapter taCommesse = new XPS_data.DS_applicazioneTableAdapters.v_commesseTableAdapter();
|
||||
|
||||
Generated
+1383
-1380
File diff suppressed because it is too large
Load Diff
+122
-122
@@ -5,131 +5,131 @@ using SteamWare;
|
||||
|
||||
namespace XPS_data
|
||||
{
|
||||
/// <summary>
|
||||
/// macchina di gestione degli stati
|
||||
/// </summary>
|
||||
public class stateMachine
|
||||
{
|
||||
protected DS_applicazioneTableAdapters.EventiTableAdapter taEv;
|
||||
private DS_applicazioneTableAdapters.TraEv2StatiTableAdapter taEv2St;
|
||||
private DS_applicazioneTableAdapters.IstObjTableAdapter taIstObj;
|
||||
protected stateMachine()
|
||||
{
|
||||
avvioTA();
|
||||
setupConnectionStringBase();
|
||||
}
|
||||
/// <summary>
|
||||
/// macchina di gestione degli stati
|
||||
/// avvia table adapters
|
||||
/// </summary>
|
||||
public class stateMachine
|
||||
private void avvioTA()
|
||||
{
|
||||
protected DS_applicazioneTableAdapters.EventiTableAdapter taEv;
|
||||
private DS_applicazioneTableAdapters.TraEv2StatiTableAdapter taEv2St;
|
||||
private DS_applicazioneTableAdapters.IstObjTableAdapter taIstObj;
|
||||
protected stateMachine()
|
||||
{
|
||||
avvioTA();
|
||||
setupConnectionStringBase();
|
||||
}
|
||||
/// <summary>
|
||||
/// avvia table adapters
|
||||
/// </summary>
|
||||
private void avvioTA()
|
||||
{
|
||||
taEv = new DS_applicazioneTableAdapters.EventiTableAdapter();
|
||||
taEv2St = new DS_applicazioneTableAdapters.TraEv2StatiTableAdapter();
|
||||
taIstObj = new DS_applicazioneTableAdapters.IstObjTableAdapter();
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua setup dei connection strings da web.config delal singola applicazione
|
||||
/// </summary>
|
||||
protected virtual void setupConnectionStringBase()
|
||||
{
|
||||
string connString = memLayer.ML.confReadString("XPSConnectionString");
|
||||
// connections strings del db
|
||||
taEv.Connection.ConnectionString = connString;
|
||||
taEv2St.Connection.ConnectionString = connString;
|
||||
taIstObj.Connection.ConnectionString = connString;
|
||||
}
|
||||
public static stateMachine st = new stateMachine();
|
||||
/// <summary>
|
||||
/// restituisce il tipo di comando associato...
|
||||
/// </summary>
|
||||
/// <param name="comando"></param>
|
||||
/// <returns></returns>
|
||||
public tipoAzione azioneComando(inputComando comando)
|
||||
{
|
||||
tipoAzione _azione = tipoAzione.noAct;
|
||||
string toDo = "";
|
||||
try
|
||||
{
|
||||
toDo = taEv.getByCodEvento(comando.currCmdIn)[0].Action;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
switch (toDo)
|
||||
{
|
||||
case "ok":
|
||||
_azione = tipoAzione.conferma;
|
||||
break;
|
||||
case "ko":
|
||||
_azione = tipoAzione.annulla;
|
||||
break;
|
||||
case "act":
|
||||
_azione = tipoAzione.esegui;
|
||||
break;
|
||||
default:
|
||||
_azione = tipoAzione.noAct;
|
||||
break;
|
||||
}
|
||||
return _azione;
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se sia possibile, dagli input segnalati, eseguire un comando secondo la tab transizione stati e restituisce adeguato output su esecuzione/errore e eventuali messaggi
|
||||
/// </summary>
|
||||
/// <param name="codMappa">mappa di riferimento</param>
|
||||
/// <param name="codTipoObj">oggetto di riferimento</param>
|
||||
/// <param name="codStato">stato corrente</param>
|
||||
/// <param name="codEvento">evento</param>
|
||||
/// <returns>oggetto di risposta x esito ok/ko</returns>
|
||||
public tipoEsito doAction(string codMappa, string idxObj, string codStato, string codEvento)
|
||||
{
|
||||
tipoEsito answ = tipoEsito.undef;
|
||||
string codTipoObj = ""; // di default pongo a vuoto...
|
||||
try
|
||||
{
|
||||
codTipoObj = taIstObj.getByIdxObj(idxObj)[0].CodObj;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// controllo su tab se ci sia riga con transizione
|
||||
DS_applicazione.TraEv2StatiDataTable tabEv2St = taEv2St.getByKey(codMappa, codTipoObj, codStato, codEvento);
|
||||
if (tabEv2St.Rows.Count > 0)
|
||||
{
|
||||
switch (codTipoObj)
|
||||
{
|
||||
case "U":
|
||||
// aggiorno singolo obj
|
||||
XPS.obj.taObj.updateStato(tabEv2St[0].NextCodStato, user_std.UtSn.utente, DateTime.Now, idxObj);
|
||||
// chiamo update stato obj ancestors:
|
||||
XPS.obj.taSP.sp_updateAncestorState(string.Format("{0}%", idxObj.Substring(0, 8)));
|
||||
break;
|
||||
case "D":
|
||||
// sto scannando il DDT aggiorno tutto il tree...
|
||||
string codObjCommon = idxObj.Replace("D", "%");
|
||||
XPS.obj.taObj.updateStatoTree(tabEv2St[0].NextCodStato, user_std.UtSn.utente, DateTime.Now, codObjCommon);
|
||||
break;
|
||||
}
|
||||
// salvo esito
|
||||
answ = tipoEsito.ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
// non c'è, segnalo errore...
|
||||
answ = tipoEsito.error;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
taEv = new DS_applicazioneTableAdapters.EventiTableAdapter();
|
||||
taEv2St = new DS_applicazioneTableAdapters.TraEv2StatiTableAdapter();
|
||||
taIstObj = new DS_applicazioneTableAdapters.IstObjTableAdapter();
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua setup dei connection strings da web.config delal singola applicazione
|
||||
/// </summary>
|
||||
protected virtual void setupConnectionStringBase()
|
||||
{
|
||||
string connString = memLayer.ML.confReadString("XPSConnectionString");
|
||||
// connections strings del db
|
||||
taEv.Connection.ConnectionString = connString;
|
||||
taEv2St.Connection.ConnectionString = connString;
|
||||
taIstObj.Connection.ConnectionString = connString;
|
||||
}
|
||||
public static stateMachine st = new stateMachine();
|
||||
/// <summary>
|
||||
/// restituisce il tipo di comando associato...
|
||||
/// </summary>
|
||||
/// <param name="comando"></param>
|
||||
/// <returns></returns>
|
||||
public tipoAzione azioneComando(inputComando comando)
|
||||
{
|
||||
tipoAzione _azione = tipoAzione.noAct;
|
||||
string toDo = "";
|
||||
try
|
||||
{
|
||||
toDo = taEv.getByCodEvento(comando.currCmdIn)[0].Action;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
switch (toDo)
|
||||
{
|
||||
case "ok":
|
||||
_azione = tipoAzione.conferma;
|
||||
break;
|
||||
case "ko":
|
||||
_azione = tipoAzione.annulla;
|
||||
break;
|
||||
case "act":
|
||||
_azione = tipoAzione.esegui;
|
||||
break;
|
||||
default:
|
||||
_azione = tipoAzione.noAct;
|
||||
break;
|
||||
}
|
||||
return _azione;
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se sia possibile, dagli input segnalati, eseguire un comando secondo la tab transizione stati e restituisce adeguato output su esecuzione/errore e eventuali messaggi
|
||||
/// </summary>
|
||||
/// <param name="codMappa">mappa di riferimento</param>
|
||||
/// <param name="codTipoObj">oggetto di riferimento</param>
|
||||
/// <param name="codStato">stato corrente</param>
|
||||
/// <param name="codEvento">evento</param>
|
||||
/// <returns>oggetto di risposta x esito ok/ko</returns>
|
||||
public tipoEsito doAction(string codMappa, string idxObj, string codStato, string codEvento)
|
||||
{
|
||||
tipoEsito answ = tipoEsito.undef;
|
||||
string codTipoObj = ""; // di default pongo a vuoto...
|
||||
try
|
||||
{
|
||||
codTipoObj = taIstObj.getByIdxObj(idxObj)[0].CodObj;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// controllo su tab se ci sia riga con transizione
|
||||
DS_applicazione.TraEv2StatiDataTable tabEv2St = taEv2St.getByKey(codMappa, codTipoObj, codStato, codEvento);
|
||||
if (tabEv2St.Rows.Count > 0)
|
||||
{
|
||||
switch (codTipoObj)
|
||||
{
|
||||
case "U":
|
||||
// aggiorno singolo obj
|
||||
XPS.obj.taObj.updateStato(tabEv2St[0].NextCodStato, user_std.UtSn.utente, DateTime.Now, idxObj);
|
||||
// chiamo update stato obj ancestors:
|
||||
XPS.obj.taSP.sp_updateAncestorState(string.Format("{0}%", idxObj.Substring(0, 8)));
|
||||
break;
|
||||
case "D":
|
||||
// sto scannando il DDT aggiorno tutto il tree...
|
||||
string codObjCommon = idxObj.Replace("D", "%");
|
||||
XPS.obj.taObj.updateStatoTree(tabEv2St[0].NextCodStato, user_std.UtSn.utente, DateTime.Now, codObjCommon);
|
||||
break;
|
||||
}
|
||||
// salvo esito
|
||||
answ = tipoEsito.ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
// non c'è, segnalo errore...
|
||||
answ = tipoEsito.error;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
public enum tipoAzione
|
||||
{
|
||||
annulla,
|
||||
conferma,
|
||||
esegui,
|
||||
noAct
|
||||
}
|
||||
public enum tipoEsito
|
||||
{
|
||||
error,
|
||||
ok,
|
||||
undef
|
||||
}
|
||||
public enum tipoAzione
|
||||
{
|
||||
annulla,
|
||||
conferma,
|
||||
esegui,
|
||||
noAct
|
||||
}
|
||||
public enum tipoEsito
|
||||
{
|
||||
error,
|
||||
ok,
|
||||
undef
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user