⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbcss.java

📁 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      return Sys.RESULT_RIGHT;
    }
    catch (ObjectException e) {
      logger.error(e);
      return Sys.RESULT_OBJECTEXCEPTION;
    }
    catch (ObjectNoExistException e) {
      return Sys.RESULT_OBJECTNOEXISTEXCEPTION;
    }
    finally {
      if (aTranContext == null && myDBTrans != null) {
        myDBTrans.freeCon();
      }
    }
  }

  public void loadDB(TranContext myDB, String key, boolean isLoad) throws
      ObjectException, ObjectNoExistException {
    try {
      if (key.equals("ID")) {
        myDB.prepareStatement(LOAD_CSS_BYID);
        myDB.setLong(1, this.myCSSInfo.getID());
      }
      rs = myDB.executeQuery();
      if (rs.next()) {
        this.myCSSInfo.setID(rs.getLong("ID"));
        this.myCSSInfo.setLeftbgcolor(rs.getString("leftbgcolor"));
        this.myCSSInfo.setLetftextcolor(rs.getString("letftextcolor"));
        this.myCSSInfo.setRightbgcolor(rs.getString("rightbgcolor"));
        this.myCSSInfo.setRighttextcolor(rs.getString("righttextcolor"));
        this.myCSSInfo.setTablemaincolor(rs.getString("tablemaincolor"));
        this.myCSSInfo.setTabletintcolor(rs.getString("tabletintcolor"));
        this.myCSSInfo.setTabledarkcolor(rs.getString("tabledarkcolor"));
        this.myCSSInfo.setLeft_a(rs.getString("left_a"));
        this.myCSSInfo.setLeft_alink(rs.getString("left_alink"));
        this.myCSSInfo.setLeft_avisited(rs.getString("left_avisited"));
        this.myCSSInfo.setLeft_ahover(rs.getString("left_ahover"));
        this.myCSSInfo.setLeft_aactive(rs.getString("left_aactive"));
        this.myCSSInfo.setRight_a(rs.getString("right_a"));
        this.myCSSInfo.setRight_alink(rs.getString("right_alink"));
        this.myCSSInfo.setRight_avisited(rs.getString("right_avisited"));
        this.myCSSInfo.setRight_ahover(rs.getString("right_ahover"));
        this.myCSSInfo.setRight_aactive(rs.getString("right_aactive"));
        this.myCSSInfo.setAllfonts(rs.getString("allfonts"));
      }
      else {
        throw new ObjectNoExistException();
      }
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (rs != null) {
          rs.close();
          rs = null;
        }
      }
      catch (SQLException e) {
      }
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

  public List loadDBs(TranContext myDB, String key) throws ObjectException {
    List alist = ListFactory.getInstance(2);
    CSSInfo aCSSInfo = null;
    try {
      if (key.equals("All")) {
        myDB.prepareStatement(LOAD_CSSS);
      }
      rs = myDB.executeQuery();
      while (rs.next()) {
        aCSSInfo = new CSSInfo();
        aCSSInfo.setID(rs.getLong("ID"));
        aCSSInfo.setLeftbgcolor(rs.getString("leftbgcolor"));
        aCSSInfo.setLetftextcolor(rs.getString("letftextcolor"));
        aCSSInfo.setRightbgcolor(rs.getString("rightbgcolor"));
        aCSSInfo.setRighttextcolor(rs.getString("righttextcolor"));
        aCSSInfo.setTablemaincolor(rs.getString("tablemaincolor"));
        aCSSInfo.setTabletintcolor(rs.getString("tabletintcolor"));
        aCSSInfo.setTabledarkcolor(rs.getString("tabledarkcolor"));
        aCSSInfo.setLeft_a(rs.getString("left_a"));
        aCSSInfo.setLeft_alink(rs.getString("left_alink"));
        aCSSInfo.setLeft_avisited(rs.getString("left_avisited"));
        aCSSInfo.setLeft_ahover(rs.getString("left_ahover"));
        aCSSInfo.setLeft_aactive(rs.getString("left_aactive"));
        aCSSInfo.setRight_a(rs.getString("right_a"));
        aCSSInfo.setRight_alink(rs.getString("right_alink"));
        aCSSInfo.setRight_avisited(rs.getString("right_avisited"));
        aCSSInfo.setRight_ahover(rs.getString("right_ahover"));
        aCSSInfo.setRight_aactive(rs.getString("right_aactive"));
        aCSSInfo.setAllfonts(rs.getString("allfonts"));
        String sWebPro = "";
        sWebPro = "<style type=\"text/css\">\n";
        sWebPro += "body { font-size: 14px; background-color: " +
            aCSSInfo.getLeftbgcolor() + "; color: " +
            aCSSInfo.getLetftextcolor() + ";FONT-FAMILY:" +
            aCSSInfo.getAllfonts() + "}\n";
        sWebPro += "input {FONT-FAMILY:" + aCSSInfo.getAllfonts() +
            ";font-size: 14px;}\n";
        sWebPro += "textarea {FONT-FAMILY:" + aCSSInfo.getAllfonts() +
            "; font-size: 14px;}\n";
        sWebPro += ".bt { font-size: 9pt;FONT-FAMILY:" + aCSSInfo.getAllfonts() +
            "}\n";
        sWebPro += ".T1 { background-color: " + aCSSInfo.getTablemaincolor() +
            ";}\n";
        sWebPro += ".T2 { background-color: " + aCSSInfo.getTabletintcolor() +
            ";}\n";
        sWebPro += ".T3 { background-color: " + aCSSInfo.getTabledarkcolor() +
            ";}\n";
        sWebPro += "a            { " + aCSSInfo.getLeft_a() + " }\n";
        sWebPro += "a:link       { " + aCSSInfo.getLeft_alink() + " }\n";
        sWebPro += "a:visited    { " + aCSSInfo.getLeft_avisited() + " }\n";
        sWebPro += "a:hover      { " + aCSSInfo.getLeft_ahover() + " }\n";
        sWebPro += "a:active     { " + aCSSInfo.getLeft_aactive() + " }\n";
        sWebPro += "</style>";
        aCSSInfo.setCSS1(sWebPro);
        sWebPro = "<style type=\"text/css\">\n";
        sWebPro += "body { font-size: 9pt; background-color: " +
            aCSSInfo.getRightbgcolor() + "; color: " +
            aCSSInfo.getRighttextcolor() + ";FONT-FAMILY:" +
            aCSSInfo.getAllfonts() + "}\n";
        sWebPro += "input {FONT-FAMILY:" + aCSSInfo.getAllfonts() +
            ";font-size: 14px;}\n";
        sWebPro += "textarea {FONT-FAMILY:" + aCSSInfo.getAllfonts() +
            "; font-size: 14px;}\n";
        sWebPro += "table { font-size: 9pt; " + aCSSInfo.getAllfonts() + "}\n";
        sWebPro += ".bt { font-size: 14px;FONT-FAMILY:" + aCSSInfo.getAllfonts() +
            "}\n";
        sWebPro += ".T1 { background-color: " + aCSSInfo.getTablemaincolor() +
            ";}\n";
        sWebPro += ".T2 { background-color: " + aCSSInfo.getTabletintcolor() +
            ";}\n";
        sWebPro += ".T3 { background-color: " + aCSSInfo.getTabledarkcolor() +
            ";}\n";
        sWebPro += "a            { " + aCSSInfo.getRight_a() + " }\n";
        sWebPro += "a:link       { " + aCSSInfo.getRight_alink() + " }\n";
        sWebPro += "a:visited    { " + aCSSInfo.getRight_avisited() + " }\n";
        sWebPro += "a:hover      { " + aCSSInfo.getRight_ahover() + " }\n";
        sWebPro += "a:active     { " + aCSSInfo.getRight_aactive() + " }\n";
        sWebPro += "</style>";
        aCSSInfo.setCSS2(sWebPro);
        alist.add(aCSSInfo);
        aCSSInfo = null;
      }
      return alist;
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (rs != null) {
          rs.close();
          rs = null;
        }
      }
      catch (SQLException e) {
      }
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

  public void insertDB(TranContext myDB) throws ObjectException {
    try {
      myDB.prepareStatement(INSERT_CSS);
      myDB.setLong(1, this.myCSSInfo.getID());
      myDB.setString(2, this.myCSSInfo.getLeftbgcolor());
      myDB.setString(3, this.myCSSInfo.getLetftextcolor());
      myDB.setString(4, this.myCSSInfo.getRightbgcolor());
      myDB.setString(5, this.myCSSInfo.getRighttextcolor());
      myDB.setString(6, this.myCSSInfo.getTablemaincolor());
      myDB.setString(7, this.myCSSInfo.getTabletintcolor());
      myDB.setString(8, this.myCSSInfo.getTabledarkcolor());
      myDB.setString(9, this.myCSSInfo.getLeft_a());
      myDB.setString(10, this.myCSSInfo.getLeft_alink());
      myDB.setString(11, this.myCSSInfo.getLeft_avisited());
      myDB.setString(12, this.myCSSInfo.getLeft_ahover());
      myDB.setString(13, this.myCSSInfo.getLeft_aactive());
      myDB.setString(14, this.myCSSInfo.getRight_a());
      myDB.setString(15, this.myCSSInfo.getRight_alink());
      myDB.setString(16, this.myCSSInfo.getRight_avisited());
      myDB.setString(17, this.myCSSInfo.getRight_ahover());
      myDB.setString(18, this.myCSSInfo.getRight_aactive());
      myDB.setString(19, this.myCSSInfo.getAllfonts());
      myDB.executeUpdate();
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (rs != null) {
          rs.close();
          rs = null;
        }
      }
      catch (SQLException e) {
      }
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

  public void updateDB(TranContext myDB, String key) throws ObjectException {
    try {
      if (key.equals("ID")) {
        myDB.prepareStatement(UPDATE_CSS);
        myDB.setString(1, this.myCSSInfo.getLeftbgcolor());
        myDB.setString(2, this.myCSSInfo.getLetftextcolor());
        myDB.setString(3, this.myCSSInfo.getRightbgcolor());
        myDB.setString(4, this.myCSSInfo.getRighttextcolor());
        myDB.setString(5, this.myCSSInfo.getTablemaincolor());
        myDB.setString(6, this.myCSSInfo.getTabletintcolor());
        myDB.setString(7, this.myCSSInfo.getTabledarkcolor());
        myDB.setString(8, this.myCSSInfo.getLeft_a());
        myDB.setString(9, this.myCSSInfo.getLeft_alink());
        myDB.setString(10, this.myCSSInfo.getLeft_avisited());
        myDB.setString(11, this.myCSSInfo.getLeft_ahover());
        myDB.setString(12, this.myCSSInfo.getLeft_aactive());
        myDB.setString(13, this.myCSSInfo.getRight_a());
        myDB.setString(14, this.myCSSInfo.getRight_alink());
        myDB.setString(15, this.myCSSInfo.getRight_avisited());
        myDB.setString(16, this.myCSSInfo.getRight_ahover());
        myDB.setString(17, this.myCSSInfo.getRight_aactive());
        myDB.setString(18, this.myCSSInfo.getAllfonts());
        myDB.setLong(19, this.myCSSInfo.getID());
        myDB.executeUpdate();
      }
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

  public void delDB(TranContext myDB, String key) throws ObjectException {
    try {
      if (key.equals("ID")) {
        myDB.prepareStatement(DEL_CSS);
        myDB.setLong(1, this.myCSSInfo.getID());
        myDB.executeUpdate();
      }
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -