136 lines
3.4 KiB
C#
136 lines
3.4 KiB
C#
using MapoDb;
|
|
using SteamWare;
|
|
using System;
|
|
|
|
namespace MP_ADM
|
|
{
|
|
public class BaseUserControl : System.Web.UI.UserControl
|
|
{
|
|
#region gestione eventi
|
|
|
|
public event EventHandler eh_nuovoValore;
|
|
|
|
public event EventHandler eh_resetSelezione;
|
|
|
|
public event EventHandler eh_selValore;
|
|
|
|
/// <summary>
|
|
/// Solleva evento nuovo valore
|
|
/// </summary>
|
|
public void raiseNewVal()
|
|
{
|
|
// evento come nuovo...
|
|
if (eh_nuovoValore != null)
|
|
{
|
|
eh_nuovoValore(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
public void raiseSelNew()
|
|
{
|
|
// sollevo evento nuovo valore...
|
|
if (eh_selValore != null)
|
|
{
|
|
eh_selValore(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Solleva evento reset
|
|
/// </summary>
|
|
public void raiseReset()
|
|
{
|
|
if (eh_resetSelezione != null)
|
|
{
|
|
eh_resetSelezione(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
#endregion gestione eventi
|
|
|
|
/// <summary>
|
|
/// Oggetto datalayer specifico NON singleton x scalare
|
|
/// </summary>
|
|
internal DataLayer DataLayerObj = new DataLayer();
|
|
|
|
/// <summary>
|
|
/// UID formattato con "_"
|
|
/// </summary>
|
|
public string uid
|
|
{
|
|
get
|
|
{
|
|
return this.UniqueID.Replace("$", "_").Replace("-", "_");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// titolo pagina
|
|
/// </summary>
|
|
public string titolo
|
|
{
|
|
get
|
|
{
|
|
return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", "");
|
|
}
|
|
}
|
|
|
|
#region utils
|
|
|
|
/// <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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// formatta in minuti/sec partendo da min.cent
|
|
/// </summary>
|
|
/// <param name="minCent"></param>
|
|
/// <returns></returns>
|
|
public string minSec(object minCent)
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
answ = string.Format("{0:mm}:{0:ss}", minCent2Sec(Convert.ToDecimal(minCent.ToString().Replace(".", ","))));
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// conversione da tempo minuti centesimali a minuti/secondi
|
|
/// </summary>
|
|
/// <param name="valore"></param>
|
|
/// <returns></returns>
|
|
protected TimeSpan minCent2Sec(decimal valore)
|
|
{
|
|
TimeSpan answ = new TimeSpan(0, 0, 1);
|
|
try
|
|
{
|
|
answ = new TimeSpan(0, Convert.ToInt32(valore), Convert.ToInt32((valore - Convert.ToInt32(valore)) * 60));
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
|
|
#endregion utils
|
|
}
|
|
} |