Ejemplo n.º 1
0
        /// <summary>
        /// manages adding a POSItem to an order. If the POSItem already exists, the quantity is just incremented
        /// </summary>
        /// <param name="i"></param>
        /// <param name="quantity"></param>
        /// <returns>The POSLineItem for the POSItem. Will either return a new one, or an existing with its quantity incremented</returns>
        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="i">The i.</param>
        /// <param name="quantity">The quantity.</param>
        /// <returns>POSLineItem.</returns>
        public POSLineItem AddItem(POSItem i, int quantity)
        {
            bool        exists     = false;
            POSLineItem targetItem = null;

            foreach (POSLineItem lineI in Items)
            {
                if (lineI.Item.ID == i.ID)
                {
                    exists          = true;
                    lineI.Quantity += quantity;
                    targetItem      = lineI;
                    break;
                }
            }
            if (!exists)
            {
                POSLineItem li = new POSLineItem();
                li.Quantity = quantity;
                li.Item     = i;
                targetItem  = li;
                Items.Add(li);
            }
            onOrderChange(this, OrderChangeTarget.ITEM);
            return(targetItem);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Removes the item.
 /// </summary>
 /// <param name="selectedLineItem">The selected line item.</param>
 internal void RemoveItem(POSLineItem selectedLineItem)
 {
     Items.Remove(selectedLineItem);
     onOrderChange(this, OrderChangeTarget.ITEM);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the order line item.
 /// </summary>
 /// <param name="item">The item.</param>
 public void AddOrderLineItem(POSLineItem item)
 {
     this.Items.Add(item);
     onOrderChange(this, OrderChangeTarget.ITEM);
 }