public void Close() { if (RemainingAmount == 0 && !HasActiveTimers()) { IsClosed = true; PaidItems.Clear(); } }
public void AddPayment(PaymentType paymentType, Account account, decimal amount, decimal exchangeRate, int userId) { var transaction = TransactionDocument.AddNewTransaction(paymentType.AccountTransactionType, GetTicketAccounts(account), amount, exchangeRate); var payment = new Payment { AccountTransaction = transaction, Amount = amount, Name = account.Name, PaymentTypeId = paymentType.Id }; Payments.Add(payment); LastPaymentDate = DateTime.Now; RemainingAmount = GetRemainingAmount(); if (RemainingAmount == 0) { PaidItems.Clear(); } }
public void PersistPaidItems() { foreach (var newPaidItem in NewPaidItems) { var item = newPaidItem; var pitem = PaidItems.SingleOrDefault( x => x.MenuItemId == item.MenuItemId && x.Price == item.Price); if (pitem != null) { pitem.Quantity += newPaidItem.Quantity; } else { PaidItems.Add(newPaidItem); } } NewPaidItems.Clear(); FontWeight = FontWeights.Normal; Refresh(); }
private decimal GetPaidItemsQuantity() { return(PaidItems.Sum(x => x.Quantity) + NewPaidItems.Sum(x => x.Quantity)); }