?? gouwuchesessionbean.java~75~
字號:
package ejb;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
import javax.naming.*;
import java.util.*;
import java.util.Date;
import java.util.GregorianCalendar;
public class GouWuCheSessionBean implements SessionBean {
SessionContext sessionContext;
public void ejbCreate() throws CreateException {
}
public void ejbRemove() {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void setSessionContext(SessionContext sessionContext) {
this.sessionContext = sessionContext;
}
public boolean inster(String userCode, String number, String name,
String model, float price, String count1) {
boolean bool=false;
try{
Context ct = new InitialContext();
GouWuCheInfoHome home = (GouWuCheInfoHome)ct.lookup("GouWuCheInfo");
Date date;
GregorianCalendar cal;
String dinghao;
date=new Date();
cal=new GregorianCalendar();
cal.setTime(date);
dinghao=cal.get(cal.YEAR)+""+cal.get(cal.MONTH)+""+cal.get(cal.DATE)+""+cal.get(cal.HOUR+1)+""+cal.get(cal.MINUTE)+""+cal.get(cal.SECOND);
GouWuCheInfo rm = home.create(String.valueOf(dinghao));
rm.setCount1(count1);
rm.setModel(model);
rm.setName(name);
rm.setNumber(number);
rm.setPrice(price);
rm.setUserCode(userCode);
rm.setZhiFu("no");
bool=true;
}catch(java.lang.Exception e){e.printStackTrace();}
return bool;
}
public boolean delete(String dingDanHao) {
boolean bool=false;
try{
Context ct = new InitialContext();
GouWuCheInfoHome home = (GouWuCheInfoHome)ct.lookup("GouWuCheInfo");
GouWuCheInfo rm = home.findByPrimaryKey(dingDanHao);
rm.remove();
bool=true;
}catch(java.lang.Exception e){e.printStackTrace();}
return bool;
}
public boolean xiugai(String dingDanHao, String userCode, String number,
String name, String model, float price, String count1,
String zhiFu) {
boolean bool=false;
try{
Context ct = new InitialContext();
GouWuCheInfoHome home = (GouWuCheInfoHome) ct.lookup("GouWuCheInfo");
GouWuCheInfo rm = home.findByPrimaryKey(dingDanHao);
rm.setCount1(count1);
rm.setModel(model);
rm.setName(name);
rm.setNumber(number);
rm.setPrice(price);
rm.setUserCode(userCode);
rm.setZhiFu(zhiFu);
bool=true;
}catch(java.lang.Exception e){e.printStackTrace();}
return bool;
}
public boolean querenzhifu(String dingDanHao) {
boolean bool=false;
try{
Context ct = new InitialContext();
GouWuCheInfoHome home = (GouWuCheInfoHome) ct.lookup(
"GouWuCheInfo");
GouWuCheInfo rm = home.findByPrimaryKey(dingDanHao);
rm.setZhiFu("yes");
bool=true;
}catch(java.lang.Exception e){e.printStackTrace();}
return bool;
}
public List selectAll() {
List lt = new ArrayList();
try{
Context ct = new InitialContext();
GouWuCheInfoHome home = (GouWuCheInfoHome) ct.lookup(
"GouWuCheInfo");
Iterator it = home.findAll().iterator();
while(it.hasNext()){
GouWuCheInfo gouWuCheInfo = (GouWuCheInfo)it.next();
GouWuCheInfoVo vo = new GouWuCheInfoVo();
vo.setCount1(gouWuCheInfo.getCount1());
vo.setDingDanHao(gouWuCheInfo.getDingDanHao());
vo.setModel(gouWuCheInfo.getModel());
vo.setName(gouWuCheInfo.getName());
vo.setNumber(gouWuCheInfo.getNumber());
vo.setPrice(gouWuCheInfo.getPrice());
vo.setUserCode(gouWuCheInfo.getUserCode());
vo.setZhiFu(gouWuCheInfo.getZhiFu());
lt.add(vo);
}
}catch(java.lang.Exception e){e.printStackTrace();}
return lt;
}
public List selectForUserCode(String code) {
List lt = new ArrayList();
try{
Context ct = new InitialContext();
GouWuCheInfoHome home = (GouWuCheInfoHome) ct.lookup(
"GouWuCheInfo");
Iterator it = home.findForUserCode(code).iterator();
while(it.hasNext()){
GouWuCheInfo gouWuCheInfo = (GouWuCheInfo)it.next();
GouWuCheInfoVo vo = new GouWuCheInfoVo();
vo.setCount1(gouWuCheInfo.getCount1());
vo.setDingDanHao(gouWuCheInfo.getDingDanHao());
vo.setModel(gouWuCheInfo.getModel());
vo.setName(gouWuCheInfo.getName());
vo.setNumber(gouWuCheInfo.getNumber());
vo.setPrice(gouWuCheInfo.getPrice());
vo.setUserCode(gouWuCheInfo.getUserCode());
vo.setZhiFu(gouWuCheInfo.getZhiFu());
lt.add(vo);}
}catch(java.lang.Exception e){e.printStackTrace();}
return lt;
}
public List selectForZhiFu() {
List lt = new ArrayList();
try{
Context ct = new InitialContext();
GouWuCheInfoHome home = (GouWuCheInfoHome) ct.lookup(
"GouWuCheInfo");
Iterator it = home.findForZhiFu().iterator();
while(it.hasNext()){
GouWuCheInfo gouWuCheInfo = (GouWuCheInfo)it.next();
GouWuCheInfoVo vo = new GouWuCheInfoVo();
vo.setCount1(gouWuCheInfo.getCount1());
vo.setDingDanHao(gouWuCheInfo.getDingDanHao());
vo.setModel(gouWuCheInfo.getModel());
vo.setName(gouWuCheInfo.getName());
vo.setNumber(gouWuCheInfo.getNumber());
vo.setPrice(gouWuCheInfo.getPrice());
vo.setUserCode(gouWuCheInfo.getUserCode());
vo.setZhiFu(gouWuCheInfo.getZhiFu());
lt.add(vo);}
}catch(java.lang.Exception e){e.printStackTrace();}
return lt;
}
public GouWuCheInfoVo selectForDingDanHao(String dingDanHao) {
List lt = new ArrayList();
GouWuCheInfoVo vo = new GouWuCheInfoVo();
try{
Context ct = new InitialContext();
GouWuCheInfoHome home = (GouWuCheInfoHome) ct.lookup(
"GouWuCheInfo");
GouWuCheInfo gouWuCheInfo = home.findForDingDanHao(dingDanHao);
vo.setCount1(gouWuCheInfo.getCount1());
vo.setDingDanHao(gouWuCheInfo.getDingDanHao());
vo.setModel(gouWuCheInfo.getModel());
vo.setName(gouWuCheInfo.getName());
vo.setNumber(gouWuCheInfo.getNumber());
vo.setPrice(gouWuCheInfo.getPrice());
vo.setUserCode(gouWuCheInfo.getUserCode());
vo.setZhiFu(gouWuCheInfo.getZhiFu());
;}catch(java.lang.Exception e){e.printStackTrace();}
return vo;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -