Пример #1
0
        public async Task <string> Home()
        {
            ViewData["dashboardNav"] = "active";
            ViewData["basicLogNav"]  = "";
            var result = await _logRepository.GetPageListAsync(1, 10, sorts : new[] { new Sort {
                                                                                          Ascending = false, PropertyName = "Id"
                                                                                      } });

            ViewData["unique"] = (await _logRepository.UniqueCountAsync()).Count;

            var now      = DateTime.Now;
            var weeHours = now.Date.AddHours(23).AddMinutes(59).AddSeconds(59);

            ViewData["todayCount"] = await _logRepository.CountAsync(x => x.LongDate >= now.Date && x.LongDate <= weeHours);

            var hour = now.AddHours(-1);

            ViewData["hourCount"] = await _logRepository.CountAsync(x => x.LongDate >= hour && x.LongDate <= now);

            ViewData["allCount"] = await _logRepository.CountAsync();

            //Chart Data
            ViewData["ChartData"] = (await LogChartFactory.GetLogChart(ChartDataType.Hour).GetCharts(_logRepository)).ToJsonString();

            return(await View(result));
        }
Пример #2
0
        public async Task <string> Home()
        {
            ViewBag.dashboardNav = "active";
            ViewBag.basicLogNav  = "";
            var result = await _logRepository.GetPageListAsync(1, 10, sorts : new Sort {
                Ascending = false, PropertyName = "Id"
            });

            ViewBag.unique = (await _logRepository.GetListAsync()).GroupBy(x => x.Message).Count(x => x.Count() == 1);
            var now      = DateTime.Now;
            var weeHours = now.Date.AddHours(23).AddMinutes(59);

            ViewBag.todayCount = await _logRepository.CountAsync(x => x.LongDate >= now.Date && x.LongDate <= weeHours);

            var hour = now.AddHours(-1);

            ViewBag.hourCount = await _logRepository.CountAsync(x => x.LongDate >= hour && x.LongDate <= now);

            ViewBag.allCount = await _logRepository.CountAsync();

            //Chart Data
            ViewBag.ChartData = (await LogChartFactory.GetLogChart(ChartDataType.Hour).GetCharts(_logRepository)).ToJsonString();

            return(await View(result));
        }
Пример #3
0
 public async Task <string> GetLogChart(GetChartDataInput input)
 {
     return(Json(await LogChartFactory.GetLogChart(input.ChartDataType).GetCharts(_logRepository)));
 }