public IActionResult About()
        {
            ViewData["StartupTimeDate"] = "";
            ViewData["Alive"]           = "";
            ViewData["Stats"]           = "";
            if (_signInManager.IsSignedIn(User))
            {
                TZone tzone = LocalManager.GetUserTimeZone(HttpContext, User, _userManager, _signInManager, _db)
                              .GetAwaiter().GetResult();

                ViewData["StartupTimeDate"] = "Startup Time " +
                                              tzone.Local(Globals.StartupDateTime).ToShortTimeString()
                                              + " " + tzone.Local(Globals.StartupDateTime).ToShortDateString() +
                                              " " + tzone.Abbreviation;

                TimeSpan timeSpan = Globals.Uptime();

                ViewData["Alive"] = "System up: " + timeSpan.Days + " Days "
                                    + timeSpan.Hours + " Hours " + timeSpan.Minutes + " Minutes "
                                    + timeSpan.Seconds + " Seconds";

                long count     = _db.NoteHeader.Count();
                long basenotes = _db.NoteHeader
                                 .Count(p => p.ResponseOrdinal == 0);

                ViewData["Stats"] = "Base Notes: " + basenotes + ", Responses: " + (count - basenotes) +
                                    ", Total Notes: " + count;
            }
            ViewData["Message"] = "About Notes 2021 : " + ViewData["StartupTimeDate"];

            return(View());
        }
示例#2
0
        public async Task UpdateHomePageTime(string username, TZone tzone)
        {
            string stuff = tzone.Local(DateTime.Now.ToUniversalTime()).ToShortTimeString() + " " + tzone.Abbreviation + " - " +
                           tzone.Local(DateTime.Now.ToUniversalTime()).ToLongDateString();

            var options = new PusherOptions()
            {
                Encrypted = true,
                Cluster   = Globals.PusherCluster
            };
            Pusher         pusher = new Pusher(Globals.PusherAppId, Globals.PusherKey, Globals.PusherSecret, options);
            var            data   = new { message = stuff };
            ITriggerResult x      = await pusher.TriggerAsync("notes-data-" + username, "update-time", data);

            if (x.StatusCode != System.Net.HttpStatusCode.OK)
            {
                RecurringJob.RemoveIfExists(username);
            }
        }