public void deleteRecordByType(int btID) { IDBBatteryStorage dbStorage = new DBBatteryStorage(); int bsID = dbStorage.getRecordByType(btID, true).id; BatteryTypeCtr bCtr = new BatteryTypeCtr(); bool success = false; using (TransactionScope scope = new TransactionScope()) { try { deleteRecord(bsID); bCtr.deleteRecord(btID); success = true; } catch (Exception) { throw new System.NullReferenceException("Can not delete battery."); //throw new SystemException("Can not find battery type"); } if (success) { scope.Complete(); } } }
public void deleteBatteryType(int id) { BatteryTypeCtr tCtr = new BatteryTypeCtr(); tCtr.deleteRecord(id); }