public boolean printPreferCompany() { List<DBPreference> preferenceList = preferenceDao.queryBuilder().list(); for (int i = 0; i < preferenceList.size(); i++) { Logger.d(TAG, "prefered: " + preferenceList.get(i).getCompanyName()); } return false; }
private void deletePreferedByCity() { preferenceDao .queryBuilder() .where( DBPreferenceDao.Properties.City.eq(city.toUpperCase()), DBPreferenceDao.Properties.Country.eq(country), DBPreferenceDao.Properties.State.eq(province)) .buildDelete() .executeDeleteWithoutDetachingEntities(); }
private void loadSavedAttrList() { List<DBPreference> preferedCompanyInThisCity = preferenceDao .queryBuilder() .where( DBPreferenceDao.Properties.City.eq(city.toUpperCase()), DBPreferenceDao.Properties.Country.eq(country), DBPreferenceDao.Properties.State.eq(province)) .list(); if (preferedCompanyInThisCity.size() == 0) { preferedAttrList = ""; } else { preferedAttrList = preferedCompanyInThisCity.get(0).getAttributeList(); } }
private void addPreference(CompanyItem item) { Address address = Utils.mPickupAddress; // over write company for this trip if changing preference for the same city if (address != null && province.equalsIgnoreCase(LocationUtils.states.get(address.getAdminArea())) && city.equalsIgnoreCase(address.getLocality()) && country.equalsIgnoreCase(address.getCountryCode())) { Utils.mSelectedCompany = item; Utils.selected_attribute = selectedAttrList; } DBPreference newPreference = new DBPreference(); newPreference.setAttributeList(Utils.setupAttributeIdList(selectedAttrList)); newPreference.setCity(city.toUpperCase()); newPreference.setCountry(country.toUpperCase()); newPreference.setCompanyName(item.name); newPreference.setDestId(item.destID); newPreference.setImg(item.logo); newPreference.setDescription(item.description); // Logger.e(TAG,"saving province: " + province + ", city: " + city + ", country: " + country); newPreference.setState(province.toUpperCase()); preferenceDao.insert(newPreference); }