Esempio n. 1
0
        public static void CacheTicketItemOptions(TicketItem ticketItem)
        {
            IEnumerable <TicketItemOption> options = TicketItemOption.GetAll(ticketItem.PrimaryKey);

            ticketItem._cachedItemOptions.Clear();
            foreach (TicketItemOption option in options)
            {
                ticketItem._cachedItemOptions.Add(option);
            }
        }
Esempio n. 2
0
        public static void AdjustInventory(TicketItem ticketItem, bool increase,
                                           int?difference = null)
        {
            int quantity =
                (difference != null ? difference.Value :
                 (ticketItem.QuantityPending != null ? ticketItem.QuantityPending.Value :
                  ticketItem.Quantity));

            foreach (ItemIngredient itemIngredient in
                     ItemIngredient.GetAll(ticketItem.ItemId))
            {
                PosModelHelper.AdjustInventoryByIngredient(itemIngredient.IngredientId,
                                                           increase, itemIngredient.Amount * quantity,
                                                           itemIngredient.MeasurementUnit);
            }

            foreach (TicketItemOption ticketItemOption in
                     TicketItemOption.GetAll(ticketItem.PrimaryKey))
            {
                TicketItemOption.AdjustInventory(ticketItemOption, quantity,
                                                 increase);
            }
        }