private void BatchCreate(Func <AccountRowViewModel, AccountTransactionDocument> action)
        {
            if (Accounts.Where(x => x.IsSelected).Any(x => x.TargetAccounts.Any(y => y.SelectedAccountId == 0)))
            {
                return;
            }
            Accounts
            .Where(x => x.IsSelected && x.Amount != 0)
            .ToList()
            .ForEach(x => action(x));

            SelectedDocumentType.PublishEvent(EventTopicNames.BatchDocumentsCreated);
        }
 private void OnCreateDocuments(string obj)
 {
     if (Accounts.Where(x => x.IsSelected).Any(x => x.TargetAccounts.Any(y => y.SelectedAccountId == 0)))
     {
         return;
     }
     Accounts
     .Where(x => x.IsSelected && x.Amount != 0)
     .AsParallel()
     .SetCulture()
     .ForAll(x => _accountService.CreateTransactionDocument(x.Account, SelectedDocumentType, x.Description, x.Amount, x.TargetAccounts.Select(y => new Account {
         Id = y.SelectedAccountId, AccountTypeId = y.AccountType.Id
     })));
     SelectedDocumentType.PublishEvent(EventTopicNames.BatchDocumentsCreated);
 }
 public IEnumerable <AccountType> GetNeededAccountTypes()
 {
     return(SelectedDocumentType.GetNeededAccountTypes().Select(x => _cacheService.GetAccountTypeById(x)));
 }
 private void OnGoBack(string obj)
 {
     SelectedDocumentType.PublishEvent(EventTopicNames.BatchDocumentsCreated);
 }