using AppData;
using SteamWare;
using System;
using System.IO;
using System.Web.UI;

namespace NKC_WF
{
    public class BasePage : System.Web.UI.Page
    {
        #region Protected Fields

        /// <summary>
        /// Membro gestione accessi al datalayer (istanza x ogni classe controllo)
        /// </summary>
        protected DataLayer DLMan = new DataLayer();

        /// <summary>
        /// Codice macchina (da v2)
        /// </summary>
        protected string PlaceCod = "WRK001";

        #endregion Protected Fields

        #region Public Methods

        /// <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);
        }

        /// <summary>
        /// Wrapper scrittura log INFO
        /// </summary>
        /// <param name="message"></param>
        public void lgInfo(string message)
        {
            logger.lg.scriviLog(message, tipoLog.INFO);
        }

        /// <summary>
        /// Wrapper traduzione termini
        /// </summary>
        /// <param name="lemma"></param>
        /// <returns></returns>
        public string traduci(string lemma)
        {
            return user_std.UtSn.Traduci(lemma);
        }

        #endregion Public Methods
    }
}