Beispiel #1
0
        /// <summary>
        /// Remove specified quantity of the sale line item matched with the item Id.
        /// </summary>
        /// <remarks>The sale line item will be removed if final quantity is less than or equal zero.</remarks>
        /// <param name="itemId"></param>
        /// <param name="quantity"></param>
        public void removeItem(int itemId, int quantity)
        {
            SalesLineItem foundLineItem = findLineItem(itemId);

            if (foundLineItem == null)
            {
                return;
            }
            foundLineItem.removeQty(quantity);
            if (foundLineItem.getQty() <= 0)
            {
                itemList.Remove(foundLineItem);
            }
        }
Beispiel #2
0
 public void addItem(int itemId, int quantity)
 {
     SalesLineItem foundLineItem = findLineItem(itemId);
     if (foundLineItem == null)
     {
         if (quantity > 0)
         {
             SalesLineItem lineItem = new SalesLineItem(itemId, quantity);
             if (lineItem.getItem() != null)
                 itemList.Add(lineItem);
         }
     }
     else
         foundLineItem.addQty(quantity);
 }
Beispiel #3
0
        /// <summary>
        /// Update quantity for itemId.
        /// </summary>
        /// <remarks>The sale line item will be removed if final quantity is less than or equal zero.</remarks>
        /// <param name="itemId">Item Id of product. <see cref="T:Item"/></param>
        /// <param name="quantity">Quantity of the product. </param>
        public void updateItem(int itemId, int quantity)
        {
            SalesLineItem foundLineItem = findLineItem(itemId);

            if (foundLineItem == null)
            {
                return;
            }
            if (quantity <= 0)
            {
                itemList.Remove(foundLineItem);
            }
            else
            {
                foundLineItem.setQty(quantity);
            }
        }
Beispiel #4
0
        public void addItem(int itemId, int quantity)
        {
            SalesLineItem foundLineItem = findLineItem(itemId);

            if (foundLineItem == null)
            {
                if (quantity > 0)
                {
                    SalesLineItem lineItem = new SalesLineItem(itemId, quantity);
                    if (lineItem.getItem() != null)
                    {
                        itemList.Add(lineItem);
                    }
                }
            }
            else
            {
                foundLineItem.addQty(quantity);
            }
        }