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; } } /// /// Nome pagina /// public string pageName { get { return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", ""); } } /// /// UID formattato con "_" /// 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; } /// /// 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); } #endregion Public Methods #region Protected Fields protected resoconti _resoconti = new resoconti(); protected Dictionary OprLUT = new Dictionary(); #endregion Protected Fields #region Protected Methods protected virtual void doTranslate() { } /// /// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...) /// /// /// protected bool isMulti(string idxMacchina) { return DataLayerObj.isMulti(idxMacchina); } protected virtual void Page_Load(object sender, EventArgs e) { } /// /// Arrotondamento oggetto datetime all'intervallo timespan indicato /// /// Dataora /// Timespan arrotondamento (x eccesso) /// 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 /// /// Oggetto datalayer specifico /// private DataLayer DataLayerObj = new DataLayer(); #endregion Private Fields } }