예제 #1
0
 public AreaService(IAreaRepository _Repository, IAreaCacheService _AreaCacheService, IR_ArearestrictedpersonService _R_ArearestrictedpersonService, IAreaRuleService _AreaRuleService)
 {
     this._Repository       = _Repository;
     this._AreaCacheService = _AreaCacheService;
     this._R_ArearestrictedpersonService = _R_ArearestrictedpersonService;
     this._AreaRuleService = _AreaRuleService;
 }
예제 #2
0
        public Basic.Framework.Web.BasicResponse LoadAreaCache(Sys.Safety.Request.PersonCache.AreaCacheLoadRequest AreaCacheRequest)
        {
            AreaCache.AreaCacheInstance.Load();
            IAreaRuleService areaRuleService = ServiceFactory.Create <IAreaRuleService>();
            IR_ArearestrictedpersonService r_ArearestrictedpersonService = ServiceFactory.Create <IR_ArearestrictedpersonService>();
            //加载区域定义基本信息之后,加载区域定义拓展属性
            var areaDefineList = AreaCache.AreaCacheInstance.Query();

            if (areaDefineList.Any())
            {
                //区域设备类型定义限制信息
                var areaRuleList             = areaRuleService.GetAreaRuleList(new AreaRuleGetListRequest()).Data;
                var arearestrictedpersonList = r_ArearestrictedpersonService.GetArearestrictedpersonList(new Sys.Safety.Request.Arearestrictedperson.R_ArearestrictedpersonGetListRequest()).Data;
                areaDefineList.ForEach(nwModule =>
                {
                    var tempareaRuleList              = areaRuleList.FindAll(p => p.Areaid == nwModule.Areaid);
                    var tempRestrictedpersonInfoList  = arearestrictedpersonList.FindAll(p => p.AreaId == nwModule.Areaid);
                    nwModule.AreaRuleInfoList         = tempareaRuleList;
                    nwModule.RestrictedpersonInfoList = tempRestrictedpersonInfoList;
                });
                AreaCache.AreaCacheInstance.UpdateItems(areaDefineList);
            }
            return(new BasicResponse());
        }