private bool DeleteDeviceFromDB(int id) { try { IFileService _fileService = new SCA.BusinessLib.Utility.FileService(); ILogRecorder logger = null; IDatabaseService _databaseService = new SCA.DatabaseAccess.SQLiteDatabaseAccess(TheLoop.Controller.Project.SavePath, logger, _fileService); IDeviceDBServiceTest deviceDBService = SCA.DatabaseAccess.DBContext.DeviceManagerDBServiceTest.GetDeviceDBContext(TheLoop.Controller.Type, _databaseService); deviceDBService.DeleteDeviceByID(id); } catch (Exception ex) { return(false); } return(true); }
private bool DeleteControllerFromDB(ControllerModel controller) { try { IFileService _fileService = new SCA.BusinessLib.Utility.FileService(); ILogRecorder logger = null; IDatabaseService _databaseService = new SCA.DatabaseAccess.SQLiteDatabaseAccess(controller.Project.SavePath, logger, _fileService); IControllerDBService controllerDBService = new SCA.DatabaseAccess.DBContext.ControllerDBService(_databaseService); ILoopDBService loopDBService = new SCA.DatabaseAccess.DBContext.LoopDBService(_databaseService); IDeviceDBServiceTest deviceDBService = SCA.DatabaseAccess.DBContext.DeviceManagerDBServiceTest.GetDeviceDBContext(controller.Type, _databaseService); deviceDBService.DeleteAllDevicesByControllerID(controller.ID); loopDBService.DeleteLoopsByControllerID(controller.ID); controllerDBService.DeleteController(controller.ID); } catch (Exception ex) { return(false); } return(true); }