private IEnumerable<CommandButtonViewModel<PaymentType>> CreatePaymentButtons(IEnumerable<PaymentType> paymentTypes, ForeignCurrency foreignCurrency)
        {
            var result = new List<CommandButtonViewModel<PaymentType>>();
            if (_settleCommand != null)
            {
                result.Add(new CommandButtonViewModel<PaymentType>
                {
                    Caption = Resources.Settle,
                    Command = _settleCommand,
                });
            }

            var pts = foreignCurrency == null ? paymentTypes.Where(x => x.Account == null || x.Account.ForeignCurrencyId == 0) : paymentTypes.Where(x => x.Account != null && x.Account.ForeignCurrencyId == foreignCurrency.Id);
            result.AddRange(pts
                .OrderBy(x => x.SortOrder)
                .Select(x => new CommandButtonViewModel<PaymentType>
                {
                    Caption = x.Name.Replace(" ", "\r"),
                    Command = _makePaymentCommand,
                    Color = x.ButtonColor,
                    Parameter = x
                }));

            if (_closeCommand != null)
            {
                result.Add(new CommandButtonViewModel<PaymentType>
                {
                    Caption = Resources.Close,
                    Command = _closeCommand,
                    Color = "Red"
                });
            }
            return result;
        }
 public void Update(IEnumerable<PaymentType> paymentTypes, ForeignCurrency foreignCurrency)
 {
     _paymentButtons.Clear();
     _paymentButtons.AddRange(CreatePaymentButtons(paymentTypes, foreignCurrency));
 }
 public void Update(ForeignCurrency foreignCurrency)
 {
     PaymentButtonGroup.Update(_applicationState.GetPaymentScreenPaymentTypes(), foreignCurrency);
     RaisePropertyChanged(() => PaymentButtonGroup);
 }
 private void OnForeignCurrencySelected(ForeignCurrency obj)
 {
     ForeignCurrency = obj;
     _paymentButtonsViewModel.Update(ForeignCurrency);
 }
 private void UpdateCurrencyButtons()
 {
     if (ForeignCurrencyButtons.Count() == 1 && ForeignCurrencyButtons.First().Parameter.ExchangeRate == 1)
     {
         ForeignCurrency = ForeignCurrencyButtons.First().Parameter;
         ForeignCurrencyButtons.Clear();
     }
     foreach (var commandButtonViewModel in ForeignCurrencyButtons)
     {
         var pm = GetPaymentDueValue() / commandButtonViewModel.Parameter.ExchangeRate;
         commandButtonViewModel.Caption = string.Format(commandButtonViewModel.Parameter.CurrencySymbol, pm);
     }
 }
 public void Prepare()
 {
     ForeignCurrency = null;
     RefreshForeignCurrencyButtons();
 }
 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);
 }
 private void OnForeignCurrencySelected(ForeignCurrency obj)
 {
     ForeignCurrency = obj;
     CreateButtons(SelectedTicket);
 }
Exemple #9
0
 public AccountBuilder WithForeignCurrency(ForeignCurrency foreignCurrency)
 {
     if (foreignCurrency != null)
         _foreignCurrency = foreignCurrency;
     return this;
 }
Exemple #10
0
 private AccountBuilder(string accountName)
 {
     _accountName = accountName;
     _foreignCurrency = ForeignCurrency.Default;
 }
Exemple #11
0
 private Account CreateAccount(AccountType accountType, string accountName, int accountId, ForeignCurrency currency = null)
 {
     var result = AccountBuilder.Create(accountName)
         .WithId(accountId)
         .WithAccountType(accountType)
         .WithForeignCurrency(currency)
         .Build();
     Workspace.Add(result);
     Workspace.CommitChanges();
     return result;
 }
Exemple #12
0
        private AccountTransactionType CreateTransactionType(Account sourceAccount, Account targetAccount, ForeignCurrency foreignCurrency)
        {
            var result = new AccountTransactionType
             {
                 SourceAccountTypeId = sourceAccount.AccountTypeId,
                 TargetAccountTypeId = targetAccount.AccountTypeId,
                 DefaultSourceAccountId = sourceAccount.Id,
                 DefaultTargetAccountId = targetAccount.Id,
                 ForeignCurrencyId = foreignCurrency.Id
             };

            Workspace.Add(result);
            Workspace.CommitChanges();
            return result;
        }
Exemple #13
0
 private ForeignCurrency CreateForeignCurrency(string name, string symbol, decimal exchangeRate)
 {
     var result = new ForeignCurrency { CurrencySymbol = symbol + "{0}", ExchangeRate = exchangeRate, Name = name };
     Workspace.Add(result);
     return result;
 }