using System; using System.Collections.Generic; using System.Linq; using DB.Entity; using DB.Service; using NewLife.Caching; using Tool.Model; namespace RfidWeb { public class PromptAlarmManager:BaseManager { PromptAlarm cPromptAlarm=new PromptAlarm(); public Dictionary GetList() { Dictionary dictionary = cache[CacheKeyManager.Prompt_alarmList] as Dictionary ?? new Dictionary(); List list = alarmDataService.GetList(); var listEs = GetDic(list, "", "Prompt_alarm"); var bools = cPromptAlarm.GetDb(); cache.Set(CacheKeyManager.Prompt_alarm, bools, timeOut); for (int i = 0; i < Max; i++) { var obj = bools[i]; if (!listEs.TryGetValue(i, out var value)) continue; if (Convert.ToBoolean(obj)) { if (!dictionary.ContainsKey(value)) { dictionary[value] = DateTime.Now; } } else { dictionary.Remove(value); } } cache.Set(CacheKeyManager.Prompt_alarmList, dictionary, TimeSpan.FromMinutes(10)); return dictionary; } } }