本文整理汇总了C#中ICacheService.GetAccountTypeById方法的典型用法代码示例。如果您正苦于以下问题:C# ICacheService.GetAccountTypeById方法的具体用法?C# ICacheService.GetAccountTypeById怎么用?C# ICacheService.GetAccountTypeById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICacheService
的用法示例。
在下文中一共展示了ICacheService.GetAccountTypeById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update(ICacheService cacheService, Account selectedAccount, WorkPeriod currentWorkPeriod)
{
var accountType = cacheService.GetAccountTypeById(selectedAccount.AccountTypeId);
var transactions = Dao.Query(GetCurrentRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod)).OrderBy(x => x.Date);
Transactions = transactions.Select(x => new AccountDetailData(x, selectedAccount)).ToList();
if (accountType.DefaultFilterType > 0)
{
var pastDebit = Dao.Sum(x => x.Debit, GetPastRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod));
var pastCredit = Dao.Sum(x => x.Credit, GetPastRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod));
var pastExchange = Dao.Sum(x => x.Exchange, GetPastRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod));
if (pastCredit > 0 || pastDebit > 0)
{
Summaries.Add(new AccountSummaryData(Resources.Total, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit)));
var detailValue =
new AccountDetailData(
new AccountTransactionValue
{
Name = Resources.PastTransactions,
Credit = pastCredit,
Debit = pastDebit,
Exchange = pastExchange
}, selectedAccount) { IsBold = true };
Transactions.Insert(0, detailValue);
}
}
Summaries.Add(new AccountSummaryData(Resources.GrandTotal, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit)));
for (var i = 0; i < Transactions.Count; i++)
{
Transactions[i].Balance = (Transactions[i].Debit - Transactions[i].Credit);
if (i > 0) (Transactions[i].Balance) += (Transactions[i - 1].Balance);
}
}
示例2: GetAccountSelectors
private IEnumerable<AccountSelectViewModel> GetAccountSelectors(AccountTransactionDocumentType documentType, Account selectedAccount, IAccountService accountService, ICacheService cacheService)
{
var accountMap = documentType.AccountTransactionDocumentAccountMaps.FirstOrDefault(x => x.AccountId == selectedAccount.Id);
return accountMap != null
? documentType.GetNeededAccountTypes().Select(x => new AccountSelectViewModel(accountService, cacheService.GetAccountTypeById(x), accountMap.MappedAccountId, accountMap.MappedAccountName))
: documentType.GetNeededAccountTypes().Select(x => new AccountSelectViewModel(accountService, cacheService.GetAccountTypeById(x)));
}