/// <summary> /// 添加设备信息 /// </summary> /// <param name="dev"></param> /// <param name="devBll"></param> private static bool AddDevInfo(DevInfoBackup dev, DevInfoBll devBll) { try { DevInfo devInfo = GetDevInfo(dev); DevPos devPos = GetDevPos(dev); devInfo.SetPos(devPos); //if (string.IsNullOrEmpty(devInfo.Local_DevID)) //{ //} DevInfo infoTemp = devBll.Find(i => i.Local_DevID == devInfo.Local_DevID); if (infoTemp == null) { return(devBll.Add(devInfo));//新设备,加入 } else { UpgradeDevInfo(infoTemp, devInfo);//已经存在的设备,更新 bool value = devBll.Edit(infoTemp); if (!value) { Log.Info("Error: EditDevinfo Error"); } return(value); } } catch (Exception e) { Log.Info("Error in DevInfoHelper.AddDevInfo:" + e.ToString()); return(false); } }
/// <summary> /// 移除被删除的设备 /// </summary> private static void RemoveDeleteDev(DevInfoBackup devTemp, DevInfoBll devBll) { DevInfo infoTemp = devBll.Find(i => i.Local_DevID == devTemp.DevId); if (infoTemp != null) { devBll.DeleteById(infoTemp.Id); } }
public TestBll(bool autoDetectChangesEnabled, bool lazyLoadingEnabled, bool isCreateDb) { Db = new LocationDb(isCreateDb); Db.Configuration.AutoDetectChangesEnabled = autoDetectChangesEnabled; Db.Configuration.LazyLoadingEnabled = lazyLoadingEnabled; //关闭延迟加载 Maps = new MapBll(Db); Areas = new AreaBll(Db); Position = new PositionBll(DbHistory); TagPositions = new TagPositionBll(Db); Departments = new DepartmentBll(Db); Users = new UserBll(Db); Tags = new TagBll(Db); Archors = new ArchorBll(Db); KKSCodes = new KKSCodeBll(Db); t_KKSCodes = new t_KKSCodeBll(Dbtopviewxp); t_SetModels = new t_SetModelBll(Db); t_TypeProperties = new t_Template_TypePropertyBll(Db); TransformMs = new TransformMBll(Db); DevInfos = new DevInfoBll(Db); DevPos = new DevPosBll(Db); U3DPositions = new U3DPositionBll(DbHistory); PhysicalTopologys = new PhysicalTopologyBll(Db); NodeKKSs = new NodeKKSBll(Db); Personnels = new PersonnelBll(Db); Posts = new PostBll(Db); JurisDictions = new JurisDictionBll(Db); JurisDictionRecords = new JurisDictionRecordBll(Db); Meterials = new MeterialBll(Db); //U3DPositions.ToList(); ConfigArgs = new ConfigArgBll(Db); Bounds = new BoundBll(Db); Points = new PointBll(Db); OperationTickets = new OperationTicketBll(Db); OperationItems = new OperationItemBll(Db); WorkTickets = new WorkTicketBll(Db); SafetyMeasuress = new SafetyMeasuresBll(Db); MobileInspections = new MobileInspectionBll(Db); MobileInspectionItems = new MobileInspectionItemBll(Db); MobileInspectionContents = new MobileInspectionContentBll(Db); MobileInspectionDevs = new MobileInspectionDevBll(Db); PersonnelMobileInspections = new PersonnelMobileInspectionBll(Db); PersonnelMobileInspectionItems = new PersonnelMobileInspectionItemBll(Db); PersonnelMobileInspectionHistorys = new PersonnelMobileInspectionHistoryBll(DbHistory); PersonnelMobileInspectionItemHistorys = new PersonnelMobileInspectionItemHistoryBll(DbHistory); OperationTicketHistorys = new OperationTicketHistoryBll(DbHistory); OperationItemHistorys = new OperationItemHistoryBll(DbHistory); WorkTicketHistorys = new WorkTicketHistoryBll(DbHistory); SafetyMeasuresHistorys = new SafetyMeasuresHistoryBll(DbHistory); Targets = new TargetBll(Db); Roles = new RoleBll(Db); Menus = new MenuBll(Db); Z.EntityFramework.Extensions.LicenseManager.AddLicense("34;100-LLHSWWHA", "384799A60700037CBFC0EB5E03A62474"); }
/// <summary> /// 添加设备信息 /// </summary> /// <param name="dev"></param> /// <param name="devBll"></param> private static void AddDevInfo(DevInfoBackup dev, DevInfoBll devBll) { try { DevInfo devInfo = GetDevInfo(dev); DevPos devPos = GetDevPos(dev); devInfo.SetPos(devPos); devBll.Add(devInfo); } catch (Exception e) { Console.WriteLine("Error in DevInfoHelper.AddDevInfo:" + e.ToString()); } }
/// <summary> /// 通过文件导入设备信息 /// </summary> /// <param name="filePath"></param> /// <param name="devBll"></param> /// <returns></returns> public static bool ImportDevInfoFromFile(string filePath, DevInfoBll devBll) { if (!File.Exists(filePath) || devBll == null) { return(false); } DevInfoBackupList initInfo = XmlSerializeHelper.LoadFromFile <DevInfoBackupList>(filePath); foreach (var devInfo in initInfo.DevList) { if (devInfo.TypeCode == LocationDeviceHelper.LocationDevTypeCode) { continue; } AddDevInfo(devInfo, devBll); } return(true); }
public DeviceService(Bll bll) { this.db = bll; dbSet = db.DevInfos; }
public DeviceService() { db = new Bll(false, false, false, false); dbSet = db.DevInfos; }
public Bll(bool autoDetectChangesEnabled, bool lazyLoadingEnabled, bool isCreateDb, bool useProxy = true) { Db = new LocationDb(isCreateDb); Db.Configuration.AutoDetectChangesEnabled = autoDetectChangesEnabled; Db.Configuration.LazyLoadingEnabled = lazyLoadingEnabled; //关闭延迟加载 Db.Configuration.ProxyCreationEnabled = useProxy; if (ShowLog) { Db.Database.Log = Log.Debug; } Archors = new ArchorBll(Db); Areas = new AreaBll(Db); Bounds = new BoundBll(Db); ConfigArgs = new ConfigArgBll(Db); Departments = new DepartmentBll(Db); DevAlarms = new DevAlarmBll(Db); DevInfos = new DevInfoBll(Db); Dev_DoorAccess = new Dev_DoorAccessBll(Db); Dev_CameraInfos = new Dev_CameraInfoBll(Db); DevInstantDatas = new DevInstantDataBll(Db); DevModels = new DevModelBll(Db); DevTypes = new DevTypeBll(Db); EntranceGuardCards = new EntranceGuardCardBll(Db); EntranceGuardCardToPersonnels = new EntranceGuardCardToPersonnelBll(Db); AreaAuthorizations = new AreaAuthorizationBll(Db); AreaAuthorizationRecords = new AreaAuthorizationRecordBll(Db); KKSCodes = new KKSCodeBll(Db); LocationAlarms = new LocationAlarmBll(Db); LocationCards = new LocationCardBll(Db); LocationCardPositions = new LocationCardPositionBll(Db); LocationCardToPersonnels = new LocationCardToPersonnelBll(Db); MobileInspections = new MobileInspectionBll(Db); MobileInspectionContents = new MobileInspectionContentBll(Db); MobileInspectionDevs = new MobileInspectionDevBll(Db); MobileInspectionItems = new MobileInspectionItemBll(Db); NodeKKSs = new NodeKKSBll(Db); OperationItems = new OperationItemBll(Db); OperationTickets = new OperationTicketBll(Db); Personnels = new PersonnelBll(Db); PersonnelMobileInspections = new PersonnelMobileInspectionBll(Db); PersonnelMobileInspectionItems = new PersonnelMobileInspectionItemBll(Db); Points = new PointBll(Db); Posts = new PostBll(Db); Roles = new RoleBll(Db); SafetyMeasuress = new SafetyMeasuresBll(Db); WorkTickets = new WorkTicketBll(Db); Pictures = new PictureBll(Db); ArchorSettings = new ArchorSettingBll(Db); CardRoles = new CardRoleBll(Db); DevMonitorNodes = new DevMonitorNodeBll(Db); //Shapes = new ShapeBll(Db); //ShapePoints = new ShapePointBll(); DevAlarmHistorys = new DevAlarmHistoryBll(DbHistory); DevEntranceGuardCardActions = new DevEntranceGuardCardActionBll(DbHistory); DevInfoHistorys = new DevInfoHistoryBll(DbHistory); DevInstantDataHistorys = new DevInstantDataHistoryBll(DbHistory); EntranceGuardCardHistorys = new EntranceGuardCardHistoryBll(DbHistory); EntranceGuardCardToPersonnelHistorys = new EntranceGuardCardToPersonnelHistoryBll(DbHistory); LocationAlarmHistorys = new LocationAlarmHistoryBll(DbHistory); LocationCardHistorys = new LocationCardHistoryBll(DbHistory); LocationCardToPersonnelHistorys = new LocationCardToPersonnelHistoryBll(DbHistory); OperationItemHistorys = new OperationItemHistoryBll(DbHistory); OperationTicketHistorys = new OperationTicketHistoryBll(DbHistory); PersonnelHistorys = new PersonnelHistoryBll(DbHistory); PersonnelMobileInspectionHistorys = new PersonnelMobileInspectionHistoryBll(DbHistory); PersonnelMobileInspectionItemHistorys = new PersonnelMobileInspectionItemHistoryBll(DbHistory); Positions = new PositionBll(DbHistory); SafetyMeasuresHistorys = new SafetyMeasuresHistoryBll(DbHistory); U3DPositions = new U3DPositionBll(DbHistory); WorkTicketHistorys = new WorkTicketHistoryBll(DbHistory); bus_anchors = new bus_anchorBll(DbE); bus_tags = new bus_tagBll(DbE); bus_anchor_config = new bus_anchor_configBll(DbE); bus_anchor_switch_area = new bus_anchor_switch_areaBll(DbE); //LocationCards.ToList(); //DevEntranceGuardCardActions.ToList(); //bus_archors.ToList(); Z.EntityFramework.Extensions.LicenseManager.AddLicense("34;100-LLHSWWHA", "384799A60700037CBFC0EB5E03A62474"); }
public DeviceService() { db = Bll.NewBllNoRelation(); dbSet = db.DevInfos; }