/**
   * 删除操作 删除条件:主键
   *
   * @return boolean
   */
  public boolean delete() {
    PreparedStatement pstmt = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      int tCount = this.size();
      pstmt = con.prepareStatement("DELETE FROM LEDOccupation WHERE  OccupationCode = ?");
      for (int i = 1; i <= tCount; i++) {
        if (this.get(i).getOccupationCode() == null
            || this.get(i).getOccupationCode().equals("null")) {
          pstmt.setString(1, null);
        } else {
          pstmt.setString(1, this.get(i).getOccupationCode());
        }
        pstmt.addBatch();
      }
      pstmt.executeBatch();
      pstmt.close();
    } catch (Exception ex) {
      // @@错误处理
      ex.printStackTrace();
      this.mErrors.copyAllErrors(db.mErrors);
      CError tError = new CError();
      tError.moduleName = "LEDOccupationDBSet";
      tError.functionName = "delete()";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      try {
        pstmt.close();
      } catch (Exception e) {
        e.printStackTrace();
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    return true;
  }
Exemplo n.º 2
0
  public boolean delete() {
    PreparedStatement pstmt = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      pstmt =
          con.prepareStatement("DELETE FROM LEDAdSource WHERE  ProductCode = ? AND SiteCode = ?");
      if (this.getProductCode() == null || this.getProductCode().equals("null")) {
        pstmt.setNull(1, 12);
      } else {
        pstmt.setString(1, this.getProductCode());
      }
      if (this.getSiteCode() == null || this.getSiteCode().equals("null")) {
        pstmt.setNull(2, 12);
      } else {
        pstmt.setString(2, this.getSiteCode());
      }
      pstmt.executeUpdate();
      pstmt.close();
    } catch (Exception ex) {
      // @@错误处理
      this.mErrors.copyAllErrors(db.mErrors);
      CError tError = new CError();
      tError.moduleName = "LEDAdSourceDB";
      tError.functionName = "delete()";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      try {
        pstmt.close();
      } catch (Exception e) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception e) {
        }
      }

      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return true;
  }
  /**
   * 准备数据查询条件
   *
   * @param strSQL String
   * @return boolean
   */
  public boolean prepareData(String strSQL) {
    if (mResultSet != null) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "prepareData";
      tError.errorMessage = "数据集非空,程序在准备数据集之后,没有关闭!";
      this.mErrors.addOneError(tError);
      return false;
    }

    if (!mflag) {
      con = DBConnPool.getConnection();
    }
    try {
      mStatement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      mResultSet = mStatement.executeQuery(StrTool.GBKToUnicode(strSQL));
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "prepareData";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);
      try {
        mResultSet.close();
      } catch (Exception ex2) {
      }
      try {
        mStatement.close();
      } catch (Exception ex3) {
      }
      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }
    return true;
  }
