日期:2014-05-20 浏览次数:20946 次
/**
* 主人的买
*/
@Override
public boolean buy(Pet pet) throws Exception {
IPetStorsBiz storsBiz = new PetStorsBizImpl();
// TODO Auto-generated method stub
pet.setOwnerID(pet.getOwner().getId());
pet.setStoreID(0);
pet.setNewBreed(2);
petDao.update(pet);
pet.getOwner().setMoney(pet.getOwner().getMoney() - 5);
petOwnerDao.update(pet.getOwner());
storsBiz.sell(pet);
return true;
}
/**
* 主人的卖
*/
@Override
public boolean sell(Pet pet) throws Exception {
// TODO Auto-generated method stub
IPetStorsBiz storsBiz = new PetStorsBizImpl();
storsBiz.buy(pet);
pet.getOwner().setMoney(pet.getOwner().getMoney() + 5);
//storsBiz.buy(pet);
return true;
}
/**
* 商店买
*/
@Override
public boolean buy(Pet pet) throws Exception {
IPetOwnerBiz ownerBiz = new PetOwnerBizImpl();
pet.setStoreID(pet.getStore().getId());
pet.setOwnerID(0);
pet.setNewBreed(2);
petDao.update(pet);
pet.getStore().setBalance(pet.getStore().getBalance() + 5);
petStoreDao.update(pet.getStore());
ownerBiz.sell(pet);
return true;
}
/**
* 商店卖
*/
@Override
public boolean sell(Pet pet) throws Exception {
// TODO Auto-generated method stub
IPetOwnerBiz ownerBiz = new PetOwnerBizImpl();
ownerBiz.buy(pet);
pet.getStore().setBalance(pet.getStore().getBalance() - 5);
return true;
}