예제 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="restaurantService">restaurantService</param>
 /// <param name="productService">productService</param>
 /// <param name="staffService">staffService</param>
 /// <param name="supplyService">supplyService</param>
 public StockManager(RestaurantService restaurantService, ProductService productService, StaffService staffService, SupplyService supplyService)
 {
     _restaurantService = restaurantService;
     _productService    = productService;
     _staffService      = staffService;
     _supplyService     = supplyService;
 }
예제 #2
0
        public ActionResult SupplyArchyList()
        {
            var supplyItem = SupplyService.GetSupplys();
            var model      = Mapper.Map <List <SupplyModel> >(supplyItem);

            return(View(model));
        }
예제 #3
0
        private SupplyService CreateSupplyService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new SupplyService(userId);

            return(service);
        }
        public async Task ProcessResupplyAmounts_ShouldReturnResupplyRequest()
        {
            // Assemble
            _mockProductService.Setup(mock => mock.IncreaseProductAmount(It.IsAny <int>(), It.IsAny <int>())).
            Returns(Task.FromResult(1));
            _supplyService = new SupplyService(_mockProductService.Object, _mockMapperService.Object);


            IEnumerable <Supply> supplies = new List <Supply>
            {
                new Supply
                {
                    Barcode = 123,
                    Amount  = 5
                },
                new Supply
                {
                    Barcode = 5345,
                    Amount  = 3
                }
            };

            // Assign
            var expectedRowsAffected = 2;

            // Act
            var rowsAffected = await _supplyService.ProcessResupplyAmounts(supplies);

            // Assert
            Assert.AreEqual(expectedRowsAffected, rowsAffected);
            _mockProductService.Verify(mock => mock.IncreaseProductAmount(It.IsAny <int>(), It.IsAny <int>()),
                                       Times.Exactly(2));
        }
예제 #5
0
        // GET: Item
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new SupplyService(userId);
            var model   = service.GetItems();

            return(View(model));
        }
예제 #6
0
        public StoreOrderTools()
        {
            _orderDL        = OrderDL.Instance;
            _supplyService  = SupplyService.Instance;
            _paymentService = PaymentService.Instance;

            Orders = new List <Order>();
        }
예제 #7
0
 public MakePurchaseSlave(IUserBuyer buyer, IStoresSyncher storesSync, IOrderDL orderDL, IPublisher publisher, IPolicyChecker checker)
 {
     _buyer          = buyer;
     _storesSync     = storesSync;
     _supplyService  = SupplyService.Instance;
     _paymentService = PaymentService.Instance;
     _orderDL        = orderDL;
     _publisher      = publisher;
     _checker        = checker;
 }
예제 #8
0
 public void BuildSupplyPoint()
 {
     MarketDB.Instance.InsertByForce();
     market        = MarketYard.Instance;
     item1         = new OrderItem("Cluckin Bell", null, "#9", 5.00, 2);
     item2         = new OrderItem("Cluckin Bell", null, "#9 Large", 7.00, 1);
     item3         = new OrderItem("Cluckin Bell", null, "#6 Extra Dip", 8.50, 1);
     supplyService = (SupplyService)market.GetSupplyService();
     supplyService.FixExternal();
 }
        public async Task GetCurrentSupplies_ShouldReturnSupplyRequest()
        {
            // Assemble
            IEnumerable <Product> products = new List <Product>
            {
                new Product
                {
                    Amount      = 50,
                    Barcode     = 123,
                    Discount    = Discount.NoDiscount,
                    Id          = 5,
                    Price       = 4.99M,
                    ProductName = "Kaas"
                },
                new Product
                {
                    Amount      = 100,
                    Barcode     = 321,
                    Discount    = Discount.Expiry,
                    Id          = 10,
                    Price       = 14.99M,
                    ProductName = "Bier"
                }
            };

            IEnumerable <Supply> supplies = new List <Supply>
            {
                new Supply
                {
                    Amount  = 50,
                    Barcode = 123
                },
                new Supply
                {
                    Amount  = 0,
                    Barcode = 321
                }
            };

            _mockProductService.Setup(mock => mock.GetAllProducts()).Returns(Task.FromResult(products));
            _mockMapperService.Setup(mock => mock.MapSupplyRequest(products)).Returns(supplies);
            _supplyService = new SupplyService(_mockProductService.Object, _mockMapperService.Object);

            // Act
            var actualSupplyRequest = await _supplyService.GetCurrentSupplies();

            // Assert
            _mockProductService.Verify(mock => mock.GetAllProducts(), Times.Once);
            _mockMapperService.Verify(mock => mock.MapSupplyRequest(products), Times.Once);
        }
