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

📄 voteclass.java

📁 一个简单的用java+flex写的投票系统
💻 JAVA
字号:
package JspVoteSystem.ControlDB;

/**
 * <p>Title: VoteClass</p>
 * <p>Description: 对Vote的中的字段进行操作的Class</p>
 * <p>Copyright: Copyright (c) 2007</p>
 * @author kenshin
 * @version 1.0
 */

public class VoteClass {
    private int m_intVote_ID;
    private String m_strVote_Name;
    private String m_strVote_Email;

    //投票者地区和地区计数的的字段
    private String m_strVote_Area;
    private int m_intVote_AreaCount;

    //投票者职业和职业的计数的字段
    private String m_strVote_Occupations;
    private int m_intVote_OccupationsCount;

    //投票者第一个问题和第一个问题计数的字段
    private String m_strVote_Question1;
    private int m_intVote_Question1Count;

    //投票者第二个问题和第二个问题计数的字段
    private String m_strVote_Question2;
    private int m_intVote_Question2Count;

    //投票者第三个问题和第三个问题计数的字段
    private String m_strVote_Question3;
    private int m_intVote_Question3Count;

    //投票者第四个问题字段
    private String m_strVote_Question4;

    //Add 2006.10.04 增加了check用戶的IP地址和Email的功能,用户的ip地址
    private String m_strVote_IP;

    //sql文
    public String m_strUserSql;

	public VoteClass(){
		m_intVote_ID = 0;
		m_strVote_Name = null;
	    m_strVote_Email = null;

	    m_strVote_Area = null;
	    m_intVote_AreaCount = 0;

	    m_strVote_Occupations = null;
	    m_intVote_OccupationsCount = 0;

	    m_strVote_Question1 = null;
		m_intVote_Question1Count = 0;

	    m_strVote_Question2 = null;
		m_intVote_Question2Count = 0;

	    m_strVote_Question3 = null;
		m_intVote_Question3Count = 0;

	    m_strVote_Question4 = null;

	    m_strVote_IP = null;
	    
	    m_strUserSql = null;
	}

	public void SetVote_ID(int p_intVote_ID){
		this.m_intVote_ID = p_intVote_ID;
	}

	public int GetVote_ID(){
		return this.m_intVote_ID;
	}

	public void SetVote_Name(String p_strVote_Name){
		this.m_strVote_Name = p_strVote_Name;
	}

	public String GetVote_Name(){
		return this.m_strVote_Name;
	}

	public void SetVote_Email(String p_strVote_Email){
		this.m_strVote_Email = p_strVote_Email;
	}

	public String GetVote_Email(){
		return this.m_strVote_Email;
	}

	public void SetVote_Area(String p_strVote_Area){
		this.m_strVote_Area = p_strVote_Area;
	}

	public String GetVote_Area(){
		return this.m_strVote_Area;
	}

	public void SetVote_AreaCount(int p_intVote_AreaCount){
		this.m_intVote_AreaCount = p_intVote_AreaCount;
	}

	public int GetVote_AreaCount(){
		return this.m_intVote_AreaCount;
	}

	public void SetVote_Occupations(String p_strVote_Occupations){
		this.m_strVote_Occupations = p_strVote_Occupations;
	}

	public String GetVote_Occupations(){
		return this.m_strVote_Occupations;
	}

	public void SetVote_Question4Count(int p_intVote_OccupationsCount){
		this.m_intVote_OccupationsCount = p_intVote_OccupationsCount;
	}

	public int GetVote_Question4Count(){
		return this.m_intVote_OccupationsCount;
	}

	public void SetVote_Question1(String p_strVote_Question1){
		this.m_strVote_Question1 = p_strVote_Question1;
	}

	public String GetVote_Question1(){
		return this.m_strVote_Question1;
	}

	public void SetVote_Question1Count(int p_intVote_Question1Count){
		this.m_intVote_Question1Count = p_intVote_Question1Count;
	}

