package BWP.MobileSale;

import java.io.Serializable;

import org.forks.jsonrpc.RpcFacade;

public class UserBuyerStarCommand implements CommandService.Command,Serializable {
	private static final long serialVersionUID = 1L;
	Long mBuyerID;
	Boolean mStared;
	
	public UserBuyerStarCommand(Long buyerID, Boolean stared){
		mBuyerID = buyerID;
		mStared = stared;
	}
	
	public void Execute() throws Exception {
		if(mStared){
			AddBuyer();
		}else{
			RemoveBuyer();
		}
		
	}

	String addMethod = "/Sale/Sale/Rpcs/MobileOrder_User_BuyerRpc/Add";
	String removeMethod = "/Sale/Sale/Rpcs/MobileOrder_User_Buyerrpc/Remove";
	
	private void RemoveBuyer() throws Exception {
		RpcFacade.rpcCall(removeMethod, mBuyerID);
		
	}

	private void AddBuyer() throws Exception {
		RpcFacade.rpcCall(addMethod, mBuyerID);
		
	}

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

}
