NewEmployeeBean.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:3k
源码类别:
Java编程
开发平台:
Java
- package humanresource;
- import java.sql.*;
- public class NewEmployeeBean {
- private String name, address, phone, workstatus;
- private String healthCarePlan, dentalPlan, visionPlan;
- private int id, totalSickDays, takenSickDays;
- private int totalPersonalTime, takenPersonalTime;
- public void setName(String input){
- name = input;
- }
- public String getName(){
- return name;
- }
- public void setAddress(String input){
- address = input;
- }
- public String getAddress(){
- return address;
- }
- public void setPhone(String input){
- phone = input;
- }
- public String getPhone(){
- return phone;
- }
- public void setWorkstatus(String input){
- workstatus = input;
- }
- public String getWorkstatus(){
- return workstatus;
- }
- public void setHealthCarePlan(String input){
- healthCarePlan = input;
- }
- public String getHealthCarePlan(){
- return healthCarePlan;
- }
- public void setDentalPlan(String input){
- dentalPlan = input;
- }
- public String getDentalPlan(){
- return dentalPlan;
- }
- public void setVisionPlan(String input){
- visionPlan = input;
- }
- public String getVisionPlan(){
- return visionPlan;
- }
- public void setId(int input){
- id = input;
- }
- public int getId(){
- return id;
- }
- public void setTotalSickDays(int input){
- totalSickDays = input;
- }
- public int getTotalSickDays(){
- return totalSickDays;
- }
- public void setTakenSickDays(int input){
- takenSickDays = input;
- }
- public int getTakenSickDays(){
- return takenSickDays;
- }
- public void setTotalPersonalTime(int input){
- totalPersonalTime = input;
- }
- public int getTotalPersonalTime(){
- return totalPersonalTime;
- }
- public void setTakenPersonalTime(int input){
- takenPersonalTime = input;
- }
- public int getTakenPersonalTime(){
- return takenPersonalTime;
- }
- public void updateDatabase() {
- try{
- Connection conn=EmployeeInfoBean.coninit();
- String sql = "INSERT INTO EMPLOYEEINFO VALUES " +
- "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
- PreparedStatement statement = conn.prepareStatement(sql);
- statement.setInt(1, id);
- statement.setString(2, name);
- statement.setString(3, address);
- statement.setString(4, phone);
- statement.setString(5, workstatus);
- statement.setInt(6, totalSickDays);
- statement.setInt(7, takenSickDays);
- statement.setInt(8, totalPersonalTime);
- statement.setInt(9, takenPersonalTime);
- statement.setString(10, healthCarePlan);
- statement.setString(11, dentalPlan);
- statement.setString(12, visionPlan);
- statement.executeQuery();
- }
- catch (Exception e) {System.out.print("error");}
- }
- }