本文整理汇总了C#中Rock.Model.FinancialTransactionService.Take方法的典型用法代码示例。如果您正苦于以下问题:C# FinancialTransactionService.Take方法的具体用法?C# FinancialTransactionService.Take怎么用?C# FinancialTransactionService.Take使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.FinancialTransactionService
的用法示例。
在下文中一共展示了FinancialTransactionService.Take方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindGrid
//.........这里部分代码省略.........
{
qry = qry.Where( t => t.TransactionDateTime >= drp.LowerValue.Value );
}
if ( drp.UpperValue.HasValue )
{
DateTime upperDate = drp.UpperValue.Value.Date.AddDays( 1 );
qry = qry.Where( t => t.TransactionDateTime < upperDate );
}
// Amount Range
var nre = new NumberRangeEditor();
nre.DelimitedValues = gfTransactions.GetUserPreference( "Amount Range" );
if ( nre.LowerValue.HasValue )
{
qry = qry.Where( t => t.TransactionDetails.Sum( d => d.Amount ) >= nre.LowerValue.Value );
}
if ( nre.UpperValue.HasValue )
{
qry = qry.Where( t => t.TransactionDetails.Sum( d => d.Amount ) <= nre.UpperValue.Value );
}
// Transaction Code
string transactionCode = gfTransactions.GetUserPreference( "Transaction Code" );
if ( !string.IsNullOrWhiteSpace( transactionCode ) )
{
qry = qry.Where( t => t.TransactionCode == transactionCode.Trim() );
}
// Account Id
int accountId = int.MinValue;
if ( int.TryParse( gfTransactions.GetUserPreference( "Account" ), out accountId ) )
{
qry = qry.Where( t => t.TransactionDetails.Any( d => d.AccountId == accountId ) );
}
// Transaction Type
int transactionTypeId = int.MinValue;
if ( int.TryParse( gfTransactions.GetUserPreference( "Transaction Type" ), out transactionTypeId ) )
{
qry = qry.Where( t => t.TransactionTypeValueId == transactionTypeId );
}
// Currency Type
int currencyTypeId = int.MinValue;
if ( int.TryParse( gfTransactions.GetUserPreference( "Currency Type" ), out currencyTypeId ) )
{
qry = qry.Where( t => t.CurrencyTypeValueId == currencyTypeId );
}
// Credit Card Type
int creditCardTypeId = int.MinValue;
if ( int.TryParse( gfTransactions.GetUserPreference( "Credit Card Type" ), out creditCardTypeId ) )
{
qry = qry.Where( t => t.CreditCardTypeValueId == creditCardTypeId );
}
// Source Type
int sourceTypeId = int.MinValue;
if ( int.TryParse( gfTransactions.GetUserPreference( "Source Type" ), out sourceTypeId ) )
{
qry = qry.Where( t => t.SourceTypeValueId == sourceTypeId );
}
}
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
{
qry = qry.OrderBy( t => t.Id );
}
// Row Limit
int? rowLimit = gfTransactions.GetUserPreference( "Row Limit" ).AsIntegerOrNull();
if ( rowLimit.HasValue )
{
qry = qry.Take( rowLimit.Value );
}
gTransactions.DataSource = qry.AsNoTracking().ToList();
gTransactions.DataBind();
}