Example #1
0
        /// <summary>
        /// Добавление комбо в заказ.
        /// </summary>
        private void AddComboInOrder()
        {
            var editSession = PluginContext.Operations.CreateEditSession();

            var          order        = PluginContext.Operations.GetOrders().Last();
            var          guest        = order.Guests.Last();
            var          compoundItem = AddSplittedCompoundItemInternal(editSession);
            var          product      = PluginContext.Operations.GetActiveProducts().Last();
            IProductSize size         = null;

            if (product.Scale != null)
            {
                size = product.Scale.DefaultSize;
            }
            var productItem        = editSession.AddOrderProductItem(1, PluginContext.Operations.GetActiveProducts().Last(), order, guest, size);
            var firstComboGroupId  = Guid.NewGuid();
            var secondComboGroupId = Guid.NewGuid();
            var comboItems         = new Dictionary <Guid, IOrderCookingItemStub>
            {
                { firstComboGroupId, productItem },
                { secondComboGroupId, compoundItem }
            };

            editSession.AddOrderCombo(Guid.NewGuid(), "Случайное комбо", 1, 500, Guid.NewGuid(), comboItems, order, guest);
            PluginContext.Operations.SubmitChanges(PluginContext.Operations.GetCredentials(), editSession);
        }
Example #2
0
 public Product(int id, string name, IProductSize size, Price cost, string color)
 {
     Id    = id;
     Name  = name;
     Size  = size;
     Cost  = cost;
     Color = color;
 }
Example #3
0
        public ProductItemModel(IProduct dish, decimal amount, [CanBeNull] IProductSize productSize)
        {
            this.dish   = dish;
            Amount      = amount;
            ProductSize = productSize;

            availableSizes = new ObservableCollection <IProductSize>(dish.Scale != null
                ? PluginContext.Operations.GetProductScaleSizes(dish.Scale).Except(PluginContext.Operations.GetDisabledSizesByProduct(dish))
                : Enumerable.Empty <IProductSize>());
        }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductController" /> class.
 /// </summary>
 /// <param name="_iProduct">The i product.</param>
 /// <param name="_iCategory">The i category.</param>
 /// <param name="_iProductUnit">The i product unit.</param>
 /// <param name="_iProductCategory">The i product category.</param>
 /// <param name="_iProductColor">Color of the i product.</param>
 /// <param name="_iProductImage">The i product image.</param>
 /// <param name="_iProductSize">Size of the i product.</param>
 public ProductController(IProduct _iProduct, ICategory _iCategory, IProductUnit _iProductUnit, IProductCategory _iProductCategory, IProductColor _iProductColor, IProductImage _iProductImage, IProductSize _iProductSize)
 {
     iProduct         = _iProduct;
     iCategory        = _iCategory;
     iProductUnit     = _iProductUnit;
     iProductCategory = _iProductCategory;
     iProductColor    = _iProductColor;
     iProductImage    = _iProductImage;
     iProductSize     = _iProductSize;
 }
Example #5
0
        public List <IProduct> Add(ProductRequest productRequest, ILocation location)
        {
            if (!productRequest.Name.Equals(new PizzaProductName()))
            {
                return(_nextStrategy.Add(productRequest, location));
            }

            IProductSize size = _sizeMap.DomainSize(productRequest.Size);

            _products.Add(new Pizza(size, productRequest.Ingredients.Select(i => _ingredientMap.DomainIngredient(i, new Pizza(size), location)).ToArray()));
            return(_products);
        }
Example #6
0
        public void GivenLargeSizeName_WhenAskingToMap_ThenItShouldReturnCorrectSize()
        {
            // arrange
            const string name    = "Large";
            SizeMap      sizeMap = new SizeMap();

            // act
            IProductSize mappedSize = sizeMap.DomainSize(name);

            // assert
            ((decimal)mappedSize.Price()).Should().Be(18.0m);
        }
Example #7
0
        public void GivenAlternativeSizeName_WhenAskingToMap_ThenItShouldReturnCorrectSize()
        {
            // arrange
            const string name    = "Mini";
            SizeMap      sizeMap = new SizeMap();

            // act
            IProductSize actual = sizeMap.DomainSize(name);

            // assert
            actual.GetType().Name.Should().Be(nameof(MiniPizzaSize));
        }
 public AdminController(
     IUserData userData,
     UserManager <User> userManager, IHostingEnvironment hostingEnvironment,
     ISize reposSize, IBrand reposBrand,
     IShipper reposShipper, IProduct reposProduct,
     ICategory reposCategory, ISupplier reposSupplier, IProductSize reposProductSize, IOrderDetails reposOrderDetails,
     IOrder reposOrder, ApplicationDbContext context, Microsoft.AspNetCore.SignalR.IHubContext <NotificationsHub> hubContext)
 {
     this.userData       = userData;
     this.userManager    = userManager;
     _hostingEnvironment = hostingEnvironment;
     _reposSize          = reposSize;
     _reposBrand         = reposBrand;
     _reposShipper       = reposShipper;
     _reposProduct       = reposProduct;
     _reposCategory      = reposCategory;
     _reposSupplier      = reposSupplier;
     _reposProductSize   = reposProductSize;
     _reposOrder         = reposOrder;
     _reposOrderDetails  = reposOrderDetails;
     _context            = context;
     _hubContext         = hubContext;
 }
Example #9
0
 protected Product(IProductSize size, IIngredient[] ingredients, Text productName) : this(size, ingredients, new MultiIngredientListStrategy(ingredients)) => _productName = productName;
Example #10
0
 public Pizza(IProductSize size, IIngredient[] ingredients) : base(size, ingredients, new PizzaProductName())
 {
 }
Example #11
0
 public Pizza(IProductSize size) : this(size, new IIngredient[0])
 {
 }
Example #12
0
 public Calzone(IProductSize size, IIngredient[] ingredients) : base(size, ingredients, new CalzoneProductName())
 {
 }
Example #13
0
 public Calzone(IProductSize size) : this(size, new IIngredient[0])
 {
 }