Exemple #1
0
        // GET: Monitor/AllZone
        public async Task <ActionResult> AllLine()
        {
            var monitors = await repository.GetAllAsync(null, c => c.MST_LOSS_GROUP);

            var viewModel = new MonitorViewModel
            {
                Monitors = monitors.ToList()
            };

            return(View(viewModel));
        }
        public async Task NotifyAsync()
        {
            try {
                var allMonitors = await _monitorRepository.GetAllAsync();

                var allMonitorIds = allMonitors.Where(x => !x.MonitorDetails.IsDown).Select(x => x.Id);

                var allCheckIns = await _checkInRepository.GetAllAsync();

                var checkInedMonitorIds = allCheckIns.Select(x => x.MonitorId);

                var noCheckinsFor = allMonitorIds.Except(checkInedMonitorIds);

                foreach (var monitorId in noCheckinsFor)
                {
                    var problematicMonitor = allMonitors.Where(x => x.Id.Equals(monitorId)).First();

                    if (problematicMonitor != null)
                    {
                        problematicMonitor.MonitorDetails.IsDown = true;

                        await _monitorRepository.CreateAsync(problematicMonitor);

                        await _emailService.SendEmailAsync(problematicMonitor.MonitorDetails.Subscribers, "Cant find check in for process", "Looks like your process goes off");
                    }
                }
            } catch (Exception ex) {
                _logger.LogError($"Something went wrong inside MonitorStatusNotifyer: {ex.Message}");
            }
        }
Exemple #3
0
        public async Task <IActionResult> GetMonitorsAsync()
        {
            try {
                var result = await _monitorRepository.GetAllAsync();

                return(Ok(result));
            } catch (Exception ex) {
                _logger.LogError($"Something went wrong inside GetMonitorsAsync: {ex.Message}");
                return(StatusCode(500, "Internal server error."));
            }
        }
Exemple #4
0
 public async Task <List <MonitorDetail> > GetMonitorDetails()
 {
     return(await _monitorRepository.GetAllAsync());
 }