Exemplo n.º 4
0
  /**
   * 新增操作
   *
   * @return boolean
   */
  public boolean insert() {
    PreparedStatement pstmt = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      int tCount = this.size();
      pstmt =
          con.prepareStatement(
              "INSERT INTO LECBnf VALUES( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)");
      for (int i = 1; i <= tCount; i++) {
        if (this.get(i).getContNo() == null || this.get(i).getContNo().equals("null")) {
          pstmt.setString(1, null);
        } else {
          pstmt.setString(1, this.get(i).getContNo());
        }
        if (this.get(i).getPolNo() == null || this.get(i).getPolNo().equals("null")) {
          pstmt.setString(2, null);
        } else {
          pstmt.setString(2, this.get(i).getPolNo());
        }
        if (this.get(i).getInsuredNo() == null || this.get(i).getInsuredNo().equals("null")) {
          pstmt.setString(3, null);
        } else {
          pstmt.setString(3, this.get(i).getInsuredNo());
        }
        if (this.get(i).getBnfType() == null || this.get(i).getBnfType().equals("null")) {
          pstmt.setString(4, null);
        } else {
          pstmt.setString(4, this.get(i).getBnfType());
        }
        pstmt.setDouble(5, this.get(i).getBnfNo());
        if (this.get(i).getBnfGrade() == null || this.get(i).getBnfGrade().equals("null")) {
          pstmt.setString(6, null);
        } else {
          pstmt.setString(6, this.get(i).getBnfGrade());
        }
        if (this.get(i).getRelationToInsured() == null
            || this.get(i).getRelationToInsured().equals("null")) {
          pstmt.setString(7, null);
        } else {
          pstmt.setString(7, this.get(i).getRelationToInsured());
        }
        pstmt.setDouble(8, this.get(i).getBnfLot());
        if (this.get(i).getCustomerNo() == null || this.get(i).getCustomerNo().equals("null")) {
          pstmt.setString(9, null);
        } else {
          pstmt.setString(9, this.get(i).getCustomerNo());
        }
        if (this.get(i).getName() == null || this.get(i).getName().equals("null")) {
          pstmt.setString(10, null);
        } else {
          pstmt.setString(10, this.get(i).getName());
        }
        if (this.get(i).getSex() == null || this.get(i).getSex().equals("null")) {
          pstmt.setString(11, null);
        } else {
          pstmt.setString(11, this.get(i).getSex());
        }
        if (this.get(i).getBirthday() == null || this.get(i).getBirthday().equals("null")) {
          pstmt.setDate(12, null);
        } else {
          pstmt.setDate(12, Date.valueOf(this.get(i).getBirthday()));
        }
        if (this.get(i).getBnfIDType() == null || this.get(i).getBnfIDType().equals("null")) {
          pstmt.setString(13, null);
        } else {
          pstmt.setString(13, this.get(i).getBnfIDType());
        }
        if (this.get(i).getBnfIDNo() == null || this.get(i).getBnfIDNo().equals("null")) {
          pstmt.setString(14, null);
        } else {
          pstmt.setString(14, this.get(i).getBnfIDNo());
        }
        if (this.get(i).getOperator() == null || this.get(i).getOperator().equals("null")) {
          pstmt.setString(15, null);
        } else {
          pstmt.setString(15, this.get(i).getOperator());
        }
        if (this.get(i).getMakeDate() == null || this.get(i).getMakeDate().equals("null")) {
          pstmt.setDate(16, null);
        } else {
          pstmt.setDate(16, Date.valueOf(this.get(i).getMakeDate()));
        }
        if (this.get(i).getMakeTime() == null || this.get(i).getMakeTime().equals("null")) {
          pstmt.setString(17, null);
        } else {
          pstmt.setString(17, this.get(i).getMakeTime());
        }
        if (this.get(i).getModifyDate() == null || this.get(i).getModifyDate().equals("null")) {
          pstmt.setDate(18, null);
        } else {
          pstmt.setDate(18, Date.valueOf(this.get(i).getModifyDate()));
        }
        if (this.get(i).getModifyTime() == null || this.get(i).getModifyTime().equals("null")) {
          pstmt.setString(19, null);
        } else {
          pstmt.setString(19, this.get(i).getModifyTime());
        }
        pstmt.addBatch();
      }
      pstmt.executeBatch();
      pstmt.close();
    } catch (Exception ex) {
      // @@错误处理
      ex.printStackTrace();
      this.mErrors.copyAllErrors(db.mErrors);
      CError tError = new CError();
      tError.moduleName = "LECBnfDBSet";
      tError.functionName = "insert()";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      try {
        pstmt.close();
      } catch (Exception e) {
        e.printStackTrace();
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    return true;
  }
  public boolean update(String strWherePart) {
    Statement stmt = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      SQLString sqlObj = new SQLString("LEDEPolicyMailInfo");
      LEDEPolicyMailInfoSchema aSchema = this.getSchema();
      sqlObj.setSQL(2, aSchema);
      String sql = "update LEDEPolicyMailInfo " + sqlObj.getUpdPart() + " where " + strWherePart;

      int operCount = stmt.executeUpdate(sql);
      if (operCount == 0) {
        // @@错误处理
        CError tError = new CError();
        tError.moduleName = "LEDEPolicyMailInfoDB";
        tError.functionName = "update";
        tError.errorMessage = "更新数据失败!";
        this.mErrors.addOneError(tError);

        if (!mflag) {
          try {
            con.close();
          } catch (Exception et) {
          }
        }
        return false;
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "update";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        stmt.close();
      } catch (Exception ex1) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
      return false;
    }
    // 断开数据库连接
    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return true;
  }
  public LEDEPolicyMailInfoSet executeQuery(String sql, int nStart, int nCount) {
    Statement stmt = null;
    ResultSet rs = null;
    LEDEPolicyMailInfoSet aLEDEPolicyMailInfoSet = new LEDEPolicyMailInfoSet();

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);

      rs = stmt.executeQuery(StrTool.GBKToUnicode(sql));
      int i = 0;
      while (rs.next()) {
        i++;

        if (i < nStart) {
          continue;
        }

        if (i >= nStart + nCount) {
          break;
        }

        LEDEPolicyMailInfoSchema s1 = new LEDEPolicyMailInfoSchema();
        if (!s1.setSchema(rs, i)) {
          // @@错误处理
          CError tError = new CError();
          tError.moduleName = "LEDEPolicyMailInfoDB";
          tError.functionName = "executeQuery";
          tError.errorMessage = "sql语句有误,请查看表名及字段名信息!";
          this.mErrors.addOneError(tError);
        }
        aLEDEPolicyMailInfoSet.add(s1);
      }
      try {
        rs.close();
      } catch (Exception ex) {
      }
      try {
        stmt.close();
      } catch (Exception ex1) {
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "executeQuery";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        rs.close();
      } catch (Exception ex2) {
      }
      try {
        stmt.close();
      } catch (Exception ex3) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return aLEDEPolicyMailInfoSet;
  }
  public LEDEPolicyMailInfoSet query() {
    Statement stmt = null;
    ResultSet rs = null;
    LEDEPolicyMailInfoSet aLEDEPolicyMailInfoSet = new LEDEPolicyMailInfoSet();

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      SQLString sqlObj = new SQLString("LEDEPolicyMailInfo");
      LEDEPolicyMailInfoSchema aSchema = this.getSchema();
      sqlObj.setSQL(5, aSchema);
      String sql = sqlObj.getSQL();

      rs = stmt.executeQuery(sql);
      int i = 0;
      while (rs.next()) {
        i++;
        LEDEPolicyMailInfoSchema s1 = new LEDEPolicyMailInfoSchema();
        s1.setSchema(rs, i);
        aLEDEPolicyMailInfoSet.add(s1);
      }
      try {
        rs.close();
      } catch (Exception ex) {
      }
      try {
        stmt.close();
      } catch (Exception ex1) {
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "query";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        rs.close();
      } catch (Exception ex2) {
      }
      try {
        stmt.close();
      } catch (Exception ex3) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return aLEDEPolicyMailInfoSet;
  }
  public boolean getInfo() {
    PreparedStatement pstmt = null;
    ResultSet rs = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      pstmt =
          con.prepareStatement(
              "SELECT * FROM LEDEPolicyMailInfo WHERE  FreeNo = ?",
              ResultSet.TYPE_FORWARD_ONLY,
              ResultSet.CONCUR_READ_ONLY);
      if (this.getFreeNo() == null || this.getFreeNo().equals("null")) {
        pstmt.setNull(1, 12);
      } else {
        pstmt.setString(1, this.getFreeNo());
      }
      rs = pstmt.executeQuery();
      int i = 0;
      while (rs.next()) {
        i++;
        if (!this.setSchema(rs, i)) {
          // @@错误处理
          CError tError = new CError();
          tError.moduleName = "LEDEPolicyMailInfoDB";
          tError.functionName = "getInfo";
          tError.errorMessage = "取数失败!";
          this.mErrors.addOneError(tError);

          try {
            rs.close();
          } catch (Exception ex) {
          }
          try {
            pstmt.close();
          } catch (Exception ex1) {
          }

          if (!mflag) {
            try {
              con.close();
            } catch (Exception et) {
            }
          }
          return false;
        }
        break;
      }
      try {
        rs.close();
      } catch (Exception ex2) {
      }
      try {
        pstmt.close();
      } catch (Exception ex3) {
      }

      if (i == 0) {
        if (!mflag) {
          try {
            con.close();
          } catch (Exception et) {
          }
        }
        return false;
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "getInfo";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        rs.close();
      } catch (Exception ex) {
      }
      try {
        pstmt.close();
      } catch (Exception ex1) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
      return false;
    }
    // 断开数据库连接
    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return true;
  }
  public boolean insert() {
    PreparedStatement pstmt = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      pstmt =
          con.prepareStatement(
              "INSERT INTO LEDEPolicyMailInfo VALUES( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)");
      if (this.getFreeNo() == null || this.getFreeNo().equals("null")) {
        pstmt.setNull(1, 12);
      } else {
        pstmt.setString(1, this.getFreeNo());
      }
      if (this.getEmail() == null || this.getEmail().equals("null")) {
        pstmt.setNull(2, 12);
      } else {
        pstmt.setString(2, this.getEmail());
      }
      if (this.getName() == null || this.getName().equals("null")) {
        pstmt.setNull(3, 12);
      } else {
        pstmt.setString(3, this.getName());
      }
      if (this.getMailContent() == null || this.getMailContent().equals("null")) {
        pstmt.setNull(4, 12);
      } else {
        pstmt.setString(4, this.getMailContent());
      }
      if (this.getPdfAddress() == null || this.getPdfAddress().equals("null")) {
        pstmt.setNull(5, 12);
      } else {
        pstmt.setString(5, this.getPdfAddress());
      }
      if (this.getSendMailFlg() == null || this.getSendMailFlg().equals("null")) {
        pstmt.setNull(6, 12);
      } else {
        pstmt.setString(6, this.getSendMailFlg());
      }
      if (this.getSendMailDate() == null || this.getSendMailDate().equals("null")) {
        pstmt.setNull(7, 93);
      } else {
        pstmt.setDate(7, Date.valueOf(this.getSendMailDate()));
      }
      if (this.getSendMailTime() == null || this.getSendMailTime().equals("null")) {
        pstmt.setNull(8, 12);
      } else {
        pstmt.setString(8, this.getSendMailTime());
      }
      if (this.getProductCode() == null || this.getProductCode().equals("null")) {
        pstmt.setNull(9, 12);
      } else {
        pstmt.setString(9, this.getProductCode());
      }
      if (this.getOperator() == null || this.getOperator().equals("null")) {
        pstmt.setNull(10, 12);
      } else {
        pstmt.setString(10, this.getOperator());
      }
      if (this.getMakeDate() == null || this.getMakeDate().equals("null")) {
        pstmt.setNull(11, 93);
      } else {
        pstmt.setDate(11, Date.valueOf(this.getMakeDate()));
      }
      if (this.getMakeTime() == null || this.getMakeTime().equals("null")) {
        pstmt.setNull(12, 12);
      } else {
        pstmt.setString(12, this.getMakeTime());
      }
      if (this.getModifyDate() == null || this.getModifyDate().equals("null")) {
        pstmt.setNull(13, 93);
      } else {
        pstmt.setDate(13, Date.valueOf(this.getModifyDate()));
      }
      if (this.getModifyTime() == null || this.getModifyTime().equals("null")) {
        pstmt.setNull(14, 12);
      } else {
        pstmt.setString(14, this.getModifyTime());
      }
      // execute sql
      pstmt.executeUpdate();
      pstmt.close();
    } catch (Exception ex) {
      // @@错误处理
      this.mErrors.copyAllErrors(db.mErrors);
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "insert()";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      try {
        pstmt.close();
      } catch (Exception e) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception e) {
        }
      }

      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return true;
  }
