Пример #1
0
 private void initView(List<BoxDBBean> list) {
   mList.clear();
   BoxDBBean bean = null;
   for (int i = 0; i < list.size(); i++) {
     bean = list.get(i);
     Box boxBean = new Box();
     boxBean.setFlavorName(bean.getMaterial_name());
     boxBean.setFlavorBrand(bean.getBrand_name());
     boxBean.setBoxMac(bean.getBox_mac());
     mList.add(boxBean);
   }
   BoxAdd boxAddBean = new BoxAdd();
   mList.add(boxAddBean);
 }
Пример #2
0
  private void fillBoxList(GetBoxListRspBean rspBean) {
    // TODO Auto-generated method stub
    mList.clear();
    GetBoxBean bean = new GetBoxBean();
    Dao<BoxDBBean, Integer> daoBoxDBBean = null;
    try {
      daoBoxDBBean = DBTool.getDBHelper().getBoxDBBeanDao();
      // 删除所有
      daoBoxDBBean.executeRaw("delete from BoxDBBean ");
      daoBoxDBBean.executeRaw("update sqlite_sequence SET seq = 0 where name = 'boxdbbean' ");
    } catch (SQLException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }

    for (int i = 0; i < rspBean.getBoxList().size(); i++) {
      bean = rspBean.getBoxList().get(i);
      Box boxBean = new Box();
      boxBean.setFlavorName(bean.getMaterial_name());
      boxBean.setFlavorBrand(bean.getBrand_name());
      boxBean.setBoxMac(bean.getBox_mac());
      mList.add(boxBean);
      // shujuku

      BoxDBBean BoxArg = new BoxDBBean();
      BoxArg.setBox_id(bean.getBox_id());
      BoxArg.setBox_mac(bean.getBox_mac());
      BoxArg.setBrand_id(bean.getBrand_id());
      BoxArg.setBrand_name(bean.getBrand_name());
      BoxArg.setMaterial_id(bean.getMaterial_id());
      BoxArg.setMaterial_kind_id(bean.getMaterial_kind_id());
      BoxArg.setMaterial_name(bean.getMaterial_name());
      BoxArg.setMaterial_kind_name(bean.getMaterial_kind_name());
      BoxArg.setSw_ver(bean.getSw_ver());
      BoxArg.setCorpor_name(bean.getCorpor_name());
      BoxArg.setCorpor_tel(bean.getCorpor_tel());
      BoxArg.setCorpor_addr(bean.getCorpor_addr());
      BoxArg.setCorpor_url(bean.getCorpor_url());
      // 插入一条新的记录
      try {
        daoBoxDBBean.create(BoxArg);
      } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    BoxAdd boxAddBean = new BoxAdd();
    mList.add(boxAddBean);
  };