?? board.java
字號:
package com.laoer.bbscs.board;import java.sql.*;import java.io.*;import java.util.*;import com.laoer.bbscs.db.*;import com.laoer.bbscs.txthtml.*;/** * 該類用于取得一級版區(qū)的各項(xiàng)屬性 * Title: BBS-CS * Description: BBS-CS(BBS式虛擬社區(qū)系統(tǒng)) * Copyright: Copyright (c) 2002 * Company: loveroom.com.cn * @author 龔天乙(laoer) * @version 3.0 */public class Board { String SQL = ""; DbTrans DBSQL; ResultSet rs = null; DoText myDoText; private String strBID = ""; private String strBoardName = ""; private String strEBoardName = ""; private String strBMaster = ""; private int numAttrib = 1; private String strXu = ""; /** * 構(gòu)造函數(shù) */ public Board() { this.DBSQL = new DbTrans(); this.myDoText = new DoText(); } /** * 取得版區(qū)各項(xiàng)屬性 * @param bid 版區(qū)ID號 */ public void getBoard(String bid) { SQL = "select * from board where ID="+ bid; try { rs = DBSQL.executeQuery(SQL); if (rs.next()) { this.strBID = rs.getString("ID"); this.strBoardName = rs.getString("boardname"); this.strEBoardName = rs.getString("eboardname"); this.strBMaster = rs.getString("bmaster"); this.numAttrib = rs.getInt("attrib"); this.strXu = rs.getString("xu"); } rs.close(); } catch (SQLException e){ } } /** * 取得版區(qū)ID * @return String型版區(qū)ID */ public String getBID() { return this.strBID; } /** * 取得中文版區(qū)名 * @return String型版區(qū)名 */ public String getBoardName() { return this.strBoardName; } /** * 取得英文版區(qū)名 * @return String型英文版區(qū)名 */ public String getEBoardName() { return this.strEBoardName; } /** * 取得版區(qū)管理員名 * @return String型版區(qū)管理員 */ public String getBMaster() { return this.strBMaster; } /** * 取得版區(qū)屬性 * @return String型版區(qū)屬性 */ public int getAttrib() { return this.numAttrib; } /** * 取得序 * @return String序 */ public String getXu() { return this.strXu; } /** * 判斷版區(qū)名是否重復(fù) * @param bid 版區(qū)ID * @param strBoardName 中文版區(qū)名 * @param strEBoardName 英文版區(qū)名 * @return 布爾邏輯值 如果重復(fù)返回真,否則返回假 */ public boolean isHaveBoarName(String bid, String strBoardName, String strEBoardName) { boolean isHaveBoardName = false; int numIsHaveBoardName = 0; SQL = "select count(*) as numIsHaveBoardName from board where (boardname='"+ strBoardName +"' or eboardname='" + strEBoardName +"') and ID <> "+ bid +""; try { rs = DBSQL.executeQuery(SQL); if (rs.next()) { numIsHaveBoardName = rs.getInt("numIsHaveBoardName"); } rs.close(); } catch (SQLException e){ } if (numIsHaveBoardName != 0) { isHaveBoardName = true; } else { isHaveBoardName = false; } return isHaveBoardName; } /** * 修改一級版區(qū)屬性 * @param bid 版區(qū)ID * @param strBoardName 中文版區(qū)名稱 * @param strEBoardName 英文版區(qū)名 * @param strBMaster 管理員 * @param strAttrib 屬性 * @param strXu 序 * @return 布爾邏輯值 修改成功返回真,否則返回假 */ public boolean setUpdateBoard(String bid, String strBoardName, String strEBoardName, String strBMaster, String strAttrib, String strXu) { boolean isCanUpdate = false; SQL = "update board set boardname='"+ strBoardName +"',eboardname='"+ strEBoardName +"',bmaster='"+ strBMaster +"',attrib='"+ strAttrib +"',xu='"+ strXu +"' where ID="+ bid; try { DBSQL.executeUpdate(SQL); isCanUpdate = true; } catch (SQLException e){ isCanUpdate = false; } return isCanUpdate; } public String getListBoardConf(String strUserName,String tablecolor) { String strListBoardConf = ""; SQL = "select * from board where bmaster=\""+ strUserName +"\""; try { rs = DBSQL.executeQuery(SQL); while (rs.next()) { strListBoardConf += "<tr bgcolor="+tablecolor+">\n"; strListBoardConf += "<td><CENTER>"+rs.getInt("ID")+"</CENTER></td>\n"; strListBoardConf += "<td><CENTER><a href='boardsconf.jsp?boid="+rs.getInt("ID")+"'>"+myDoText.iso2gb(rs.getString("boardname"))+"("+myDoText.iso2gb(rs.getString("eboardname"))+")</a></CENTER></td>\n"; strListBoardConf += "</tr>\n"; } rs.close(); } catch (SQLException e){ } return strListBoardConf; } public boolean isBoardMaster(String boid,String strUserName) { int numMaster = 0; SQL = "select count(*) as numMaster from board where bmaster = '"+strUserName+"' and ID = "+boid; try { rs = DBSQL.executeQuery(SQL); if (rs.next()) { numMaster = rs.getInt("numMaster"); } rs.close(); } catch (SQLException e){ } if (numMaster!=0) { return true; } else { return false; } } public void close() { try { DBSQL.close(); } catch (SQLException e){ } }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -