本文整理汇总了C#中Rock.Model.FinancialTransactionService.Include方法的典型用法代码示例。如果您正苦于以下问题:C# FinancialTransactionService.Include方法的具体用法?C# FinancialTransactionService.Include怎么用?C# FinancialTransactionService.Include使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.FinancialTransactionService
的用法示例。
在下文中一共展示了FinancialTransactionService.Include方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindGrid
//.........这里部分代码省略.........
qry = qry.Where( t => t.SourceTypeValueId == sourceTypeId );
}
// Campus
if ( this.ContextEntity() == null )
{
var campus = CampusCache.Read( gfTransactions.GetUserPreference( "Campus" ).AsInteger() );
if ( campus != null )
{
qry = qry.Where( b => b.Batch != null && b.Batch.CampusId == campus.Id );
}
}
}
SortProperty sortProperty = gTransactions.SortProperty;
if ( sortProperty != null )
{
if ( sortProperty.Property == "TotalAmount" )
{
if ( sortProperty.Direction == SortDirection.Ascending )
{
qry = qry.OrderBy( t => t.TransactionDetails.Sum( d => (decimal?)d.Amount ) ?? 0.00M );
}
else
{
qry = qry.OrderByDescending( t => t.TransactionDetails.Sum( d => (decimal?)d.Amount ) ?? 0.0M );
}
}
else
{
qry = qry.Sort( sortProperty );
}
}
else
{
// Default sort by Id if the transations are seen via the batch,
// otherwise sort by descending date time.
if ( ContextTypesRequired.Any( e => e.Id == batchEntityTypeId ) )
{
qry = qry.OrderBy( t => t.Id );
}
else
{
qry = qry.OrderByDescending( t => t.TransactionDateTime ).ThenByDescending( t => t.Id );
}
}
var lTransactionImageField = gTransactions.ColumnsOfType<RockLiteralField>().FirstOrDefault( a => a.ID == "lTransactionImage" );
var summaryField = gTransactions.ColumnsOfType<RockBoundField>().FirstOrDefault( a => a.DataField == "Summary" );
var showImages = bddlOptions.SelectedValue.AsIntegerOrNull() == 1;
if ( lTransactionImageField != null)
{
lTransactionImageField.Visible = showImages;
}
if ( summaryField != null )
{
summaryField.Visible = !showImages;
}
if ( showImages )
{
qry = qry.Include( a => a.Images );
}
_isExporting = isExporting;
gTransactions.SetLinqDataSource( qry.AsNoTracking() );
gTransactions.DataBind();
_isExporting = false;
if ( _batch == null &&
_scheduledTxn == null &&
_registration == null &&
_person == null )
{
pnlSummary.Visible = true;
// No context - show account summary
var qryTransactionDetails = qry.SelectMany( a => a.TransactionDetails );
var qryFinancialAccount = new FinancialAccountService( rockContext ).Queryable();
var accountSummaryQry = qryTransactionDetails.GroupBy( a => a.AccountId ).Select( a => new
{
AccountId = a.Key,
TotalAmount = (decimal?)a.Sum( d => d.Amount )
} ).Join( qryFinancialAccount, k1 => k1.AccountId, k2 => k2.Id, ( td, fa ) => new { td.TotalAmount, fa.Name, fa.Order } )
.OrderBy( a => a.Order );
var summaryList = accountSummaryQry.ToList();
var grandTotalAmount = ( summaryList.Count > 0 ) ? summaryList.Sum( a => a.TotalAmount ?? 0 ) : 0;
lGrandTotal.Text = grandTotalAmount.FormatAsCurrency();
rptAccountSummary.DataSource = summaryList.Select( a => new { a.Name, TotalAmount = a.TotalAmount.FormatAsCurrency() } ).ToList();
rptAccountSummary.DataBind();
}
else
{
pnlSummary.Visible = false;
}
}