예제 #1
0
        private static void InsertOrderItem(IDbConnection dbConnection, OrderItem orderItem)
        {
            dbConnection.InsertOnly(orderItem, ev => ev.Insert(oi => new {oi.OrderId, oi.BagId, oi.Quantity, oi.UnitPrice}));

            var orderItemId = dbConnection.GetLastInsertId();
            orderItem.Id = Convert.ToUInt32(orderItemId);
        }
예제 #2
0
        public void Add(OrderItem orderItem)
        {
            if (OrderStatus != OrderStatus.Unpaid)
            {
                throw new InvalidOperationException("Unable to add lines to an order after it have been paid");
            }

            if (orderItem == null)
            {
                throw new ArgumentNullException("orderItem");
            }

            if (id > 0)
            {
                orderItem.OrderId = Id;
            }

            orderItems.Add(orderItem);
        }
예제 #3
0
        public void Remove(OrderItem orderItem)
        {
            if (orderItem == null)
            {
                throw new ArgumentNullException("orderItem");
            }

            orderItems.Remove(orderItem);
        }