123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- using System.Collections.Generic;
- using System.Linq;
- using GDNXFD.Data;
- namespace IntelligentControlForsx
- {
- public class ClientCache
- {
- private AlertServiceClient asc = null;
- public IList<AlertSnap> AlertSnaps { get; set; }
- public Dictionary<string, AlarmGroupModel> AlarmGroups { get; set; }
- public IList<ShutdownEvent> ShutdownEvents { get; set; }
- //光字牌分组统计,key: 光字牌ID
- public Dictionary<string, LightPlateModel> LPModels { get; set; }
- #region 单例模式
- private ClientCache()
- {
- }
- public static ClientCache Instance
- {
- get { return SingletonCreator.instance; }
- }
- class SingletonCreator
- {
- internal static readonly ClientCache instance = new ClientCache();
- }
- #endregion
- #region 数据字典
- public IList<DictItem> DataDict { get; set; }
- public IList<DictItem> GetDataDictByCategory(string category)
- {
- if (DataDict != null)
- {
- var tmp = DataDict.Where(c => c.Category == category && c.Enabled);
- if (tmp != null)
- return tmp.OrderBy(c => c.OrderNo).ToList();
- }
- return null;
- }
- #endregion
- #region 风机数据
- private IList<WindTurbine> wtList;
- private IList<WindPowerStation> stList;
- private IList<Project> prjList;
- private IList<Line> lnList;
- public IList<WindTurbine> WindturbineList
- {
- get
- {
- if (wtList == null)
- {
- if (asc == null)
- asc = AlertServiceClientFactory.CreateAlertServiceClient();
- wtList = asc.GetFDCWindturbinies();
- }
- return wtList;
- }
- set
- {
- wtList = value;
- }
- }
- public IList<WindPowerStation> StationList
- {
- get
- {
- if (stList == null)
- {
- if (asc == null)
- asc = AlertServiceClientFactory.CreateAlertServiceClient();
- stList = asc.GetWindPowerStations();
- }
- return stList;
- }
- set
- {
- stList = value;
- }
- }
- public IList<Project> ProjectList
- {
- get
- {
- if (prjList == null)
- {
- if (asc == null)
- asc = AlertServiceClientFactory.CreateAlertServiceClient();
- prjList = asc.GetProjects();
- }
- return prjList;
- }
- set
- {
- prjList = value;
- }
- }
- public IList<Line> LineList
- {
- get
- {
- if (lnList == null)
- {
- if (asc == null)
- asc = AlertServiceClientFactory.CreateAlertServiceClient();
- lnList = asc.GetLines();
- }
- return lnList;
- }
- set
- {
- lnList = value;
- }
- }
- #endregion
- }
- }
|