Exemplo n.º 10
0
  public boolean insert() {
    PreparedStatement pstmt = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      pstmt =
          con.prepareStatement(
              "INSERT INTO LECInsured VALUES( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)");
      if (this.getContNo() == null || this.getContNo().equals("null")) {
        pstmt.setNull(1, 12);
      } else {
        pstmt.setString(1, this.getContNo());
      }
      if (this.getInsuredNo() == null || this.getInsuredNo().equals("null")) {
        pstmt.setNull(2, 12);
      } else {
        pstmt.setString(2, this.getInsuredNo());
      }
      if (this.getAppntNo() == null || this.getAppntNo().equals("null")) {
        pstmt.setNull(3, 12);
      } else {
        pstmt.setString(3, this.getAppntNo());
      }
      if (this.getManageCom() == null || this.getManageCom().equals("null")) {
        pstmt.setNull(4, 12);
      } else {
        pstmt.setString(4, this.getManageCom());
      }
      if (this.getExecuteCom() == null || this.getExecuteCom().equals("null")) {
        pstmt.setNull(5, 12);
      } else {
        pstmt.setString(5, this.getExecuteCom());
      }
      if (this.getMasterContNo() == null || this.getMasterContNo().equals("null")) {
        pstmt.setNull(6, 12);
      } else {
        pstmt.setString(6, this.getMasterContNo());
      }
      if (this.getMasterInsuredNo() == null || this.getMasterInsuredNo().equals("null")) {
        pstmt.setNull(7, 12);
      } else {
        pstmt.setString(7, this.getMasterInsuredNo());
      }
      if (this.getRelationToMainInsured() == null
          || this.getRelationToMainInsured().equals("null")) {
        pstmt.setNull(8, 12);
      } else {
        pstmt.setString(8, this.getRelationToMainInsured());
      }
      if (this.getRelationToAppnt() == null || this.getRelationToAppnt().equals("null")) {
        pstmt.setNull(9, 12);
      } else {
        pstmt.setString(9, this.getRelationToAppnt());
      }
      if (this.getAddressNo() == null || this.getAddressNo().equals("null")) {
        pstmt.setNull(10, 12);
      } else {
        pstmt.setString(10, this.getAddressNo());
      }
      if (this.getName() == null || this.getName().equals("null")) {
        pstmt.setNull(11, 12);
      } else {
        pstmt.setString(11, this.getName());
      }
      if (this.getSex() == null || this.getSex().equals("null")) {
        pstmt.setNull(12, 12);
      } else {
        pstmt.setString(12, this.getSex());
      }
      if (this.getBirthday() == null || this.getBirthday().equals("null")) {
        pstmt.setNull(13, 91);
      } else {
        pstmt.setDate(13, Date.valueOf(this.getBirthday()));
      }
      if (this.getInsuredIDType() == null || this.getInsuredIDType().equals("null")) {
        pstmt.setNull(14, 12);
      } else {
        pstmt.setString(14, this.getInsuredIDType());
      }
      if (this.getInsuredIDNo() == null || this.getInsuredIDNo().equals("null")) {
        pstmt.setNull(15, 12);
      } else {
        pstmt.setString(15, this.getInsuredIDNo());
      }
      if (this.getNationality() == null || this.getNationality().equals("null")) {
        pstmt.setNull(16, 12);
      } else {
        pstmt.setString(16, this.getNationality());
      }
      if (this.getMarriage() == null || this.getMarriage().equals("null")) {
        pstmt.setNull(17, 12);
      } else {
        pstmt.setString(17, this.getMarriage());
      }
      if (this.getHealth() == null || this.getHealth().equals("null")) {
        pstmt.setNull(18, 12);
      } else {
        pstmt.setString(18, this.getHealth());
      }
      pstmt.setDouble(19, this.getStature());
      pstmt.setDouble(20, this.getAvoirdupois());
      if (this.getDegree() == null || this.getDegree().equals("null")) {
        pstmt.setNull(21, 12);
      } else {
        pstmt.setString(21, this.getDegree());
      }
      if (this.getCreditGrade() == null || this.getCreditGrade().equals("null")) {
        pstmt.setNull(22, 12);
      } else {
        pstmt.setString(22, this.getCreditGrade());
      }
      if (this.getBankName() == null || this.getBankName().equals("null")) {
        pstmt.setNull(23, 12);
      } else {
        pstmt.setString(23, this.getBankName());
      }
      if (this.getAccName() == null || this.getAccName().equals("null")) {
        pstmt.setNull(24, 12);
      } else {
        pstmt.setString(24, this.getAccName());
      }
      if (this.getBankAccNo() == null || this.getBankAccNo().equals("null")) {
        pstmt.setNull(25, 12);
      } else {
        pstmt.setString(25, this.getBankAccNo());
      }
      if (this.getOccupationType() == null || this.getOccupationType().equals("null")) {
        pstmt.setNull(26, 12);
      } else {
        pstmt.setString(26, this.getOccupationType());
      }
      if (this.getOccupationCode() == null || this.getOccupationCode().equals("null")) {
        pstmt.setNull(27, 12);
      } else {
        pstmt.setString(27, this.getOccupationCode());
      }
      if (this.getWorkType() == null || this.getWorkType().equals("null")) {
        pstmt.setNull(28, 12);
      } else {
        pstmt.setString(28, this.getWorkType());
      }
      if (this.getPluralityType() == null || this.getPluralityType().equals("null")) {
        pstmt.setNull(29, 12);
      } else {
        pstmt.setString(29, this.getPluralityType());
      }
      if (this.getSmokeFlag() == null || this.getSmokeFlag().equals("null")) {
        pstmt.setNull(30, 12);
      } else {
        pstmt.setString(30, this.getSmokeFlag());
      }
      if (this.getContPlanCode() == null || this.getContPlanCode().equals("null")) {
        pstmt.setNull(31, 12);
      } else {
        pstmt.setString(31, this.getContPlanCode());
      }
      pstmt.setDouble(32, this.getBMI());
      pstmt.setDouble(33, this.getInsuredPeoples());
      if (this.getInsuredState() == null || this.getInsuredState().equals("null")) {
        pstmt.setNull(34, 12);
      } else {
        pstmt.setString(34, this.getInsuredState());
      }
      if (this.getOperator() == null || this.getOperator().equals("null")) {
        pstmt.setNull(35, 12);
      } else {
        pstmt.setString(35, this.getOperator());
      }
      if (this.getMakeDate() == null || this.getMakeDate().equals("null")) {
        pstmt.setNull(36, 91);
      } else {
        pstmt.setDate(36, Date.valueOf(this.getMakeDate()));
      }
      if (this.getMakeTime() == null || this.getMakeTime().equals("null")) {
        pstmt.setNull(37, 12);
      } else {
        pstmt.setString(37, this.getMakeTime());
      }
      if (this.getModifyDate() == null || this.getModifyDate().equals("null")) {
        pstmt.setNull(38, 91);
      } else {
        pstmt.setDate(38, Date.valueOf(this.getModifyDate()));
      }
      if (this.getModifyTime() == null || this.getModifyTime().equals("null")) {
        pstmt.setNull(39, 12);
      } else {
        pstmt.setString(39, this.getModifyTime());
      }
      // execute sql
      pstmt.executeUpdate();
      pstmt.close();
    } catch (Exception ex) {
      // @@错误处理
      this.mErrors.copyAllErrors(db.mErrors);
      CError tError = new CError();
      tError.moduleName = "LECInsuredDB";
      tError.functionName = "insert()";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      try {
        pstmt.close();
      } catch (Exception e) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception e) {
        }
      }

      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return true;
  }
