/// <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); } }
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); }
/// <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); } }
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); } }