当前位置: 首页>>代码示例>>C#>>正文


C# FinancialAccountService.ContainsKey方法代码示例

本文整理汇总了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 );
            }
        }
开发者ID:NewPointe,项目名称:Rockit,代码行数:72,代码来源:TransactionYearlySummaryLava.ascx.cs


注:本文中的FinancialAccountService.ContainsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。