Beispiel #1
0
        private int GetMaxID()
        {
            ControllerOperation8053 controllerOperation = new ControllerOperation8053();

            return(controllerOperation.GetMaxDeviceID());
        }
Beispiel #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.MaxDeviceIDInController8053 == id) //如果最大ID等于被删除的ID,则重新赋值
                    {
                        ControllerOperation8053 controllerOperation = new ControllerOperation8053();
                        BusinessLib.ProjectManager.GetInstance.MaxDeviceIDInController8053 = controllerOperation.GetMaxDeviceID();
                    }
                }
                ILoopDBService loopDBService = new  SCA.DatabaseAccess.DBContext.LoopDBService(dbFileVersionService);
                loopDBService.AddLoopInfo(TheLoop);
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }