protected void Page_Load(object sender, EventArgs e) { try { Common.prepareDatabase(); if (Session["_winkToken"] == null) { Response.Redirect("~/login.aspx", false); } else { string startpage = SettingMgmt.getSetting("StartPage"); if (string.IsNullOrWhiteSpace(startpage)) { startpage = "Control.aspx"; } Response.Redirect("~/" + startpage, false); } } catch (Exception ex) { throw; //EventLog.WriteEntry("WinkAtHome.Default.Page_Load", ex.Message, EventLogEntryType.Error); } }
protected void Page_Load(object sender, EventArgs e) { string strShowPubNub = SettingMgmt.getSetting("Show-Pubnub-Log-In-Monitor"); if (strShowPubNub.ToLower() == "true" && PubNub.myPubNub.hasPubNub) { rowPubNub.Visible = true; } else { rowPubNub.Visible = false; } }
public static DateTime getLocalTime() { Int32 timezone = 0; string strtimezone = SettingMgmt.getSetting("TimeZone-Adjuster"); Int32.TryParse(strtimezone, out timezone); DateTime dtnow = DateTime.Now.ToUniversalTime().AddHours(timezone); if (DateTime.Now.IsDaylightSavingTime()) { dtnow = dtnow.AddHours(1); } return(dtnow); }
public static DateTime FromUnixTime(string unixTime, bool ConvertToLocalTimezone = false) { try { Double longTime; bool converted = Double.TryParse(unixTime, out longTime); DateTime epoch = new DateTime(1970, 1, 1); epoch = epoch.AddSeconds(longTime); if (ConvertToLocalTimezone) { string strUsertimezone = SettingMgmt.getSetting("TimeZone-Adjuster"); string strWinktimezone = ConfigurationManager.AppSettings["WinkServerTimeZoneAdjustment"]; Int32 usertimezone = 0; Int32 winktimezone = 0; Int32.TryParse(strUsertimezone, out usertimezone); Int32.TryParse(strWinktimezone, out winktimezone); DateTime utcTime = epoch.ToUniversalTime(); epoch = utcTime.AddHours(usertimezone - winktimezone); if (DateTime.Now.IsDaylightSavingTime()) { epoch = epoch.AddHours(1); } } else { epoch = epoch.ToLocalTime(); } return(epoch); } catch (Exception ex) { return(DateTime.MinValue); throw; //EventLog.WriteEntry("WinkAtHome.Common.FromUnixTime", ex.Message, EventLogEntryType.Error); } }
protected void Page_Load(object sender, EventArgs e) { try { Common.prepareDatabase(); if (Session["_winkToken"] == null) { Response.Redirect("~/Login.aspx"); } if (!IsPostBack) { ibVersion.Text = Common.currentVersion; if (Common.isLocalHost) { bool hasUpdate = Common.checkForUpdate(); if (hasUpdate) { ibVersion.Text = "UPDATE AVAILABLE!"; ibVersion.Enabled = true; lblCurrentVersion.Text = Common.currentVersion; lblNewVersion.Text = Common.newVersion; tbReleaseNotes.Text = Common.updateNotes; hlDownloadUpdate.NavigateUrl = Common.updateFilePath; mpeUpdate.Show(); } } if (Common.isLocalHost) { rowBottomAds.Visible = false; rowMenuAdds.Visible = false; } lblRefreshed.Text = Common.getLocalTime().ToString(); //SET PAGE OPTIONS string timerrefresh = SettingMgmt.getSetting("RefreshTimer-" + Request.RawUrl.Replace("/", "").Replace(".aspx", "")); if (timerrefresh != null) { tbTimer.Text = timerrefresh; tmrRefresh.Interval = Convert.ToInt32(tbTimer.Text) * 60000; } string timerenabled = SettingMgmt.getSetting("RefreshEnabled-" + Request.RawUrl.Replace("/", "").Replace(".aspx", "")); if (timerenabled != null) { rblenabled.SelectedValue = timerenabled; tmrRefresh.Enabled = Convert.ToBoolean(rblenabled.SelectedValue); } string menustate = SettingMgmt.getSetting("Menu-Default-State"); if (menustate != null) { if (menustate == "hide") { tblCollapsed.Visible = true; tblExpand.Visible = false; } else { tblCollapsed.Visible = false; tblExpand.Visible = true; } cellMenu.BackColor = tblExpand.Visible ? System.Drawing.ColorTranslator.FromHtml("#eeeeee") : System.Drawing.ColorTranslator.FromHtml("#22b9ec"); } //SET PUBNUB //PubNub pubnub = PubNub.myPubNub; //if (pubnub.hasPubNub) //{ // pubnub.Open(); //} } } catch (Exception ex) { throw; //EventLog.WriteEntry("WinkAtHome.Master.Page_Load", ex.Message, EventLogEntryType.Error); } }