private void CheckAlarm() { for (int i = 0; i < 6; ++i) { mAlarms[i].Clear(); List <string> alarmCodes = ProcessService.Instance.GetAlarms((byte)(i + 1)); Random r = new Random(); int v = r.Next(0, 10); if (v == i) { for (int j = 0; j < alarmCodes.Count; ++j) { mAlarms[i].Add(alarmCodes[j]); Alarm alarm = mAlarmRepository.FindAlarm(i + 1, alarmCodes[j]); if (alarm == null) { //add alarm alarm = new Alarm(); alarm.TubeIndex = i + 1; alarm.ErrorCode = alarmCodes[j]; mAlarmRepository.CreateAlarm(alarm); } } } } Thread.Sleep(1000); CheckAlarm(); }
public void CreateAlarm(Alarm alarm) { _alarmRepo.CreateAlarm(alarm); }