	public int GetVote_Question1Count(){
		return this.m_intVote_Question1Count;
	}

	public void SetVote_Question2(String p_strVote_Question2){
		this.m_strVote_Question2 = p_strVote_Question2;
	}

	public String GetVote_Question2(){
		return this.m_strVote_Question2;
	}

	public void SetVote_Question2Count(int p_intVote_Question2Count){
		this.m_intVote_Question2Count = p_intVote_Question2Count;
	}

	public int GetVote_Question2Count(){
		return this.m_intVote_Question2Count;
	}

	public void SetVote_Question3(String p_strVote_Question3){
		this.m_strVote_Question3 = p_strVote_Question3;
	}

	public String GetVote_Question3(){
		return this.m_strVote_Question3;
	}

	public void SetVote_Question3Count(int p_intVote_Question3Count){
		this.m_intVote_Question3Count = p_intVote_Question3Count;
	}

	public int GetVote_Question3Count(){
		return this.m_intVote_Question3Count;
	}

	public void SetVote_Question4(String p_strVote_Question4){
		this.m_strVote_Question4 = p_strVote_Question4;
	}

	public String GetVote_Question4(){
		return this.m_strVote_Question4;
	}

    //Add 2006.10.04 增加了check用戶的IP地址和Email的功能,用户的ip地址 START
	public void SetVote_IP(String p_strVote_IP){
		this.m_strVote_IP = p_strVote_IP;
	}

	public String GetVote_IP(){
		return this.m_strVote_IP;
	}
    //Add 2006.10.04 增加了check用戶的IP地址和Email的功能,用户的ip地址  END

	/**
	* <p>Title: SQL_SelectByAllFromVote</p>
	* <p>Description: 查询vote所有的字段</p>
	* <p>Copyright: Copyright (c) 2007</p>
	* @param null
 	* @return 一个sql语句
	* @author kenshin
	* @version 1.0
	*/
	public String SQL_SelectByAllFromVote(){
		m_strUserSql = "select * from vote;";
		return this.m_strUserSql;
	}

	/**
	* <p>Title: SQL_SelectByAreaFromVote</p>
	* <p>Description: 统计vote表中Area字段无重复的计数</p>
	* <p>Copyright: Copyright (c) 2007</p>
	* @param null
 	* @return 一个sql语句
	* @author kenshin
	* @version 1.0
	*/
	public String SQL_SelectByAreaFromVote(){
		m_strUserSql = "SELECT Vote_Area, COUNT(Vote_AreaCount) FROM db_vote GROUP BY Vote_Area;";
		return this.m_strUserSql;
	}

	/**
	* <p>Title: SQL_SelectByOccupationsFromVote</p>
	* <p>Description: 统计vote表中Occupations字段无重复的计数</p>
	* <p>Copyright: Copyright (c) 2007</p>
	* @param null
 	* @return 一个sql语句
	* @author kenshin
	* @version 1.0
	*/
	public String SQL_SelectByOccupationsFromVote(){
		m_strUserSql = "SELECT Vote_Occupations, COUNT(Vote_Occupations) FROM db_vote GROUP BY Vote_Occupations;";
		return this.m_strUserSql;
	}

	/**
	* <p>Title: SQL_SelectByQuestion1FromVote</p>
	* <p>Description: 统计vote表中Occupations字段无重复的计数</p>
	* <p>Copyright: Copyright (c) 2007</p>
	* @param null
 	* @return 一个sql语句
	* @author kenshin
	* @version 1.0
	*/
	public String SQL_SelectByQuestion1FromVote(){
		m_strUserSql = "SELECT Vote_Question1, COUNT(Vote_Question1Count) FROM db_vote GROUP BY Vote_Question1;";
		return this.m_strUserSql;
	}

