示例#1
0
        public static Business.PurchaseOrder ConvertToBO(DTO.v2.PurchaseOrder purchaseOrder)
        {
            var retval = new Business.PurchaseOrder
            {
                CustomerId      = purchaseOrder.CustomerId,
                PurchaseOrderId = purchaseOrder.PurchaseOrderId,
                OrderDate       = purchaseOrder.OrderDate
            };

            foreach (var lineItem in purchaseOrder.LineItems)
            {
                // Probably want some validation logic around the Price to make
                // sure callers aren't changing this too...
                var boLineItem = new Business.LineItem
                {
                    ItemId          = lineItem.ItemId,
                    Line            = lineItem.Line,
                    Price           = lineItem.Price,
                    PurchaseOrderId = retval.PurchaseOrderId,
                    Qty             = lineItem.Quantity
                };

                retval.LineItems.Add(boLineItem);
            }
            return(retval);
        }
示例#2
0
        public bool Submit(DTO.v2.PurchaseOrder purchaseOrder)
        {
            var businessObject = ConvertToBO(purchaseOrder);

            return(businessObject.Submit());
        }