Ejemplo n.º 1
0
        public void AddLineItem(PurchaseOrderLineItem item)
        {
            if (!IsInBudget(item))
            {
                throw new InvalidOperationException("Item exceeds budget");
            }

            LineItems.Add(item);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new PurchaseOrderLineItem object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="description">Initial value of the Description property.</param>
        /// <param name="price">Initial value of the Price property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="purchaseOrderId">Initial value of the PurchaseOrderId property.</param>
        /// <param name="position">Initial value of the Position property.</param>
        public static PurchaseOrderLineItem CreatePurchaseOrderLineItem(global::System.Int32 id, global::System.String description, global::System.Decimal price, global::System.Int32 quantity, global::System.Int32 purchaseOrderId, global::System.Int32 position)
        {
            PurchaseOrderLineItem purchaseOrderLineItem = new PurchaseOrderLineItem();

            purchaseOrderLineItem.Id              = id;
            purchaseOrderLineItem.Description     = description;
            purchaseOrderLineItem.Price           = price;
            purchaseOrderLineItem.Quantity        = quantity;
            purchaseOrderLineItem.PurchaseOrderId = purchaseOrderId;
            purchaseOrderLineItem.Position        = position;
            return(purchaseOrderLineItem);
        }
Ejemplo n.º 3
0
 public bool IsInBudget(PurchaseOrderLineItem item)
 {
     return(item.Total + TotalSpent <= MaxValue);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the PurchaseOrderLineItems EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPurchaseOrderLineItems(PurchaseOrderLineItem purchaseOrderLineItem)
 {
     base.AddObject("PurchaseOrderLineItems", purchaseOrderLineItem);
 }