private void CloseTicket() { if (SelectedTicket == null) { return; } if (!SelectedTicket.CanCloseTicket() && !SelectedTicket.IsTaggedWithDefinedTags(_cacheService.GetTicketTagGroupNames())) { //SaveTicketIfNew(); //_ticketViewModel.RefreshVisuals(); return; } if (_ticketOrdersViewModel.Orders.Count > 0 && SelectedTicket.GetRemainingAmount() == 0) { var message = GetPrintError(); if (!string.IsNullOrEmpty(message)) { _ticketOrdersViewModel.ClearSelectedOrders(); _ticketViewModel.RefreshVisuals(); InteractionService.UserIntraction.GiveFeedback(message); return; } } _ticketOrdersViewModel.ClearSelectedOrders(); var result = _ticketService.CloseTicket(SelectedTicket); if (!string.IsNullOrEmpty(result.ErrorMessage)) { InteractionService.UserIntraction.GiveFeedback(result.ErrorMessage); } SelectedTicket = null; if (_applicationState.CurrentTerminal.AutoLogout) { _userService.LogoutUser(false); } else { if (ExpectedAction != null) { ExpectedAction.Invoke(); } else { EventServiceFactory.EventService.PublishEvent(EventTopicNames.ActivatePosView); } } ExpectedAction = null; _messagingService.SendMessage(Messages.TicketRefreshMessage, result.TicketId.ToString(CultureInfo.InvariantCulture)); _applicationStateSetter.SetApplicationLocked(false); }
private void ClearSelectedItems() { _ticketOrdersViewModel.ClearSelectedOrders(); RefreshSelectedItems(); }