示例#1
0
        public void RefreshAccountTransactions(Ticket ticket)
        {
            foreach (var template in from order in ticket.Orders.GroupBy(x => x.AccountTransactionTypeId)
                                     where ticket.TransactionDocument.AccountTransactions.All(x => x.AccountTransactionTypeId != order.Key)
                                     select _cacheService.GetAccountTransactionTypeById(order.Key))
            {
                var transaction = ticket.TransactionDocument.AddNewTransaction(template, ticket.GetTicketAccounts());
                transaction.Reversable = false;
            }

            foreach (var taxTransactionTemplate in ticket.GetTaxIds().Select(x => _cacheService.GetAccountTransactionTypeById(x)))
            {
                ticket.TransactionDocument.AddSingletonTransaction(taxTransactionTemplate.Id,
                       taxTransactionTemplate, ticket.GetTicketAccounts());
            }
        }