Beispiel #1
0
        public int Insert(OrderInfo order)
        {
            // Call the insert method in the DAL to insert the header
            int orderId = dal.Insert(order);

            // Get an instance of the Inventory business component
            InventoryBO inventory = new InventoryBO();

            inventory.TakeStock(order.LineItems);

            // As part of the sample application we have created a user
            // you can tested distributed transactions with
            // If the order has been created with the user 'Acid',
            // then throw an exception which will rollback the entire transaction
            if (order.UserId == ACID_USER_ID)
            {
                throw new ApplicationException(ACID_ERROR_MSG);
            }

            // Set the orderId so that it can be returned to the caller
            return(orderId);
        }
Beispiel #2
0
        /// <summary>
        /// Internal method to get the stock level of an item
        /// </summary>
        /// <param name="ItemId">Unique identifier of item to get stock level of</param>
        /// <returns></returns>
        private int GetInStock(string ItemId)
        {
            InventoryBO inventory = new InventoryBO();

            return(inventory.CurrentQuantityInStock(ItemId));
        }