本文整理汇总了C#中Rock.Model.PersonAliasService.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# PersonAliasService.Contains方法的具体用法?C# PersonAliasService.Contains怎么用?C# PersonAliasService.Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.PersonAliasService
的用法示例。
在下文中一共展示了PersonAliasService.Contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindGrid
/// <summary>
/// Binds the grid.
/// </summary>
private void BindGrid( bool isExporting = false )
{
_currencyTypes = new Dictionary<int, string>();
_creditCardTypes = new Dictionary<int, string>();
// If configured for a registration and registration is null, return
int registrationEntityTypeId = EntityTypeCache.Read( typeof( Rock.Model.Registration ) ).Id;
if ( ContextTypesRequired.Any( e => e.Id == registrationEntityTypeId ) && _registration == null )
{
return;
}
// If configured for a person and person is null, return
int personEntityTypeId = EntityTypeCache.Read( "Rock.Model.Person" ).Id;
if ( ContextTypesRequired.Any( e => e.Id == personEntityTypeId ) && _person == null )
{
return;
}
// If configured for a batch and batch is null, return
int batchEntityTypeId = EntityTypeCache.Read( "Rock.Model.FinancialBatch" ).Id;
if ( ContextTypesRequired.Any( e => e.Id == batchEntityTypeId ) && _batch == null )
{
return;
}
// If configured for a batch and batch is null, return
int scheduledTxnEntityTypeId = EntityTypeCache.Read( "Rock.Model.FinancialScheduledTransaction" ).Id;
if ( ContextTypesRequired.Any( e => e.Id == scheduledTxnEntityTypeId ) && _scheduledTxn == null )
{
return;
}
// Qry
var rockContext = new RockContext();
var qry = new FinancialTransactionService( rockContext ).Queryable();
// Transaction Types
var transactionTypeValueIdList = GetAttributeValue( "TransactionTypes" ).SplitDelimitedValues().AsGuidList().Select( a => DefinedValueCache.Read( a ) ).Where( a => a != null ).Select( a => a.Id ).ToList();
if ( transactionTypeValueIdList.Any() )
{
qry = qry.Where( t => transactionTypeValueIdList.Contains( t.TransactionTypeValueId ) );
}
// Set up the selection filter
if ( _batch != null )
{
// If transactions are for a batch, the filter is hidden so only check the batch id
qry = qry.Where( t => t.BatchId.HasValue && t.BatchId.Value == _batch.Id );
// If the batch is closed, do not allow any editing of the transactions
if ( _batch.Status != BatchStatus.Closed && _canEdit )
{
gTransactions.IsDeleteEnabled = _canEdit;
}
else
{
gTransactions.IsDeleteEnabled = false;
}
}
else if ( _scheduledTxn != null )
{
// If transactions are for a batch, the filter is hidden so only check the batch id
qry = qry.Where( t => t.ScheduledTransactionId.HasValue && t.ScheduledTransactionId.Value == _scheduledTxn.Id );
gTransactions.IsDeleteEnabled = false;
}
else if ( _registration != null )
{
qry = qry
.Where( t => t.TransactionDetails
.Any( d =>
d.EntityTypeId.HasValue &&
d.EntityTypeId.Value == registrationEntityTypeId &&
d.EntityId.HasValue &&
d.EntityId.Value == _registration.Id ) );
gTransactions.IsDeleteEnabled = false;
}
else // Person
{
// otherwise set the selection based on filter settings
if ( _person != null )
{
// fetch all the possible PersonAliasIds that have this GivingID to help optimize the SQL
var personAliasIds = new PersonAliasService( rockContext ).Queryable().Where( a => a.Person.GivingId == _person.GivingId ).Select( a => a.Id ).ToList();
// get the transactions for the person or all the members in the person's giving group (Family)
qry = qry.Where( t => t.AuthorizedPersonAliasId.HasValue && personAliasIds.Contains(t.AuthorizedPersonAliasId.Value) );
}
// Date Range
var drp = new DateRangePicker();
drp.DelimitedValues = gfTransactions.GetUserPreference( "Date Range" );
if ( drp.LowerValue.HasValue )
{
//.........这里部分代码省略.........
示例2: DisplayResults
private void DisplayResults()
{
var numberOfYears = GetAttributeValue( "MaxYearsToDisplay" ).AsInteger();
RockContext rockContext = new RockContext();
FinancialTransactionDetailService financialTransactionDetailService = new FinancialTransactionDetailService( rockContext );
// fetch all the possible PersonAliasIds that have this GivingID to help optimize the SQL
var personAliasIds = new PersonAliasService( rockContext ).Queryable().Where( a => a.Person.GivingId == TargetPerson.GivingId ).Select( a => a.Id ).ToList();
// get the transactions for the person or all the members in the person's giving group (Family)
var qry = financialTransactionDetailService.Queryable().AsNoTracking()
.Where( t=> t.Transaction.AuthorizedPersonAliasId.HasValue && personAliasIds.Contains( t.Transaction.AuthorizedPersonAliasId.Value ) );
if ( string.IsNullOrWhiteSpace( GetAttributeValue( "Accounts" ) ) )
{
qry = qry.Where( t => t.Account.IsTaxDeductible );
} else
{
var accountGuids = GetAttributeValue( "Accounts" ).Split( ',' ).Select( Guid.Parse ).ToList();
qry = qry.Where( t => accountGuids.Contains( t.Account.Guid ) );
}
var yearQry = qry.GroupBy( t => t.Transaction.TransactionDateTime.Value.Year )
.Select( g => new { Year = g.Key } )
.OrderByDescending(y => y.Year);
var mergeFields = new Dictionary<string, object>();
mergeFields.Add( "DetailPage", LinkedPageRoute( "DetailPage" ) );
mergeFields.Add( "StatementYears", yearQry.Take( numberOfYears ) );
mergeFields.Add( "PersonGuid", TargetPerson.Guid );
var template = GetAttributeValue( "LavaTemplate" );
lResults.Text = template.ResolveMergeFields( mergeFields );
// show debug info
if ( GetAttributeValue( "EnableDebug" ).AsBoolean() && IsUserAuthorized( Authorization.EDIT ) )
{
lDebug.Visible = true;
lDebug.Text = mergeFields.lavaDebugInfo();
}
}
示例3: DisplayResults
private void DisplayResults()
{
RockContext rockContext = new RockContext();
var statementYear = RockDateTime.Now.Year;
if ( Request["StatementYear"] != null )
{
Int32.TryParse( Request["StatementYear"].ToString(), out statementYear );
}
FinancialTransactionDetailService financialTransactionDetailService = new FinancialTransactionDetailService( rockContext );
Person targetPerson = CurrentPerson;
// get excluded currency types setting
List<Guid> excludedCurrencyTypes = new List<Guid>();
if ( GetAttributeValue( "ExcludedCurrencyTypes" ).IsNotNullOrWhitespace() )
{
excludedCurrencyTypes = GetAttributeValue( "ExcludedCurrencyTypes" ).Split( ',' ).Select( Guid.Parse ).ToList();
}
if ( GetAttributeValue( "AllowPersonQuerystring" ).AsBoolean() )
{
if ( !string.IsNullOrWhiteSpace( Request["PersonGuid"] ) )
{
Guid? personGuid = Request["PersonGuid"].AsGuidOrNull();
if ( personGuid.HasValue )
{
var person = new PersonService( rockContext ).Get( personGuid.Value );
if ( person != null )
{
targetPerson = person;
}
}
}
}
// fetch all the possible PersonAliasIds that have this GivingID to help optimize the SQL
var personAliasIds = new PersonAliasService( rockContext ).Queryable().Where( a => a.Person.GivingId == targetPerson.GivingId ).Select( a => a.Id ).ToList();
// get the transactions for the person or all the members in the person's giving group (Family)
var qry = financialTransactionDetailService.Queryable().AsNoTracking()
.Where( t => t.Transaction.AuthorizedPersonAliasId.HasValue && personAliasIds.Contains( t.Transaction.AuthorizedPersonAliasId.Value ) );
qry = qry.Where( t => t.Transaction.TransactionDateTime.Value.Year == statementYear );
if ( string.IsNullOrWhiteSpace( GetAttributeValue( "Accounts" ) ) )
{
qry = qry.Where( t => t.Account.IsTaxDeductible );
}
else
{
var accountGuids = GetAttributeValue( "Accounts" ).Split( ',' ).Select( Guid.Parse ).ToList();
qry = qry.Where( t => accountGuids.Contains( t.Account.Guid ) );
}
if ( excludedCurrencyTypes.Count > 0 )
{
qry = qry.Where( t => !excludedCurrencyTypes.Contains( t.Transaction.FinancialPaymentDetail.CurrencyTypeValue.Guid ) );
}
qry = qry.OrderByDescending( t => t.Transaction.TransactionDateTime );
var mergeFields = new Dictionary<string, object>();
mergeFields.Add( "StatementStartDate", "1/1/" + statementYear.ToString() );
if ( statementYear == RockDateTime.Now.Year )
{
mergeFields.Add( "StatementEndDate", RockDateTime.Now );
}
else
{
mergeFields.Add( "StatementEndDate", "12/31/" + statementYear.ToString() );
}
var familyGroupTypeId = GroupTypeCache.Read( Rock.SystemGuid.GroupType.GROUPTYPE_FAMILY ).Id;
var groupMemberQry = new GroupMemberService( rockContext ).Queryable().Where( m => m.Group.GroupTypeId == familyGroupTypeId );
// get giving group members in order by family role (adult -> child) and then gender (male -> female)
var givingGroup = new PersonService( rockContext ).Queryable().AsNoTracking()
.Where( p => p.GivingId == targetPerson.GivingId )
.GroupJoin(
groupMemberQry,
p => p.Id,
m => m.PersonId,
( p, m ) => new { p, m } )
.SelectMany( x => x.m.DefaultIfEmpty(), ( y, z ) => new { Person = y.p, GroupMember = z } )
.Select( p => new { FirstName = p.Person.NickName, LastName = p.Person.LastName, FamilyRoleOrder = p.GroupMember.GroupRole.Order, Gender = p.Person.Gender, PersonId = p.Person.Id } )
.DistinctBy( p => p.PersonId )
.OrderBy( p => p.FamilyRoleOrder ).ThenBy( p => p.Gender )
.ToList();
// make a list of person ids in the giving group
List<int> givingGroupIdsOnly = new List<int>();
foreach (var x in givingGroup)
{
givingGroupIdsOnly.Add(x.PersonId);
}
//.........这里部分代码省略.........
示例4: GetByGivingId
public IQueryable<FinancialTransaction> GetByGivingId( string givingId )
{
if ( string.IsNullOrWhiteSpace( givingId ) || !( givingId.StartsWith( "P" ) || givingId.StartsWith( "G" ) ) )
{
var response = new HttpResponseMessage( HttpStatusCode.BadRequest );
response.Content = new StringContent( "The supplied givingId is not valid" );
throw new HttpResponseException( response );
}
// fetch all the possible PersonAliasIds that have this GivingID to help optimize the SQL
var personAliasIds = new PersonAliasService( (RockContext)this.Service.Context ).Queryable().Where( a => a.Person.GivingId == givingId ).Select( a => a.Id ).ToList();
// get the transactions for the person or all the members in the person's giving group (Family)
return Get().Where( t => t.AuthorizedPersonAliasId.HasValue && personAliasIds.Contains( t.AuthorizedPersonAliasId.Value ) );
}