public void AddPayment(PaymentType paymentType, Account account, decimal amount, decimal exchangeRate, int userId) { var transaction = TransactionDocument.AddNewTransaction(paymentType.AccountTransactionType, AccountTypeId, AccountId, 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 RemovePayment(Payment py) { Payments.Remove(py); TransactionDocument.AccountTransactions.Where(x => x.Id == py.AccountTransaction.Id).ToList().ForEach(x => TransactionDocument.AccountTransactions.Remove(x)); }
public Payment AddPayment(DateTime date, decimal amount, PaymentType paymentType, int userId, int departmentId) { var result = new Payment { Amount = amount, Date = date, PaymentType = (int)paymentType, UserId = userId, DepartmentId = departmentId }; DepartmentId = departmentId; Payments.Add(result); LastPaymentDate = DateTime.Now; RemainingAmount = GetRemainingAmount(); if (RemainingAmount == 0) { PaidItems.Clear(); } return result; }
public void AddPayment(PaymentType paymentType, Account account, decimal amount, decimal exchangeRate, int userId) { var transaction = TransactionDocument.AddNewTransaction(paymentType.AccountTransactionType, GetTicketAccounts(account), amount, exchangeRate); transaction.UpdateDescription(transaction.Name + " [" + account.Name + "]"); var payment = new Payment { AccountTransaction = transaction, Amount = amount, Name = account.Name, PaymentTypeId = paymentType.Id, UserId = userId }; Payments.Add(payment); LastPaymentDate = DateTime.Now; RemainingAmount = GetRemainingAmount(); }
public void AddPayment(AccountTransactionTemplate transactionTemplate, Account account, decimal amount, int userId) { var transaction = AccountTransaction.Create(transactionTemplate); transaction.Amount = amount; transaction.SetTargetAccount(account.AccountTemplateId, account.Id); transaction.UpdateAccounts(AccountTemplateId, AccountId); AccountTransactions.AccountTransactions.Add(transaction); var payment = new Payment { AccountTransaction = transaction, Amount = amount, Name = account.Name }; Payments.Add(payment); LastPaymentDate = DateTime.Now; RemainingAmount = GetRemainingAmount(); if (RemainingAmount == 0) { PaidItems.Clear(); } }
public PaymentViewModel(Payment model) { Model = model; }