	/**
	* <p>Title: SQL_SelectByQuestion2FromVote</p>
	* <p>Description: 统计vote表中Question2字段无重复的计数</p>
	* <p>Copyright: Copyright (c) 2007</p>
	* @param null
 	* @return 一个sql语句
	* @author kenshin
	* @version 1.0
	*/
	public String SQL_SelectByQuestion2FromVote(){
		m_strUserSql = "SELECT Vote_Question2, COUNT(Vote_Question2Count) FROM db_vote GROUP BY Vote_Question2;";
		return this.m_strUserSql;
	}

	/**
	* <p>Title: SQL_SelectByQuestion3FromVote</p>
	* <p>Description: 统计vote表中Question3字段无重复的计数</p>
	* <p>Copyright: Copyright (c) 2007</p>
	* @param null
 	* @return 一个sql语句
	* @author kenshin
	* @version 1.0
	*/
	public String SQL_SelectByQuestion3FromVote(){
		m_strUserSql = "SELECT Vote_Question3, COUNT(Vote_Question3Count) FROM db_vote GROUP BY Vote_Question3;";
		return this.m_strUserSql;
	}

	/**
	* <p>Title: SQL_InsertIntoAllFromVote</p>
	* <p>Description: 统计vote表中Question3字段无重复的计数</p>
	* <p>Copyright: Copyright (c) 2007</p>
	* @param p_strVote_Name  p_strVote_Email p_strVote_Area p_strVote_Occupations p_strVote_Question1 p_strVote_Question2 p_strVote_Question3 p_strVote_Question4
 	* @return 一个sql语句
	* @author kenshin
	* @version 1.1 2006.10.04 增加了用戶的IP地址的字段的insert
	*/
	public String SQL_InsertIntoAllFromVote(String p_strVote_Name,
                                            String p_strVote_Email,
                                            String p_strVote_Area,
                                            String p_strVote_Occupations,
                                            String p_strVote_Question1,
                                            String p_strVote_Question2,
                                            String p_strVote_Question3,
                                            String p_strVote_Question4,
                                            String p_strVote_IP){
	      m_strUserSql = "insert into db_vote(Vote_Name,Vote_Email,Vote_Area,Vote_Occupations,Vote_Question1,Vote_Question2,Vote_Question3,Vote_Question4,Vote_IP) " +
	      "values ('" + p_strVote_Name + "','" +
	                    p_strVote_Email + "','" +
	                    p_strVote_Area + "','" +
	                    p_strVote_Occupations + "','" +
	                    p_strVote_Question1 + "','" +
	                    p_strVote_Question2 + "','" +
	                    p_strVote_Question3 + "','" +
	                    p_strVote_Question4 + "','" +
	                    p_strVote_IP + "')";
          return this.m_strUserSql;
     }
	/**
	* <p>Title: SQL_SelectByUserIPFromVote</p>
	* <p>Description: 查詢vote表中是否存在重復的IP地址</p>
	* <p>Copyright: Copyright (c) 2006</p>
	* @param null
 	* @return 一个sql语句
	* @author kenshin
	* @version 1.0 2006.10.04 增加了用戶的IP地址的字段的insert
	*/
	public String SQL_SelectByUserIPFromVote(String p_strVote_IP){
		m_strUserSql = "SELECT Vote_IP FROM db_vote where Vote_IP = '" + p_strVote_IP + "';";
		return this.m_strUserSql;
	}

	/**
	* <p>Title: SQL_SelectByUserEmailFromVote</p>
	* <p>Description: 查詢vote表中是否存在重復的Email地址</p>
	* <p>Copyright: Copyright (c) 2006</p>
	* @param null
 	* @return 一个sql语句
	* @author kenshin
	* @version 1.0 2006.10.04 增加了用戶的IP地址的字段的insert
	*/
	public String SQL_SelectByUserEmailFromVote(String p_strVote_Email){
		m_strUserSql = "SELECT Vote_Email FROM db_vote where Vote_Email = '" + p_strVote_Email + "';";
		return this.m_strUserSql;
	}

}

⌨️ 快捷键说明

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