96 lines
3.1 KiB
C#
96 lines
3.1 KiB
C#
using AppData;
|
|
using SteamWare;
|
|
using System;
|
|
using System.IO;
|
|
using System.Web.UI;
|
|
|
|
namespace NKC_WF
|
|
{
|
|
public class BasePage : System.Web.UI.Page
|
|
{
|
|
/// <summary>
|
|
/// Membro gestione accessi al datalayer (istanza x ogni classe controllo)
|
|
/// </summary>
|
|
protected DataLayer DLMan = new DataLayer();
|
|
/// <summary>
|
|
/// Wrapper traduzione termini
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(string lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma);
|
|
}
|
|
/// <summary>
|
|
/// Wrapper scrittura log INFO
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
public void lgInfo(string message)
|
|
{
|
|
logger.lg.scriviLog(message, tipoLog.INFO);
|
|
}
|
|
/// <summary>
|
|
/// Wrapper scrittura log ERROR
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
public void lgError(string message)
|
|
{
|
|
logger.lg.scriviLog(message, tipoLog.ERROR);
|
|
}
|
|
/// <summary>
|
|
/// Wrapper scrittura log EXCEPTION
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
public void lgException(string message, Exception exc)
|
|
{
|
|
logger.lg.scriviLog($"{message}{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
|
|
}
|
|
/// <summary>
|
|
/// Wrapper scrittura log FATAL
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
public void lgFatal(string message, Exception exc)
|
|
{
|
|
logger.lg.scriviLog(message, tipoLog.FATAL);
|
|
}
|
|
|
|
#region gestione compressione viewstate
|
|
|
|
/*--------------------------------------------------------------
|
|
* Compressione viewstate
|
|
*
|
|
* vedere https://www.codeproject.com/Articles/14733/ViewState-Compression
|
|
*
|
|
* da valutare anche
|
|
* https://www.karpach.com/viewstateexception-invalid-viewstate.htm
|
|
* https://www.karpach.com/ASP-NET-Global-asax-error-logger.htm
|
|
*
|
|
*--------------------------------------------------------------*/
|
|
|
|
|
|
#if false
|
|
protected override object LoadPageStateFromPersistenceMedium()
|
|
{
|
|
string viewState = Request.Form["__VSTATE"];
|
|
byte[] bytes = Convert.FromBase64String(viewState);
|
|
bytes = Compressor.Decompress(bytes);
|
|
LosFormatter formatter = new LosFormatter();
|
|
return formatter.Deserialize(Convert.ToBase64String(bytes));
|
|
}
|
|
|
|
protected override void SavePageStateToPersistenceMedium(object viewState)
|
|
{
|
|
LosFormatter formatter = new LosFormatter();
|
|
StringWriter writer = new StringWriter();
|
|
formatter.Serialize(writer, viewState);
|
|
string viewStateString = writer.ToString();
|
|
byte[] bytes = Convert.FromBase64String(viewStateString);
|
|
bytes = Compressor.Compress(bytes);
|
|
ClientScript.RegisterHiddenField("__VSTATE", Convert.ToBase64String(bytes));
|
|
}
|
|
#endif
|
|
|
|
#endregion
|
|
|
|
}
|
|
} |