Exemplo n.º 11
0
  public boolean insert() {
    PreparedStatement pstmt = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      pstmt =
          con.prepareStatement("INSERT INTO LEDAdSource VALUES( ? , ? , ? , ? , ? , ? , ? , ?)");
      if (this.getProductCode() == null || this.getProductCode().equals("null")) {
        pstmt.setNull(1, 12);
      } else {
        pstmt.setString(1, this.getProductCode());
      }
      if (this.getSiteName() == null || this.getSiteName().equals("null")) {
        pstmt.setNull(2, 12);
      } else {
        pstmt.setString(2, this.getSiteName());
      }
      if (this.getSiteCode() == null || this.getSiteCode().equals("null")) {
        pstmt.setNull(3, 12);
      } else {
        pstmt.setString(3, this.getSiteCode());
      }
      if (this.getSiteType() == null || this.getSiteType().equals("null")) {
        pstmt.setNull(4, 12);
      } else {
        pstmt.setString(4, this.getSiteType());
      }
      if (this.getUrl() == null || this.getUrl().equals("null")) {
        pstmt.setNull(5, 12);
      } else {
        pstmt.setString(5, this.getUrl());
      }
      if (this.getContent() == null || this.getContent().equals("null")) {
        pstmt.setNull(6, 12);
      } else {
        pstmt.setString(6, this.getContent());
      }
      if (this.getPayMode() == null || this.getPayMode().equals("null")) {
        pstmt.setNull(7, 12);
      } else {
        pstmt.setString(7, this.getPayMode());
      }
      if (this.getVisitedPage() == null || this.getVisitedPage().equals("null")) {
        pstmt.setNull(8, 12);
      } else {
        pstmt.setString(8, this.getVisitedPage());
      }
      // execute sql
      pstmt.executeUpdate();
      pstmt.close();
    } catch (Exception ex) {
      // @@错误处理
      this.mErrors.copyAllErrors(db.mErrors);
      CError tError = new CError();
      tError.moduleName = "LEDAdSourceDB";
      tError.functionName = "insert()";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      try {
        pstmt.close();
      } catch (Exception e) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception e) {
        }
      }

      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return true;
  }
