Ejemplo n.º 1
0
  /**
   * 数据库插入类型
   *
   * @param usercust 根据业务员名和客户名生成
   * @param type 根据不同的类型来
   */
  public synchronized List<PhotographType> insert_credit(String usercust, int type) {
    List<PhotographType> list =
        dbHelper.searchCriteria(PhotographType.class, "usercust", usercust, "type", type + "");
    if (list == null || list.size() == 0) {
      list = new ArrayList<PhotographType>();
      String[] cd = null;
      switch (type) {
        case 1: // 车贷
          cd =
              BaseApplication.getInstance()
                  .getResources()
                  .getStringArray(R.array.automobile_credit);
          break;
        case 2: // 房贷
          cd = BaseApplication.getInstance().getResources().getStringArray(R.array.mortgage);
          break;
        case 3: // 翼农贷三户联保贷
        case 4: // 翼农贷三户联保贷
          cd =
              BaseApplication.getInstance()
                  .getResources()
                  .getStringArray(R.array.wing_agricultural_loan);
          break;
        case 5: // 翼企贷
          cd =
              BaseApplication.getInstance()
                  .getResources()
                  .getStringArray(R.array.wing_enterprise_credit);
          break;
        case 6: // 翼商贷
          cd =
              BaseApplication.getInstance()
                  .getResources()
                  .getStringArray(R.array.wing_business_credit);
          break;
        default: //
          break;
      }

      for (int i = 0; i < cd.length; i++) {
        PhotographType photographType = new PhotographType();
        photographType.istrue = false;
        photographType.typename = cd[i];
        photographType.usercust = usercust;
        photographType.type = type;
        list.add(photographType);
      }
      dbHelper.saveAll(list);
    }
    return list;
  }
Ejemplo n.º 2
0
 private TypeDbInsert() {
   dbHelper = DbHelper.getInstance(BaseApplication.getInstance());
 }