package com.wxpn.tutorial.ec.bean;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 描述: 描述书籍信息类
 * 
 * @Copyright (c) 2005-2008 Wang Xining
 * @author 王夕宁
 * @version 1.0
 */

public class ECBook {
	private int id;

	private String name;

	private String author;

	private String language;

	private String content;

	private int category;

	private String strCategory;

	private int commend;

	private String strCommend;

	private String publish_name;

	private String publish_address;

	private int cdrom;

	private String strCdrom;

	private double price;

	private Date on_sale_time;

	private String str_on_sale_time;

	private int discount;

	private String strDiscount;

	private int stock;

	public int getId() {
		return id;
	}

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

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public int getCategory() {
		return category;
	}

	public void setCategory(int category) {
		this.category = category;
	}

	public int getCdrom() {
		return cdrom;
	}

	public void setCdrom(int cdrom) {
		this.cdrom = cdrom;
	}

	public int getCommend() {
		return commend;
	}

	public void setCommend(int commend) {
		this.commend = commend;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public int getDiscount() {
		return discount;
	}

	public void setDiscount(int discount) {
		this.discount = discount;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getOn_sale_time() {
		return on_sale_time;
	}

	public void setOn_sale_time(Date on_sale_time) {
		this.on_sale_time = on_sale_time;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public String getPublish_address() {
		return publish_address;
	}

	public void setPublish_address(String publish_address) {
		this.publish_address = publish_address;
	}

	public String getPublish_name() {
		return publish_name;
	}

	public void setPublish_name(String publish_name) {
		this.publish_name = publish_name;
	}

	public int getStock() {
		return stock;
	}

	public void setStock(int stock) {
		this.stock = stock;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getStr_on_sale_time() {
		if (getOn_sale_time() != null) {
			SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

			str_on_sale_time = formatter.format(getOn_sale_time());
		}
		
		return str_on_sale_time;
	}

	public void setStr_on_sale_time(String str_on_sale_time) {
		this.str_on_sale_time = str_on_sale_time;
	}

	public String getLanguage() {
		return language;
	}

	public String getStrCategory() {
		switch (category) {
		case 1:
			return "计算机类";
		case 2:
			return "英语类";
		default:
			return "其他类 ";
		}
	}

	public String getStrDiscount() {
		switch (discount) {
		case 1:
			return "是";
		default:
			return "否 ";
		}
	}

	public String getStrCommend() {
		switch (commend) {
		case 1:
			return "好";
		case 2:
			return "较好";
		case 3:
			return "一般";
		case 4:
			return "较差";
		case 5:
			return "差";
		default:
			return "";
		}
	}

	public String getStrCdrom() {
		switch (cdrom) {
		case 1:
			return "是";
		default:
			return "否 ";
		}
	}

}
