Esempio n. 1
0
        private int GetMaxID()
        {
            ControllerOperation8001 controllerOperation = new ControllerOperation8001();

            return(controllerOperation.GetMaxDeviceID());
        }
Esempio n. 2
0
 private bool DeleteDeviceFromDB(int id)
 {
     try
     {
         IFileService          _fileService         = new SCA.BusinessLib.Utility.FileService();
         ILogRecorder          logger               = null;
         DBFileVersionManager  dbFileVersionManager = new DBFileVersionManager(TheLoop.Controller.Project.SavePath, logger, _fileService);
         IDBFileVersionService dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(DBFileVersionManager.CurrentDBFileVersion);
         IDeviceDBServiceTest  deviceDBService      = SCA.DatabaseAccess.DBContext.DeviceManagerDBServiceTest.GetDeviceDBContext(TheLoop.Controller.Type, dbFileVersionService);
         if (deviceDBService.DeleteDeviceByID(id))
         {
             if (BusinessLib.ProjectManager.GetInstance.MaxDeviceIDInController8001 == id) //如果最大ID等于被删除的ID,则重新赋值
             {
                 ControllerOperation8001 controllerOperation = new ControllerOperation8001();
                 BusinessLib.ProjectManager.GetInstance.MaxDeviceIDInController8001 = controllerOperation.GetMaxDeviceID();
             }
         }
         ILoopDBService loopDBService = new SCA.DatabaseAccess.DBContext.LoopDBService(dbFileVersionService); //更新回路中存储的器件数量
         loopDBService.AddLoopInfo(TheLoop);
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }