Search in sources :

Example 1 with AddBidRequest

use of com.cmput301w18t05.taskzilla.request.command.AddBidRequest in project Taskzilla by CMPUT301W18T05.

the class Task method addBid.

/**
 * addBid
 * Insert into sorted bid list
 *
 * @author praharen
 */
public void addBid(Bid newbid) {
    GetBidsByTaskIdRequest getbidrequest = new GetBidsByTaskIdRequest(this.Id);
    RequestManager.getInstance().invokeRequest(getbidrequest);
    ArrayList<Bid> bidlist = getbidrequest.getResult();
    for (Bid bid : bidlist) {
        if (bid.getUserId().equals(newbid.getUserId())) {
            RemoveBidRequest removerequest = new RemoveBidRequest(bid);
            RequestManager.getInstance().invokeRequest(removerequest);
            break;
        }
    }
    AddBidRequest addBidRequest = new AddBidRequest(newbid);
    RequestManager.getInstance().invokeRequest(addBidRequest);
}
Also used : RemoveBidRequest(com.cmput301w18t05.taskzilla.request.command.RemoveBidRequest) GetBidsByTaskIdRequest(com.cmput301w18t05.taskzilla.request.command.GetBidsByTaskIdRequest) AddBidRequest(com.cmput301w18t05.taskzilla.request.command.AddBidRequest)

Aggregations

AddBidRequest (com.cmput301w18t05.taskzilla.request.command.AddBidRequest)1 GetBidsByTaskIdRequest (com.cmput301w18t05.taskzilla.request.command.GetBidsByTaskIdRequest)1 RemoveBidRequest (com.cmput301w18t05.taskzilla.request.command.RemoveBidRequest)1