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

📄 borrow.java

📁  一个用JSP写的基于了B/S的图书馆管理系统
💻 JAVA
字号:
package web;

import lms.*;
import java.util.Date;
import java.util.Vector;

public class Borrow extends DataBase{
  private String UserID;
  private String BookIndex;
  private Date OutDay;
  private Date InDay;
  private Date BackDay;
  //private int Action;

  public Borrow() {
    this.UserID = "";
    this.BookIndex ="";
    /*
    this.OutDay = new Date();
    this.InDay = new Date();
    this.Penalty = "0";
    this.Action = 1;*/
    this.OutDay = null;
    this.InDay = null;
    this.BackDay = null;
  }

  public void setUserID(String UserID){
    this.UserID = UserID;
  }
  public String getUserID(){
    return this.UserID;
  }

  public void setBookIndex(String BookIndex){
    this.BookIndex = BookIndex;
  }
  public String getBookIndex(){
    return this.BookIndex;
  }

  public void setOutDay(Date OutDay){
    this.OutDay = OutDay;
  }
  public Date getOutDay(){
    return this.OutDay;
  }

  public void setInDay(Date InDay){
    this.InDay = InDay;
  }
  public Date getInDay(){
    return this.InDay;
  }

  public void setBackDay(Date BackDay){
    this.BackDay = BackDay;
  }
  public Date getBackDay(){
    return this.BackDay;
  }

  /*
  public void setAction(int Action){
    this.Action = Action;
  }
  public int getAction(){
    return this.Action;
  }*/

  /*Get the Borrowed Records (not Return) */
  public Vector GetBookBorrow()
  {
  Vector v = new Vector();
  Vector borrow = new Vector();

  /** event = 1  **/
  String sql = "select * from BorrowRecord where UserID='"+this.UserID+"'"
      +" and event="+Global.BORROWING;
  try{
    rs = stm.executeQuery(sql);
    while (rs.next()) {
      Borrow record = new Borrow();
      record.setBookIndex(rs.getString("BookIndex"));
      record.setOutDay(rs.getDate("OutDay"));
      record.setInDay(rs.getDate("InDay"));
      record.setBackDay(rs.getDate("BackDay"));
      //record.setPenalty(rs.getString("Penalty"));
      //record.setAction(rs.getInt("Action"));
      v.addElement(record);
    }
    /*
    for ( int i =0; i<v.size();i++)
      for ( int j = i+1;j<v.size();j++){

      }*/

  }catch(Exception ex){
    System.out.println(ex.getMessage());

  }
  return v;
 }

 /** Get Borrowed Record (Returned) **/
 public Vector GetBookReturned()
 {
   Vector v= new Vector();

   /** event = 0 **/
   String sql = "select * from BorrowRecord where UserID='"+this.UserID+"'"
       +" and event="+Global.HAVRETURN;
   try{
     rs = stm.executeQuery(sql);
     while (rs.next()) {
       Borrow record = new Borrow();
       record.setBookIndex(rs.getString("BookIndex"));
       record.setOutDay(rs.getDate("OutDay"));
       record.setInDay(rs.getDate("InDay"));
       record.setBackDay(rs.getDate("BackDay"));
       //record.setAction(rs.getInt("Action"));
       v.addElement(record);
     }


   }catch(Exception ex){
     System.out.println(ex.getMessage());

   }
   return v;

 }

}

⌨️ 快捷键说明

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