Ejemplo n.º 1
0
 private void OnSelectCalculationSelector(CalculationSelector calculationSelector)
 {
     foreach (var calculationType in calculationSelector.CalculationTypes)
     {
         var amount = calculationType.Amount;
         if (amount == 0)
         {
             amount = GetTenderedValue();
         }
         if (calculationType.CalculationMethod == 0 || calculationType.CalculationMethod == 1)
         {
             amount = amount / ExchangeRate;
         }
         SelectedTicket.AddCalculation(calculationType, amount);
     }
     UpdatePaymentAmount(0);
     OrderSelector.UpdateTicket(SelectedTicket);
     RefreshValues();
 }
Ejemplo n.º 2
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 = "";
        }
Ejemplo n.º 3
0
        public void UpdateCalculations()
        {
            _ticketService.RecalculateTicket(SelectedTicket);
            if (GetRemainingAmount() < 0)
            {
                foreach (var cSelector in _applicationState.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);
                }
            }
        }