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

📄 clubad.java

📁 GamVan Club v1.1 源代码
💻 JAVA
字号:
/*
 * Created on 2005-6-6
 * Made in GamVan
 * 广告代码
 */
package com.gamvan.club.manage;
import com.gamvan.conn.ConnClub;
import com.gamvan.tools.TypeChange;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.ResultSet;

public class ClubAd {
	private int aID = 0;
	private int aWidth = 10;
	private int aHeight = 10;
	private int aType = 0;
	private String aTxt = "";
	private String aObj = "";
	private String aUrl = "";
	private String message = "";
	private String act = null;
	ConnClub bridge = new ConnClub();
	public ClubAd(){
		
	}
	public boolean adInfo() throws SQLException{
		boolean bea = false;
		StringBuffer sqlCommand = new StringBuffer();
		Connection con = bridge.getConnection();
		try{
			sqlCommand.append("Select * From GVclubAd where aID = ?");
			PreparedStatement pps = con.prepareStatement(sqlCommand.toString());
			pps.setInt(1,aID);
			ResultSet rs = pps.executeQuery();
			if(rs.next()){
				aID = rs.getInt(1);
				aObj = rs.getString(2);
				aUrl = rs.getString(3);
				aWidth = rs.getInt(4);
				aHeight = rs.getInt(5);
				aTxt = rs.getString(6);
				aType = rs.getInt(7);
				bea = true;
			}else{
				message = "广告信息读取失败!";
				bea = false;
			}
			
		}catch(Exception e){
			message = "广告信息读取失败!";
			bea = false;
		}finally{
			con.close();
		}		
		return bea;
	}
	public boolean doAd() throws Exception{
		boolean bea = false;
		if(act.equals("add")){
			bea = insertAd();
		}else if(act.equals("edit")){
			bea = updateAd();
		}else if(act.equals("del")){
			bea = deleteAd();
		}else{
			message = "操作内容不详,操作失败!";
			bea = false;
		}
		return bea;
	}
	public boolean insertAd() throws SQLException{
		boolean bea = false;
		StringBuffer sqlCommand = new StringBuffer("");
		Connection con = bridge.getConnection();
		try{
			sqlCommand.append("Insert into GVclubAd(aObj, aUrl, aWidth, aHeight, aTxt, aType)");
			sqlCommand.append(" Values(?,?,?,?,?,?)");
			PreparedStatement pps = con.prepareStatement(sqlCommand.toString());
			pps.setString(1,aObj);
			pps.setString(2,aUrl);
			pps.setInt(3,aWidth);
			pps.setInt(4,aHeight);
			pps.setString(5,aTxt);
			pps.setInt(6,aType);
			pps.executeUpdate();
			pps.close();
			bea = true;
			
			message = "广告内容添加成功!";
		}catch(Exception e){
			message = "广告内容添加失败!<br/>";
			message += e.toString();
			bea = false;
		}finally{
			con.close();
		}
		return bea;
	}
	public boolean updateAd() throws SQLException{
		boolean bea = false;
		StringBuffer sqlCommand = new StringBuffer("");
		Connection con = bridge.getConnection();
		try{
			sqlCommand.append("Update GVclubAd set ");
			sqlCommand.append("aObj=?, aUrl=?, aWidth=?, aHeight=?, aTxt=?, aType=? where aID=?");
			PreparedStatement pps = con.prepareStatement(sqlCommand.toString());
			pps.setString(1,aObj);
			pps.setString(2,aUrl);
			pps.setInt(3,aWidth);
			pps.setInt(4,aHeight);
			pps.setString(5,aTxt);
			pps.setInt(6,aType);
			pps.setInt(7,aID);
			pps.executeUpdate();
			pps.close();
			bea = true;
			message = "广告内容更新成功!";
		}catch(Exception e){
			message = "广告内容更新失败<br/>";
			message += e.toString();
			bea = false;
		}finally{
			con.close();
		}		
		return bea;
	}
	public boolean deleteAd() throws SQLException{
		boolean bea = false;
		StringBuffer sqlCommand = new StringBuffer("");
		Connection con = bridge.getConnection();
		try{
			sqlCommand.append("Delete From GVclubAd where aID=?");
			PreparedStatement pps = con.prepareStatement(sqlCommand.toString());
			pps.setInt(1,aID);
			pps.executeUpdate();
			pps.close();
			bea = true;
			message = "广告内容删除成功!";
		}catch(Exception e){
			message = "广告内容删除失败!<br/>";
			message = e.toString();
			bea = false;
		}finally{
			con.close();
		}
		return bea;		
	}
	public String getMessage(){
		return this.message;
	}
	public String getAobj(){
		return this.aObj;
	}
	public String getAurl(){
		return this.aUrl;
	}
	public String getAtxt(){
		return this.aTxt;
	}
	public int getAtype(){
		return this.aType;
	}
	public int getAwidth(){
		return this.aWidth;
	}
	public int getAheight(){
		return this.aHeight;
	}
	public int getAid(){
		return this.aID;
	}
	//===========================
	public void setAwidth(String aWidth){
		this.aWidth = TypeChange.stringToInt(aWidth);
	}
	public void setAheight(String aHeight){
		this.aHeight = TypeChange.stringToInt(aHeight);
	}
	public void setAtxt(String aTxt){
		this.aTxt = aTxt.trim();
	}
	public void setAobj(String aObj){
		this.aObj = aObj.trim();
	}
	public void setAurl(String aUrl){
		this.aUrl = aUrl.trim();
	}
	public void setAtype(String aType){
		this.aType = TypeChange.stringToInt(aType);
	}
	public void setAct(String act){
		this.act = act.trim();
	}
	public void setAid(int aID){
		this.aID = aID;
	}
	
}

⌨️ 快捷键说明

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