Пример #1
0
 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;
 }
Пример #2
0
 private void deletePreferedByCity() {
   preferenceDao
       .queryBuilder()
       .where(
           DBPreferenceDao.Properties.City.eq(city.toUpperCase()),
           DBPreferenceDao.Properties.Country.eq(country),
           DBPreferenceDao.Properties.State.eq(province))
       .buildDelete()
       .executeDeleteWithoutDetachingEntities();
 }
Пример #3
0
  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();
    }
  }
Пример #4
0
  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);
  }