Exemple #1
0
        private static Domain.Product EnsureProduct(FulfillmentDB context)
        {
            var products = context.GetProductRepository();
            var product = products.GetAll()
                .FirstOrDefault(p => p.ProductNumber == 11190);

            if (product == null)
            {
                product = new Domain.Product { ProductNumber = 11190 };
                products.Add(product);
                products.SaveChanges();
            }

            return product;
        }
        public FulfillmentService()
        {
            FulfillmentDB.Initialize();

            FulfillmentDB context = new FulfillmentDB();

            _customerService = new CustomerService(
                context.GetCustomerRepository());
            _productService = new ProductService(
                context.GetProductRepository());
            _inventoryAllocationService = new InventoryAllocationService(
                context.GetWarehouseRepository());
            _pickListService = new PickListService(
                context.GetPickListRepository());

            _messageQueue = new MsmqMessageQueueOutbound<
                Messages.PlaceOrder>(
                    ".",
                    typeof(Messages.PlaceOrder).FullName);
        }