Beispiel #1
0
        public void UpdatePortion(MenuItemPortion portion, string priceTag, IEnumerable <TaxTemplate> taxTemplates)
        {
            PortionName = portion.Name;

            UpdateTaxTemplates(taxTemplates);

            if (!string.IsNullOrEmpty(priceTag))
            {
                string tag   = priceTag;
                var    price = portion.Prices.SingleOrDefault(x => x.PriceTag == tag);
                if (price != null && price.Price > 0)
                {
                    UpdatePrice(price.Price, price.PriceTag);
                }
                else
                {
                    priceTag = "";
                }
            }

            if (string.IsNullOrEmpty(priceTag))
            {
                UpdatePrice(portion.Price, "");
            }

            if (OrderTagValues.Any(x => x.MenuItemId > 0 && x.PortionName != portion.Name))
            {
                foreach (var orderTagValue in OrderTagValues.Where(x => x.MenuItemId > 0))
                {
                    orderTagValue.PortionName = portion.Name;
                }
                OrderTags       = JsonHelper.Serialize(OrderTagValues);
                _orderTagValues = null;
            }
        }
Beispiel #2
0
 public OrderTagValue GetOrderTagValue(string s)
 {
     if (OrderTagValues.Any(x => x.OrderTagGroupName == s))
     {
         return(OrderTagValues.First(x => x.OrderTagGroupName == s));
     }
     return(OrderTagValue.Empty);
 }
Beispiel #3
0
 public bool IsTaggedWith(OrderTag model)
 {
     return(OrderTagValues.Any(x => x.Name == model.Name));
 }
Beispiel #4
0
 public bool IsTaggedWith(OrderTag orderTag)
 {
     return(OrderTagValues.Any(x => x.TagValue == orderTag.Name));
 }
Beispiel #5
0
 public bool OrderTagExists(Func <OrderTagValue, bool> prediction)
 {
     return(OrderTagValues.Any(prediction));
 }