package BWP.MobileSale;

import org.forks.jsonrpc.RpcFacade;

public class UserGoodsStarCommand implements CommandService.Command {

	Long mGoodsID;
	Boolean mStarred;
	public UserGoodsStarCommand(Long goodsID,Boolean starred){
		mGoodsID = goodsID;
		mStarred = starred;
	}
	
	public void Execute() throws Exception {
		if(mStarred){
			AddGoods();
		}else{
			RemoveGoods();
		}
		
	}

	String addMethod = "/Sale/Sale/Rpcs/MobileOrder_User_GoodsRpc/Add";
	String removeMethod = "/Sale/Sale/Rpcs/MobileOrder_User_GoodsRpc/Remove";
	
	private void RemoveGoods() throws Exception {
		RpcFacade.rpcCall(removeMethod, mGoodsID);
		
	}

	private void AddGoods() throws Exception {
		RpcFacade.rpcCall(addMethod, mGoodsID);
		
	}

	public String getName() {
		// TODO Auto-generated method stub
		return "收藏存货";
	}

}
