public object Execute(object system)
		{
			PurchaseOrder purchaseOrder = null;
			PetStore ps  = (PetStore) system;
			long id = ps.nextPurchaseOrderId();
			if (!PurchaseOrder.checkCreate(id, ps.getAccount(accountLogin), this.shippingInfo, this.billingInfo, this.items, PrevalenceEngine.Now)) 
			{
				throw new ArgumentException ("Invalid purchase order parameters.");			
			}
			purchaseOrder = new PurchaseOrder(id, ps.getAccount(accountLogin), shippingInfo, billingInfo, items, PrevalenceEngine.Now);
			ps.addPurchaseOrder(purchaseOrder);
			return purchaseOrder;
		}
Exemplo n.º 2
0
		public void addPurchaseOrder(PurchaseOrder order) 
		{
			if (getPurchaseOrder(order.id) != null) 
				throw new ArgumentException("The Purchase Order ID is in use.");
			purchaseOrders.Add(order.id, order);
		}