153 lines
3.7 KiB
C#
153 lines
3.7 KiB
C#
using MapoDb;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace MP_SITE.WebUserControls
|
|
{
|
|
public class baseUserControl : System.Web.UI.UserControl
|
|
{
|
|
#region Public Properties
|
|
|
|
public string cognomeNome
|
|
{
|
|
get
|
|
{
|
|
string answ = "USER ND";
|
|
if (user_std.UtSn != null)
|
|
{
|
|
try
|
|
{
|
|
answ = user_std.UtSn.CognomeNome;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Nome pagina
|
|
/// </summary>
|
|
public string pageName
|
|
{
|
|
get
|
|
{
|
|
return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", "");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// UID formattato con "_"
|
|
/// </summary>
|
|
public string uid
|
|
{
|
|
get
|
|
{
|
|
return this.UniqueID.Replace("$", "_").Replace("-", "_");
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public string operatoreDaMatr(object matricola)
|
|
{
|
|
int matr = 0;
|
|
string answ = "N.A.";
|
|
try
|
|
{
|
|
matr = Convert.ToInt32(matricola);
|
|
}
|
|
catch
|
|
{ }
|
|
// cerco in LUT...
|
|
if (OprLUT.ContainsKey(matr))
|
|
{
|
|
answ = OprLUT[matr];
|
|
}
|
|
else
|
|
{
|
|
answ = _resoconti.oprDaMatr(matr);
|
|
OprLUT.Add(matr, answ);
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua traduzione del lemma
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(string lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma);
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua traduzione in inglese del lemma
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduciEn(string lemma)
|
|
{
|
|
return user_std.UtSn.TraduciEn(lemma);
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Fields
|
|
|
|
protected resoconti _resoconti = new resoconti();
|
|
|
|
protected Dictionary<int, string> OprLUT = new Dictionary<int, string>();
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Methods
|
|
|
|
protected virtual void doTranslate()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...)
|
|
/// </summary>
|
|
/// <param name="idxMacchina"></param>
|
|
/// <returns></returns>
|
|
protected bool isMulti(string idxMacchina)
|
|
{
|
|
return DataLayerObj.isMulti(idxMacchina);
|
|
}
|
|
|
|
protected virtual void Page_Load(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Arrotondamento oggetto datetime all'intervallo timespan indicato
|
|
/// </summary>
|
|
/// <param name="dt">Dataora</param>
|
|
/// <param name="d">Timespan arrotondamento (x eccesso)</param>
|
|
/// <returns></returns>
|
|
protected DateTime RoundUp(DateTime dt, TimeSpan d)
|
|
{
|
|
return new DateTime((dt.Ticks + d.Ticks - 1) / d.Ticks * d.Ticks, dt.Kind);
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
/// <summary>
|
|
/// Oggetto datalayer specifico
|
|
/// </summary>
|
|
private DataLayer DataLayerObj = new DataLayer();
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |