コード例 #1
0
        private void SubmitPaymentAmount(PaymentType paymentType, ChangePaymentType changeTemplate, decimal paymentDueAmount, decimal tenderedAmount)
        {
            _applicationStateSetter.SetLastPaidItems(OrderSelector.GetSelectedItems());

            var returningAmount = DisplayReturningAmount(tenderedAmount, paymentDueAmount, changeTemplate);

            if (changeTemplate == null)
            {
                tenderedAmount -= returningAmount;
            }

            var paymentAccount = paymentType.Account ?? GetAccountForTransaction(paymentType, SelectedTicket.TicketResources);

            _ticketService.AddPayment(SelectedTicket, paymentType, paymentAccount, tenderedAmount);

            if (tenderedAmount > paymentDueAmount && changeTemplate != null)
            {
                _ticketService.AddChangePayment(SelectedTicket, changeTemplate, changeTemplate.Account, tenderedAmount - paymentDueAmount);
            }

            NumberPadViewModel.LastTenderedAmount = (tenderedAmount / ExchangeRate).ToString("#,#0.00");

            UpdatePaymentAmount(GetRemainingAmount());

            if (returningAmount == 0 && GetRemainingAmount() == 0)
            {
                ClosePaymentScreen();
            }
            else
            {
                OrderSelector.PersistSelectedItems();
                RefreshValues();
            }
        }
コード例 #2
0
 public OrderSelectorViewModel(TenderedValueViewModel tenderedValueViewModel)
 {
     _tenderedValueViewModel = tenderedValueViewModel;
     Model     = new OrderSelector();
     Selectors = new ObservableCollection <SelectorViewModel>();
     SelectMergedItemCommand = new DelegateCommand <SelectorViewModel>(OnMergedItemSelected);
 }
コード例 #3
0
 public OrderSelectorViewModel(TenderedValueViewModel tenderedValueViewModel)
 {
     _tenderedValueViewModel = tenderedValueViewModel;
     Model = new OrderSelector();
     Selectors = new ObservableCollection<SelectorViewModel>();
     SelectMergedItemCommand = new DelegateCommand<SelectorViewModel>(OnMergedItemSelected);
 }
コード例 #4
0
 public OrderSelectorViewModel(OrderSelector model, NumberPadViewModel numberPadViewModel)
 {
     _numberPadViewModel = numberPadViewModel;
     Model     = model;
     Selectors = new ObservableCollection <SelectorViewModel>();
     SelectMergedItemCommand = new DelegateCommand <SelectorViewModel>(OnMergedItemSelected);
 }
コード例 #5
0
 public OrderSelectorViewModel(OrderSelector model, NumberPadViewModel numberPadViewModel)
 {
     _numberPadViewModel = numberPadViewModel;
     Model = model;
     Selectors = new ObservableCollection<SelectorViewModel>();
     SelectMergedItemCommand = new DelegateCommand<SelectorViewModel>(OnMergedItemSelected);
 }
コード例 #6
0
 void NumberPadViewModelResetValue(object sender, EventArgs e)
 {
     UpdatePaymentAmount(0);
     OrderSelector.ClearSelection();
     RefreshValues();
     RaisePropertyChanged(() => PaymentAmount);
     RaisePropertyChanged(() => TenderedAmount);
 }
コード例 #7
0
        private void ClosePaymentScreen()
        {
            OrderSelector.PersistTicket();

            EventServiceFactory.EventService.PublishEvent(EventTopicNames.CloseTicketRequested);
            TenderedAmount            = "";
            ReturningAmount           = "";
            ReturningAmountVisibility = Visibility.Collapsed;
            IsChangeOptionsVisible    = false;
            SelectedTicket            = null;
        }
コード例 #8
0
 public void Prepare(Ticket selectedTicket)
 {
     ForeignCurrency = null;
     Debug.Assert(SelectedTicket == null);
     _applicationStateSetter.SetLastPaidItems(new List <PaidItem>());
     Totals.Model         = selectedTicket;
     SelectedTicket       = selectedTicket;
     TicketRemainingValue = GetRemainingAmount();
     UpdatePaymentAmount(0);
     OrderSelector.UpdateTicket(selectedTicket);
     RefreshValues();
     NumberPadViewModel.LastTenderedAmount = PaymentAmount;
     CreateButtons(selectedTicket);
 }
コード例 #9
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();
 }