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

📄 vetinfo.java~130~

📁 一个基于JAVA的BS结构的宠物诊所管理系统.是当年在学校时写的,大家指点一下.
💻 JAVA~130~
字号:
package gxaccp.t07.guoneng_wei.petclinicmanagesystem.actionform;

import java.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.http.*;

import org.apache.struts.action.*;
import gxaccp.t07.guoneng_wei.jdbc.*;
import gxaccp.t07.guoneng_wei.petclinicmanagesystem.beans.*;

public class VetInfo
    extends ActionForm implements Serializable {
  private String address; //地址
  private String resume; //简历
  private String sex; //性别
  private String telephone; //电话
  private String vetName; //兽医姓名
  private String professionID; //专业号
  private String professionName; //专业名
  private Vector allProfession; //所有专业对象

  private String id;
  public String getAddress() {
    return address;
  }

  public void setAddress(String address) {
    this.address = address;
  }

  public void setVetName(String vetName) {
    this.vetName = vetName;
  }

  public void setTelephone(String telephone) {
    this.telephone = telephone;
  }

  public void setSex(String sex) {
    this.sex = sex;
  }

  public void setResume(String resume) {
    this.resume = resume;
  }

  public void setProfessionID(String professionID) {
    this.professionID = professionID;
  }

  public void setProfessionName(String professionName) {
    this.professionName = professionName;
  }

  public void setAllProfession(Vector allProfession) {
    this.allProfession = allProfession;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getResume() {
    return resume;
  }

  public String getSex() {
    return sex;
  }

  public String getTelephone() {
    return telephone;
  }

  public String getVetName() {
    return vetName;
  }

  public String getProfessionID() {
    return professionID;
  }

  public String getProfessionName() {
    return professionName;
  }

  public Vector getAllProfession() {
    this.setAllProfession(ProfessionType.getProfessionTypes());
    return allProfession;
  }

  public String getId() {
    return id;
  }

  public ActionErrors validate(ActionMapping actionMapping,
                               HttpServletRequest httpServletRequest) {
    /** @todo: finish this method, this is just the skeleton.*/
    return null;
  }

  public void reset(ActionMapping actionMapping,
                    HttpServletRequest servletRequest) {
    id = "";
    address = ""; //地址
    resume = ""; //简历
    sex = ""; //性别
    telephone = ""; //电话
    vetName = ""; //兽医姓名
    professionID = ""; //专业号
    professionName = ""; //专业名
    allProfession = null; //所有专业对象
  }

  public boolean addNewVet() {
    Connection con = DataBaseAccess.getConnection();
    CallableStatement cst = null;
    try {
//      proc_insertVetInfo
//          @VetName NVARCHAR(10),
//          @Sex BIT,
//          @PID INT,
//          @Telephone VARCHAR(12) = '0000 - 0000000',
//          @Address NVARCHAR(50) = '无详细地址 ',
//          @Resume NVARCHAR(500) = '无详细简历 '

      cst = con.prepareCall("{call proc_insertVetInfo (?,?,?,?,?,?)}");

      cst.setString(1, this.getVetName());
      cst.setInt(2, Integer.parseInt(this.getSex()));
      cst.setInt(3, Integer.parseInt(this.getProfessionID()));
      cst.setString(4, this.getTelephone());
      cst.setString(5, this.getAddress());
      cst.setString(6, this.getResume());
      cst.execute();
      return true;
    }
    catch (Exception ex) {

    }
    finally {
      DataBaseAccess.closeStatement(cst);
      DataBaseAccess.closeConnection(con);
    }
    return false;
  }

  public Vector searchVets(String professionType, String vetName) {

    Connection con = DataBaseAccess.getConnection();
    PreparedStatement pst = null;
    ResultSet rs = null;
    String sql = "SELECT * FROM view_VetInfo WHERE PID=? OR VetName=? ";
    boolean flag = false;
    try {
      pst = con.prepareStatement(sql);
      rs = pst.executeQuery();
      Vector v = new Vector();
      while (rs.next()) {
        flag = true;
        VetInfo vi = new VetInfo();
//VID VetName Sex PID PName Telephone  Address Resume
        vi.setId(rs.getString("VID"));
        vi.setVetName(rs.getString("VetName"));
        vi.setSex(rs.getString("Sex"));
        vi.setProfessionID(rs.getString("PID"));
        vi.setProfessionName(rs.getString("PName"));
        vi.setTelephone(rs.getString("Telephone"));
        vi.setAddress(rs.getString("Address"));
        vi.setResume(rs.getString("Resume"));
        v.addElement(vi);
      }
      if (flag) {
        return v;
      }

    }
    catch (Exception ex) {

    }
    finally {
      DataBaseAccess.closeResultSet(rs);
      DataBaseAccess.closeStatement(pst);
      DataBaseAccess.closeConnection(con);
    }
    return null;
  }
}

⌨️ 快捷键说明

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