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

📄 designation.java

📁 It is an genric employee management application developed using JSP
💻 JAVA
字号:
/**
 * This Bean Has All the Functionalities related to the Bean and Properties
 */
package com;

import java.io.DataInputStream;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Enumeration;
import java.util.Vector;

/**
 * @author Prakash S
 */
public class Designation
{
	//Default Constructor for the Bean
	public Designation()
	{
		
	}
	
	/*Declarations
	 * ------------------
	 *Fields used by the Bean for Various Operations inculding Reports
	 * 
	 * */
	
	ResultSet beanRecSet=null;
	String strQuery="";
	int desigId;
	String designation;
	
	public String getDesignation()
	{
		return designation;
	}
	public void setDesignation(String cf1)
	{
		this.designation = cf1;
	}
	public int getDesigId()
	{
		return desigId;
	}
	public void setDesigId(int f1)
	{
		this.desigId = f1;
	}
	/* Adds a Recdord to a Table
	 * 
	 */
	public int addSamBean()
	{
		int count=0;
		DBOperations objDbOperations = new DBOperations();
		String insQuery = "INSERT INTO tbl_Designation (Designation) VALUES('"+designation+"')";
        count = objDbOperations.insertToTable(insQuery );
        objDbOperations.disConnect();
		return count;
	}
	/* Update Recdord(s) in the Table
	 * 
	 */
	public int updateSamBean()
	{
		int count=0;
		DBOperations objDbOperations = new DBOperations();
        String updateQuery = "UPDATE tbl_Designation SET " + " Designation='"+ designation+"' WHERE id="+desigId;
        count = objDbOperations.insertToTable( updateQuery );
        objDbOperations.disConnect();
		return count;
	}
	/*
	 * Delete Record(s) From Table
	 */
	public int deleteSamBean()
	{
		int count=0;
		DBOperations objDbOperations = new DBOperations();
        String deleteQuery = "DELETE FROM tbl_Designation WHERE Designation_ID="+ desigId + "";
        count = objDbOperations.deleteFromTable( deleteQuery );
        objDbOperations.disConnect();
		return count;
	}
	/*
	 * Set Current Bean Values for Update
	 */
	
	public void setRecord()
	{
		//Set Every Field to Empty and Clear the Field Contents
			/*setF1("");*/
		DBOperations objDbOperations = new DBOperations();
        String selectQuery = "SELECT Designation_ID,Designation FROM tbl_Designation WHERE Designation_ID="+ desigId;
		beanRecSet = objDbOperations.selectFromTable( selectQuery );
        try
        {
            while (beanRecSet.next())
            {
            	//set()
            	setDesignation(beanRecSet.getString("Designation"));
            	setDesigId(beanRecSet.getInt("Designation_ID"));
            }
        }catch(SQLException e)
        {
        	
        }
		//Set New Values
		/*setF1(rs.getString());*/
        objDbOperations.disConnect();
		
	}
	//Returns All the Records as a Vector
	public Vector getAllRecords()
	{
		Vector beanVetor=new Vector();
		DBOperations objDbOperations = new DBOperations();
        String selectQuery = "SELECT Designation_ID,Designation FROM tbl_Designation ORDER BY Designation_ID ASC";
        beanRecSet = objDbOperations.selectFromTable( selectQuery );
		try
		{
			while(beanRecSet.next())
			{
				Designation tempBean=new Designation();
				tempBean.setDesignation(beanRecSet.getString("Designation"));
				tempBean.setDesigId(Integer.parseInt(beanRecSet.getString("Designation_ID")));
				beanVetor.addElement( tempBean );				
			}
			return beanVetor;
		} catch (SQLException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return beanVetor;		
	}	
	
}

⌨️ 快捷键说明

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