Package com.knowgate.math

Examples of com.knowgate.math.CurrencyCode


      ResultSet oRSet = oStmt.executeQuery("SELECT "+DB.numeric_code+","+DB.alpha_code+","+DB.char_code+","+DB.id_entity+","+DB.nm_entity+","+DB.tr_currency_+"en FROM "+DB.k_lu_currencies+" ORDER BY 2");
    while (oRSet.next()) {
      try {
        String sNum = oRSet.getString(1);
        if (!oRSet.wasNull())
          aCurrencies.add(new CurrencyCode(Integer.parseInt(sNum.trim()), oRSet.getString(2), oRSet.getString(3), oRSet.getString(4), oRSet.getString(5), oRSet.getString(6)));
      } catch (java.lang.IllegalArgumentException iae) {
        // Not all values present at k_lu_currencies are supported by Currency.getInstance()       
      }
    } // wend
    oRSet.close();
View Full Code Here


  } // currencyCodes

    public static CurrencyCode currencyCodeFor (int iNumCode) throws NullPointerException {
      if (null==aCurrencies) throw new NullPointerException("DBCurrencies.currencyCodeFor() CurrencyCode array has not been initialized");
    int count = aCurrencies.size();
    CurrencyCode oCurCod = null;
    for (int c=0; c<count; c++) {
      if (aCurrencies.get(c).numericCode()==iNumCode) {
        oCurCod = aCurrencies.get(c);
        break;
      } // fi
View Full Code Here

    } // currencyCodeFor

    public static CurrencyCode currencyCodeFor (String sAlphaCode) throws NullPointerException {
      if (null==aCurrencies) throw new NullPointerException("DBCurrencies.currencyCodeFor() CurrencyCode array has not been initialized");
    int count = aCurrencies.size();
    CurrencyCode oCurCod = null;
    for (int c=0; c<count; c++) {
      if (aCurrencies.get(c).alphaCode().equalsIgnoreCase(sAlphaCode)) {
        oCurCod = aCurrencies.get(c);
        break;
      } // fi
View Full Code Here

    DebugFile.writeln("Begin updateConversionRates([Connection], "+sBaseCurrency+")");
    DebugFile.incIdent();
    lTsStart = new Date().getTime();
    }
    Timestamp oTsNow = new Timestamp(new Date().getTime());
    CurrencyCode oCurrBase = CurrencyCode.currencyCodeFor(sBaseCurrency.toUpperCase());
    ArrayList aList = new ArrayList(300);
    Statement oList = oConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    ResultSet rList = oList.executeQuery("SELECT DISTINCT("+DB.alpha_code+") FROM "+DB.k_lu_currencies);
    while (rList.next()) {
      aList.add(rList.getString(1));
    } // wend
    rList.close();
    oList.close();
    PreparedStatement oInsr = oConn.prepareStatement("INSERT INTO "+DB.k_lu_currencies_history+" ("+DB.alpha_code_from+","+DB.alpha_code_to+","+DB.nu_conversion+","+DB.dt_stamp+") VALUES ('"+sBaseCurrency.toUpperCase()+"',?,?,?)");
    PreparedStatement oUpdt = oConn.prepareStatement("UPDATE "+DB.k_lu_currencies+" SET "+DB.nu_conversion+"=? WHERE "+DB.alpha_code+"=?");
    Iterator oIter = aList.iterator();
    while (oIter.hasNext()) {
      String sAlphaCode = (String) oIter.next();
      try {
        double dRate = oCurrBase.conversionRateTo(sAlphaCode);
        oUpdt.setBigDecimal(1, new BigDecimal(dRate));
        oUpdt.setString(2, sAlphaCode);
        if (0d!=dRate) {
          oInsr.setString(1, sAlphaCode);
          oInsr.setBigDecimal(2, new BigDecimal(dRate));
View Full Code Here

TOP

Related Classes of com.knowgate.math.CurrencyCode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.