예제 #10
0
        static void Main(string[] args)
        {
            try
            {
                var settings = ConfigurationManager.Instance.AppSettings.Map <Settings>();

                CustomerService   customerService   = new CustomerService(settings.DbSettings);
                FoodService       foodService       = new FoodService(settings.DbSettings);
                ProductService    productService    = new ProductService(settings.DbSettings);
                SupplierService   supplierService   = new SupplierService(settings.DbSettings);
                RestaurantService restaurantService = new RestaurantService(settings.DbSettings);
                StaffService      staffService      = new StaffService(settings.DbSettings);
                SupplyService     supplyService     = new SupplyService(settings.DbSettings);

                CustomerManager   customerManager   = new CustomerManager(customerService, foodService, restaurantService);
                MenuManager       foodManager       = new MenuManager(foodService, productService);
                ProductManager    productManager    = new ProductManager(productService, supplierService);
                RestaurantManager restaurantManager = new RestaurantManager(settings, restaurantService, staffService, customerService);
                SupplierManager   supplierManager   = new SupplierManager(supplierService);
                StockManager      stockManager      = new StockManager(restaurantService, productService, staffService, supplyService);


                restaurantManager.GenerateRestaurants(settings.GenerationCounts.RestaurantsCount);
                supplierManager.GenerateSuppliers(settings.GenerationCounts.SuppliersCount);
                customerManager.GenerateCustomers(settings.GenerationCounts.CustomersCount);
                customerManager.ClusterByLocation();
                productManager.GenerateProducts(settings.GenerationCounts.ProductTypesCount);
                foodManager.GenerateFoods(settings.GenerationCounts.FoodsCount);
                restaurantManager.HireStaff(settings.GenerationCounts.StaffsCount);
                stockManager.SetDefaultStockList();

                stockManager.InitializeStock(new DateTime(2017, 01, 01));

                //var firstDateOfSupply = new DateTime(2017, 01, 07);
                //var endDateOfYear = new DateTime(2017, 12, 31);

                //for (var currentDate = firstDateOfSupply; currentDate <= endDateOfYear; currentDate = currentDate.AddDays(1))
                //{
                //    stockManager.Supply(currentDate);
                //    customerManager.GenerateDailyVisits(currentDate);
                //}
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
            }

            System.Console.ReadKey();
        }
예제 #11
0
 private void CreateServices()
 {
     Output       = new OutputService(this);
     System       = new SystemService(this);
     Status       = new StatusService(this);
     Statistics   = new StatisticsService(this);
     Missing      = new MissingService(this);
     Team         = new TeamService(this);
     Extended     = new ExtendedService(this);
     Favourite    = new FavouriteService(this);
     Insolation   = new InsolationService(this);
     Supply       = new SupplyService(this);
     Search       = new SearchService(this);
     Notification = new NotificationService(this);
 }
예제 #12
0
        public JsonResult GetSupplyAjax(string supplyNumber)
        {
            var model = new SupplyModel();

            try
            {
                var supply = SupplyService.GetSupplyBySupplyNumber(supplyNumber);
                model = Mapper.Map <SupplyModel>(supply);
                model.SetSucces();
            }
            catch (Exception ex)
            {
                model.SetError(ex);
            }

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
예제 #13
0
 public static void CreateSupply()
 {
     var radOrder = new Random(DateTime.Now.Millisecond);
     var supply   = new Supply
     {
         City         = "Sławno",
         SupplyNumber = String.Format("{0}/{1}/{2}", radOrder.Next(10, 99), radOrder.Next(10, 99), radOrder.Next(1000, 9999)),
         SupplierId   = radOrder.Next(1, 10),
         CountryCode  = "PL",
         HouseNumber  = "10",
         SupplyStatus = eSupplyStatus.New,
         PostalCode   = "76-100",
         CreateDate   = DateTime.Now.AddDays(radOrder.Next(10)),
         Street       = "Warszkowo",
         Positions    = CreateSupplyPosition(),
     };
     var item = SupplyService.AddSupply(supply);
 }
예제 #14
0
 public SupplyController(PlatformContext context)
 {
     supplyService = new SupplyService(context);
 }