示例#1
0
 public bool CheckDrink(string order)
 {
     _orderComponents = SplitOrderComponents(order);
     try {
         OrderValidator.ParseOrder(Menu, _orderComponents);
         return(true);
     }
     catch (Exception e) {
         return(false);
     }
 }
示例#2
0
        private void TakeOrder()
        {
            var    order           = _userIO.GetInput();
            var    orderComponents = new string[NumberOfComponents];
            string drinkCode;

            try {
                orderComponents = order.Split(':');
                drinkCode       = orderComponents[DrinkCode];
                OrderValidator.ParseOrder(Menu, orderComponents);
            }
            catch (Exception e) {
                _userIO.ShowMessage($"Invalid Order - {e.Message}");
                return;
            }
            var menuItem = GetMenuItem(drinkCode);

            Transaction(order, menuItem);
        }