Esempio n. 1
0
 public void AddItemToCart(int ItemNum,
                           decimal Amount,
                           int Quantity,
                           int CategoryNum,
                           string Description,
                           string CategoryDescription,
                           string ImageFileName)
 {
     if (Order != null)
     {
         IOrderItemModel FoundItem = FindItem(ItemNum);
         if (FoundItem == null)
         {
             IOrderItemModel item = Factory.MakeNewExtendedOrderItem(ItemNum, Amount, Quantity, Order.OrderNum, CategoryNum, Description, CategoryDescription, ImageFileName);
             Order.OrderItems.Add(item);
         }
         else
         {
             IOrderItemModel WorkItem = FoundItem;
             Order.OrderItems.Remove(FoundItem);
             WorkItem.Quantity += Quantity;
             Order.OrderItems.Add(WorkItem);
         }
         RefreshVariables();
     }
 }
Esempio n. 2
0
        public IOrderItemModel FindItem(int ItemNum)
        {
            IOrderItemModel FoundItem = null;

            foreach (IOrderItemModel item in Order.OrderItems)
            {
                if (item.ItemNum == ItemNum)
                {
                    FoundItem = item;
                }
            }

            return(FoundItem);
        }