www.pudn.com > liberSystem.rar > ReaderAction.java, change:2012-06-06,size:3462b


package com.ccl.action; 
 
import java.util.Date; 
 
import org.apache.struts2.ServletActionContext; 
 
import com.ccl.domin.Operator; 
import com.ccl.domin.Reader; 
import com.ccl.service.ReaderService; 
import com.ccl.util.PublicUtil; 
import com.opensymphony.xwork2.ActionSupport; 
 
public class ReaderAction extends ActionSupport{ 
	private static ReaderService readerService=new ReaderService(); 
	private int id;	//主键,读者id 
	private String  name; 
	private String password; 
	private String identiCode;	 
	private String  realName;	 
	private String  sex; 
	private String papaertype; 
	private String paperNo; 
	private String tel; 
	private String email; 
	private Date registTime; 
	private String description; 
	private int type;		//外键,读者类型id 
	 
	public String reader_add(){ 
		Operator o= (Operator) ServletActionContext.getRequest().getSession().getAttribute("user"); 
		Reader r=new Reader(); 
		r.setDescription(description); 
		r.setEmail(email); 
		r.setName(name); 
		r.setOperator(o.getId()); 
		r.setPapaertype(papaertype); 
		r.setPaperNo(paperNo); 
		r.setPassword("000000");	//默认密码000000 
		r.setRealName(realName); 
		r.setRegistTime(new java.sql.Date(System.currentTimeMillis())); 
		r.setSex(sex); 
		r.setIdentiCode(PublicUtil.createReaderIdentiCode()); 
		r.setTel(tel); 
		r.setType(type); 
		readerService.insert(r); 
		return SUCCESS; 
	} 
	public String reader_del(){ 
		readerService.reader_del(id); 
		return SUCCESS; 
	} 
	public String reader_update(){ 
		Reader r=new Reader(); 
		r.setId(id); 
		r.setDescription(description); 
		r.setEmail(email); 
		r.setName(name); 
		r.setPapaertype(papaertype); 
		r.setPaperNo(paperNo); 
		r.setRealName(realName); 
		r.setSex(sex); 
		r.setTel(tel); 
		r.setType(type); 
		readerService.reader_update(r); 
		return SUCCESS; 
	} 
	public int getId() { 
		return id; 
	} 
	public void setId(int id) { 
		this.id = id; 
	} 
	public String getName() { 
		return name; 
	} 
	public void setName(String name) { 
		this.name = name; 
	} 
	public String getPassword() { 
		return password; 
	} 
	public void setPassword(String password) { 
		this.password = password; 
	} 
	public String getIdentiCode() { 
		return identiCode; 
	} 
	public void setIdentiCode(String identiCode) { 
		this.identiCode = identiCode; 
	} 
	public String getRealName() { 
		return realName; 
	} 
	public void setRealName(String realName) { 
		this.realName = realName; 
	} 
	public String getSex() { 
		return sex; 
	} 
	public void setSex(String sex) { 
		this.sex = sex; 
	} 
	public String getPapaertype() { 
		return papaertype; 
	} 
	public void setPapaertype(String papaertype) { 
		this.papaertype = papaertype; 
	} 
	public String getPaperNo() { 
		return paperNo; 
	} 
	public void setPaperNo(String paperNo) { 
		this.paperNo = paperNo; 
	} 
	public String getTel() { 
		return tel; 
	} 
	public void setTel(String tel) { 
		this.tel = tel; 
	} 
	public String getEmail() { 
		return email; 
	} 
	public void setEmail(String email) { 
		this.email = email; 
	} 
	public Date getRegistTime() { 
		return registTime; 
	} 
	public void setRegistTime(Date registTime) { 
		this.registTime = registTime; 
	} 
	public String getDescription() { 
		return description; 
	} 
	public void setDescription(String description) { 
		this.description = description; 
	} 
	public int getType() { 
		return type; 
	} 
	public void setType(int type) { 
		this.type = type; 
	} 
	 
	 
}