Exemplo n.º 12
0
  public boolean update() {
    PreparedStatement pstmt = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      pstmt =
          con.prepareStatement(
              "UPDATE LEDAdSource SET  ProductCode = ? , SiteName = ? , SiteCode = ? , SiteType = ? , Url = ? , Content = ? , PayMode = ? , VisitedPage = ? WHERE  ProductCode = ? AND SiteCode = ?");
      if (this.getProductCode() == null || this.getProductCode().equals("null")) {
        pstmt.setNull(1, 12);
      } else {
        pstmt.setString(1, this.getProductCode());
      }
      if (this.getSiteName() == null || this.getSiteName().equals("null")) {
        pstmt.setNull(2, 12);
      } else {
        pstmt.setString(2, this.getSiteName());
      }
      if (this.getSiteCode() == null || this.getSiteCode().equals("null")) {
        pstmt.setNull(3, 12);
      } else {
        pstmt.setString(3, this.getSiteCode());
      }
      if (this.getSiteType() == null || this.getSiteType().equals("null")) {
        pstmt.setNull(4, 12);
      } else {
        pstmt.setString(4, this.getSiteType());
      }
      if (this.getUrl() == null || this.getUrl().equals("null")) {
        pstmt.setNull(5, 12);
      } else {
        pstmt.setString(5, this.getUrl());
      }
      if (this.getContent() == null || this.getContent().equals("null")) {
        pstmt.setNull(6, 12);
      } else {
        pstmt.setString(6, this.getContent());
      }
      if (this.getPayMode() == null || this.getPayMode().equals("null")) {
        pstmt.setNull(7, 12);
      } else {
        pstmt.setString(7, this.getPayMode());
      }
      if (this.getVisitedPage() == null || this.getVisitedPage().equals("null")) {
        pstmt.setNull(8, 12);
      } else {
        pstmt.setString(8, this.getVisitedPage());
      }
      // set where condition
      if (this.getProductCode() == null || this.getProductCode().equals("null")) {
        pstmt.setNull(9, 12);
      } else {
        pstmt.setString(9, this.getProductCode());
      }
      if (this.getSiteCode() == null || this.getSiteCode().equals("null")) {
        pstmt.setNull(10, 12);
      } else {
        pstmt.setString(10, this.getSiteCode());
      }
      pstmt.executeUpdate();
      pstmt.close();
    } catch (Exception ex) {
      // @@错误处理
      this.mErrors.copyAllErrors(db.mErrors);
      CError tError = new CError();
      tError.moduleName = "LEDAdSourceDB";
      tError.functionName = "update()";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      try {
        pstmt.close();
      } catch (Exception e) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception e) {
        }
      }

      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return true;
  }