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; /// /// Solleva evento nuovo valore /// 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()); } } /// /// Solleva evento reset /// public void raiseReset() { if (eh_resetSelezione != null) { eh_resetSelezione(this, new EventArgs()); } } #endregion gestione eventi /// /// Oggetto datalayer specifico NON singleton x scalare /// internal DataLayer DataLayerObj = new DataLayer(); /// /// UID formattato con "_" /// public string uid { get { return this.UniqueID.Replace("$", "_").Replace("-", "_"); } } /// /// titolo pagina /// public string titolo { get { return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", ""); } } #region utils /// /// effettua traduzione del lemma /// /// /// public string traduci(string lemma) { return user_std.UtSn.Traduci(lemma); } /// /// effettua traduzione in inglese del lemma /// /// /// public string traduciEn(string lemma) { return user_std.UtSn.TraduciEn(lemma); } /// /// formatta in minuti/sec partendo da min.cent /// /// /// public string minSec(object minCent) { string answ = ""; try { answ = string.Format("{0:mm}:{0:ss}", minCent2Sec(Convert.ToDecimal(minCent.ToString().Replace(".", ",")))); } catch { } return answ; } /// /// conversione da tempo minuti centesimali a minuti/secondi /// /// /// 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 } }