public void UpdateLastSelectedOrder(OrderViewModel lastSelectedOrder)
 {
     foreach (var item in Orders.Where(x => x.Selected))
     {
         item.IsLastSelected = item == lastSelectedOrder;
     }
 }
 private OrderViewModel Add(Order ti)
 {
     var result = new OrderViewModel(ti);
     Orders.Add(result);
     return result;
 }
Beispiel #3
0
 private void OnItemSelected(OrderViewModel obj)
 {
     ToggleSelection();
 }
 private OrderViewModel Add(Order ti)
 {
     var result = new OrderViewModel(ti, _cacheService, _applicationState);
     Orders.Add(result);
     return result;
 }
        public OrderViewModel AddNewItem(int menuItemId, decimal quantity, string portionName, OrderTagTemplate template)
        {
            if (!SelectedTicket.Model.CanSubmit) return null;
            SelectedTicket.ClearSelectedItems();
            var menuItem = _cacheService.GetMenuItem(x => x.Id == menuItemId);
            if (menuItem.Portions.Count == 0) return null;

            var portion = menuItem.Portions[0];

            if (!string.IsNullOrEmpty(portionName) && menuItem.Portions.Count(x => x.Name == portionName) > 0)
            {
                portion = menuItem.Portions.First(x => x.Name == portionName);
            }

            var ti = SelectedTicket.Model.AddOrder(
                _applicationState.CurrentDepartment.TicketTemplate.SaleTransactionTemplate,
                _applicationState.CurrentLoggedInUser.Name, menuItem, portion.Name, SelectedDepartment.PriceTag);

            ti.Quantity = quantity > 9 ? decimal.Round(quantity / portion.Multiplier, LocalSettings.Decimals) : quantity;

            if (template != null) template.OrderTagTemplateValues.ToList().ForEach(x => ti.ToggleOrderTag(x.OrderTagGroup, x.OrderTag, 0));

            var orderViewModel = new OrderViewModel(ti, SelectedDepartment.TicketTemplate, _automationService);
            SelectedTicket.Orders.Add(orderViewModel);
            _ticketService.RecalculateTicket(SelectedTicket.Model);
            orderViewModel.PublishEvent(EventTopicNames.OrderAdded);
            _automationService.NotifyEvent(RuleEventNames.TicketLineAdded, new { Ticket = SelectedTicket.Model, orderViewModel.Model.MenuItemName });
            return orderViewModel;
        }
Beispiel #6
0
 private void OnItemSelected(OrderViewModel obj)
 {
     ToggleSelection();
 }
 private OrderViewModel Add(Order ti)
 {
     var result = new OrderViewModel(ti, _automationService);
     Orders.Add(result);
     return result;
 }