Ejemplo n.º 1
0
 public int insertBatchColleges() {
   Log.i(TAG, "insertBatchColleges start time: " + new Date().toLocaleString());
   List<College> list = new ArrayList<College>();
   for (int i = 0; i < NUM; i++) {
     list.add(getCollege(i));
   }
   int delAllCount = SimpleDao.getCollegeDao(mContext).deleteAll();
   Log.i(
       TAG,
       "delAllCount delAllCount= "
           + delAllCount
           + "delAllCount time: "
           + new Date().toLocaleString());
   int count = SimpleDao.getCollegeDao(mContext).insertBatch(list);
   Log.i(TAG, "insertBatchColleges DONE count: " + count + ",Time=" + new Date().toLocaleString());
   return count;
 }
Ejemplo n.º 2
0
 public String getAreaInfo(String proviceName) {
   StringBuffer buf = new StringBuffer();
   Area prov = SimpleDao.getAreaDao(mContext).getProvice(proviceName);
   if (prov == null) return null;
   int proviceId = (int) prov.getId();
   buf.append("PROVICE: " + proviceName + ", Id= " + proviceId).append("\n");
   List<Area> cityList = SimpleDao.getAreaDao(mContext).getChildArea(proviceId);
   if (cityList != null) {
     for (Area area : cityList) {
       buf.append("\n\t\tCITY: ")
           .append(area.getId() + ", ")
           .append(area.getName() + ",  ")
           .append(area.getIdxChar() + ",  ")
           .append(area.getPid())
           .append("\n");
       int cityId = (int) area.getId();
       buf.append(getDistrictsInfo(cityId));
     }
   }
   return buf.toString();
 }
Ejemplo n.º 3
0
 public StringBuffer getCollegeInfo() {
   StringBuffer info = new StringBuffer();
   info.append("\n colleges: \n");
   List<College> colleges = SimpleDao.getCollegeDao(mContext).getAll();
   if (colleges != null) {
     for (int i = 0; i < colleges.size(); i++) {
       College c = colleges.get(i);
       info.append(c.getCollegeId()).append("   ").append(c.getCollegeName()).append("\n");
     }
   }
   return info;
 }
Ejemplo n.º 4
0
 public String getDistrictsInfo(int cityId) {
   StringBuffer buf = new StringBuffer();
   List<Area> distList = SimpleDao.getAreaDao(mContext).getChildArea(cityId);
   if (distList != null) {
     for (Area dist : distList) {
       buf.append("\t\t\t\tDIST: ")
           .append(dist.getId() + ", ")
           .append(dist.getName() + ",  ")
           .append(dist.getIdxChar() + ",  ")
           .append(dist.getPid())
           .append("\n");
     }
   }
   return buf.toString();
 }
Ejemplo n.º 5
0
 public void addCollege(int i) {
   College cl = getCollege(i);
   SavedResult res = SimpleDao.getCollegeDao(mContext).save(cl);
   Log.i(TAG, "save college SavedResult= " + res);
 }
Ejemplo n.º 6
0
 public College getCollegeInfo(String collegeId) {
   College cl = SimpleDao.getCollegeDao(mContext).getCollege(collegeId);
   return cl;
 }