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); }
private static void EnsureWarehouse(FulfillmentDB context, Domain.Product product) { var warehouses = context.GetWarehouseRepository(); var warehouse = warehouses.GetAll() .FirstOrDefault(); if (warehouse == null) { warehouse = new Domain.Warehouse { Name = "Hangar 18" }; warehouse.Requisitions = new List<Domain.Requisition>() { new Domain.Requisition { Product = product, Quantity = 50, Restocks = new List<Domain.Restock> { new Domain.Restock() } } }; warehouses.Add(warehouse); warehouses.SaveChanges(); } }