@Override public long inserir(ClienteTipo clienteTipo) throws RepositorioException { ContentValues values = new ContentValues(); values = clienteTipo.carregarValues(); try { return super.getDb().insert(clienteTipo.getNomeTabela(), "", values); } catch (SQLException sqe) { Log.e(ConstantesSistema.LOG_TAG, sqe.getMessage() + " " + sqe.getCause()); sqe.printStackTrace(); throw new RepositorioException( context.getResources().getString(R.string.db_error_insert_record)); } }
@Override public void remover(ClienteTipo clienteTipo) throws RepositorioException { String _id = String.valueOf(clienteTipo.getId()); String where = ClienteTipoColunas.ID + "=?"; String[] whereArgs = new String[] {_id}; try { super.getDb().delete(clienteTipo.getNomeTabela(), where, whereArgs); } catch (SQLException sqe) { Log.e(ConstantesSistema.LOG_TAG, sqe.getMessage() + " " + sqe.getCause()); sqe.printStackTrace(); throw new RepositorioException(context.getResources().getString(R.string.db_error)); } }
@Override public void atualizar(SetorComercial setorComercial) throws RepositorioException { ContentValues values = setorComercial.carregarValues(); String _id = String.valueOf(setorComercial.getId()); String where = SetorComercialColunas.ID + "=?"; String[] whereArgs = new String[] {_id}; try { super.getDb().update(setorComercial.getNomeTabela(), values, where, whereArgs); } catch (SQLException sqe) { Log.e(ConstantesSistema.LOG_TAG, sqe.getMessage() + " " + sqe.getCause()); sqe.printStackTrace(); throw new RepositorioException(context.getResources().getString(R.string.db_error)); } }