本文整理汇总了C#中FinancialAccountService.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# FinancialAccountService.ContainsKey方法的具体用法?C# FinancialAccountService.ContainsKey怎么用?C# FinancialAccountService.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FinancialAccountService
的用法示例。
在下文中一共展示了FinancialAccountService.ContainsKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindGrid
/// <summary>
/// Binds the grid.
/// </summary>
private void BindGrid()
{
var contributionType = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.TRANSACTION_TYPE_CONTRIBUTION.AsGuid() );
if ( contributionType != null )
{
var rockContext = new RockContext();
var transactionDetailService = new FinancialTransactionDetailService( rockContext );
var qry = transactionDetailService.Queryable().AsNoTracking()
.Where( a =>
a.Transaction.TransactionTypeValueId == contributionType.Id &&
a.Transaction.TransactionDateTime.HasValue );
var targetPerson = this.ContextEntity<Person>();
if ( targetPerson != null )
{
qry = qry.Where( t => t.Transaction.AuthorizedPersonAlias.Person.GivingId == targetPerson.GivingId );
}
List<SummaryRecord> summaryList;
using ( new Rock.Data.QueryHintScope( rockContext, QueryHintType.RECOMPILE ) )
{
summaryList = qry
.GroupBy( a => new { a.Transaction.TransactionDateTime.Value.Year, a.AccountId } )
.Select( t => new SummaryRecord
{
Year = t.Key.Year,
AccountId = t.Key.AccountId,
TotalAmount = t.Sum( d => d.Amount )
} ).OrderByDescending( a => a.Year )
.ToList();
}
var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields( this.RockPage, this.CurrentPerson );
var financialAccounts = new FinancialAccountService( rockContext ).Queryable().Select( a => new { a.Id, a.Name } ).ToDictionary( k => k.Id, v => v.Name );
var yearsMergeObjects = new List<Dictionary<string, object>>();
foreach ( var item in summaryList.GroupBy( a => a.Year ) )
{
var year = item.Key;
var accountsList = new List<object>();
foreach ( var a in item )
{
var accountDictionary = new Dictionary<string, object>();
accountDictionary.Add( "Account", financialAccounts.ContainsKey( a.AccountId ) ? financialAccounts[a.AccountId] : string.Empty );
accountDictionary.Add( "TotalAmount", a.TotalAmount );
accountsList.Add( accountDictionary );
}
var yearDictionary = new Dictionary<string, object>();
yearDictionary.Add( "Year", year );
yearDictionary.Add( "SummaryRows", accountsList );
yearsMergeObjects.Add( yearDictionary );
}
mergeFields.Add( "Rows", yearsMergeObjects );
lLavaOutput.Text = string.Empty;
if ( GetAttributeValue( "EnableDebug" ).AsBoolean() && IsUserAuthorized( Authorization.EDIT ) )
{
lLavaOutput.Text = mergeFields.lavaDebugInfo( rockContext );
}
string template = GetAttributeValue( "LavaTemplate" );
lLavaOutput.Text += template.ResolveMergeFields( mergeFields ).ResolveClientIds( upnlContent.ClientID );
}
}