92 lines
2.2 KiB
C#
92 lines
2.2 KiB
C#
using SteamWare;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace AppData
|
|
{
|
|
public class mUtils
|
|
{
|
|
/// <summary>
|
|
/// Codice Operatore
|
|
/// </summary>
|
|
public static string CodOpr
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
answ = memLayer.ML.StringSessionObj("CodOpr");
|
|
// se vuoto cerco anche nei cookies...
|
|
if (answ == "")
|
|
{
|
|
answ = memLayer.ML.getCookieVal("CTrack_CodOpr");
|
|
// se non vuoto salvo...
|
|
memLayer.ML.setSessionVal("CodOpr", answ);
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("CodOpr", value);
|
|
memLayer.ML.setCookieVal("CTrack_CodOpr", value);
|
|
memLayer.ML.emptySessionVal("NomeOpr");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Codice postazione di lavoro
|
|
/// </summary>
|
|
public static string CodPost
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
answ = memLayer.ML.StringSessionObj("CodPost");
|
|
if (answ == "")
|
|
{
|
|
answ = memLayer.ML.getCookieVal("CTrack_CodPost");
|
|
// se non vuoto salvo...
|
|
memLayer.ML.setSessionVal("CodPost", answ);
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("CodPost", value);
|
|
memLayer.ML.setCookieVal("CTrack_CodPost", value);
|
|
memLayer.ML.emptySessionVal("DescPost");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Restituisce i dati della postazione corrente (SE selezionata...)
|
|
/// </summary>
|
|
public static DS_App.AnagPostRow postCorrente
|
|
{
|
|
get
|
|
{
|
|
DS_App.AnagPostRow answ = null;
|
|
string rawData = memLayer.ML.StringSessionObj("postCorrente");
|
|
if (rawData != "")
|
|
{
|
|
// cerco di deserializzare...
|
|
answ = JsonConvert.DeserializeObject<DS_App.AnagPostRow>(rawData);
|
|
}
|
|
// se non ho ancora valore...
|
|
if (answ == null)
|
|
{
|
|
// provo a recuperare dati...
|
|
try
|
|
{
|
|
answ = dataLayer.man.taAP.getByKey(CodPost)[0];
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
string rawData = JsonConvert.SerializeObject(value, Formatting.Indented);
|
|
memLayer.ML.setSessionVal("postCorrente", rawData);
|
|
}
|
|
}
|
|
}
|
|
}
|