acdf6b5975
git-svn-id: https://keyhammer.ath.cx/svn/GMW/trunk@186 365432ac-a1b5-4ffd-bb28-6d3099d32164
83 lines
2.7 KiB
C#
83 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using SteamWare;
|
|
|
|
namespace GMW_data
|
|
{
|
|
/// <summary>
|
|
/// classe gestioen amcchina a stati
|
|
/// </summary>
|
|
public class StateMachine
|
|
{
|
|
#region area table adapters
|
|
|
|
public DS_SMTableAdapters.TabTranPosizEventiTableAdapter taTTPE;
|
|
|
|
/// <summary>
|
|
/// init dei table adapters
|
|
/// </summary>
|
|
protected void initTA()
|
|
{
|
|
taTTPE = new GMW_data.DS_SMTableAdapters.TabTranPosizEventiTableAdapter();
|
|
}
|
|
/// <summary>
|
|
/// effettua setup dei connection strings da web.config delal singola applicazione
|
|
/// </summary>
|
|
protected virtual void setupConnectionStringBase()
|
|
{
|
|
// connections del db
|
|
taTTPE.Connection.ConnectionString = memLayer.ML.confReadString("GMWConnectionString");
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected StateMachine()
|
|
{
|
|
initTA();
|
|
setupConnectionStringBase();
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua la delibera dell'UDC andando a processare tramite macchina a stati l'eventuale spostamento di IdxPosizione
|
|
/// </summary>
|
|
/// <param name="UDC"></param>
|
|
/// <param name="CodTipoDelibera"></param>
|
|
/// <returns></returns>
|
|
public void deliberaUdc(string UDC, string CodTipoDelibera)
|
|
{
|
|
try
|
|
{
|
|
utils.obj.taSTP.stp_UDC_delibera(CodTipoDelibera, UDC, MagClass.magazzino.CodSoggCurrUser);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
logger.lg.scriviLog(string.Format("Non sono riuscito a fare la delibera di tipo {0} per l'UDC {1} da parte dell'user {2}, messaggio d'errore {3}{4}", CodTipoDelibera, UDC, user_std.UtSn.userNameAD, Environment.NewLine, e), SteamWare.tipoLog.ERROR);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// calcola dalla tabella di transizioni la nuova posizioen associata all'evento ed alla posizione attuale
|
|
/// </summary>
|
|
/// <param name="CodEvento"></param>
|
|
/// <param name="idxPosizione"></param>
|
|
/// <returns></returns>
|
|
public int getIdxPostizioneTo(string CodEvento, int idxPosizione)
|
|
{
|
|
int answ = 0;
|
|
try
|
|
{
|
|
answ = taTTPE.getByEventoPosizione(CodEvento, idxPosizione)[0].IdxPosizioneTo;
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Singleton accesos a state machine
|
|
/// </summary>
|
|
public static StateMachine SM = new StateMachine();
|
|
}
|
|
}
|