本文整理汇总了C#中Rock.Model.FinancialTransactionService.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# FinancialTransactionService.ToList方法的具体用法?C# FinancialTransactionService.ToList怎么用?C# FinancialTransactionService.ToList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.FinancialTransactionService
的用法示例。
在下文中一共展示了FinancialTransactionService.ToList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindPaymentsGrid
/// <summary>
/// Binds the payments grid.
/// </summary>
private void BindPaymentsGrid()
{
if ( Registration != null )
{
using ( var rockContext = new RockContext() )
{
var currencyTypes = new Dictionary<int, string>();
var creditCardTypes = new Dictionary<int, string>();
int registrationEntityTypeId = EntityTypeCache.Read( typeof( Rock.Model.Registration ) ).Id;
// Get all the transactions related to this registration
var qry = new FinancialTransactionService( rockContext )
.Queryable().AsNoTracking()
.Where( t =>
t.TransactionDateTime.HasValue &&
t.TransactionDetails
.Any( d =>
d.EntityTypeId.HasValue &&
d.EntityTypeId.Value == registrationEntityTypeId &&
d.EntityId.HasValue &&
d.EntityId.Value == Registration.Id ) );
SortProperty sortProperty = gPayments.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
{
qry = qry.OrderByDescending( t => t.TransactionDateTime ).ThenByDescending( t => t.Id );
}
gPayments.DataSource = qry.ToList().Select( p => new {
p.Id,
TransactionDateTime = p.TransactionDateTime.Value.ToShortDateString() + "<br/>" +
p.TransactionDateTime.Value.ToShortTimeString(),
Details = FormatDetails( p ),
p.TotalAmount });
gPayments.DataBind();
}
}
}