Beispiel #1
0
        public void RefreshValues()
        {
            if (SelectedTicket == null)
            {
                return;
            }

            _ticketService.RecalculateTicket(SelectedTicket);
            if (GetRemainingAmount() < 0)
            {
                foreach (var cSelector in _cacheService.GetCalculationSelectors().Where(x => !string.IsNullOrEmpty(x.ButtonHeader)))
                {
                    foreach (var ctemplate in cSelector.CalculationTypes)
                    {
                        while (SelectedTicket.Calculations.Any(x => x.CalculationTypeId == ctemplate.Id))
                        {
                            SelectedTicket.AddCalculation(ctemplate, 0);
                        }
                    }
                }

                _ticketService.RecalculateTicket(SelectedTicket);
                if (GetRemainingAmount() >= 0)
                {
                    InteractionService.UserIntraction.GiveFeedback(Resources.AllDiscountsRemoved);
                }
            }

            if (GetPaymentDueValue() <= 0)
            {
                UpdatePaymentAmount(SelectedTicket != null ? GetRemainingAmount() : 0);
            }

            Totals.ResetCache();

            RaisePropertyChanged(() => SelectedTicket);
            RaisePropertyChanged(() => Totals);
            RaisePropertyChanged(() => ReturningAmountVisibility);
            RaisePropertyChanged(() => ReturningAmount);
            TenderedAmount = "";
        }