本文整理汇总了C#中Rock.Model.AttributeService.GetByCategoryId方法的典型用法代码示例。如果您正苦于以下问题:C# AttributeService.GetByCategoryId方法的具体用法?C# AttributeService.GetByCategoryId怎么用?C# AttributeService.GetByCategoryId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.AttributeService
的用法示例。
在下文中一共展示了AttributeService.GetByCategoryId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateControls
private void CreateControls( bool setSelection )
{
// Load all the attribute controls
attributeControls.Clear();
pnlAttributes.Controls.Clear();
phDuplicates.Controls.Clear();
var rockContext = new RockContext();
var attributeService = new AttributeService( rockContext );
var locationService = new LocationService( rockContext );
foreach ( string categoryGuid in GetAttributeValue( "AttributeCategories" ).SplitDelimitedValues( false ) )
{
Guid guid = Guid.Empty;
if ( Guid.TryParse( categoryGuid, out guid ) )
{
var category = CategoryCache.Read( guid );
if ( category != null )
{
var attributeControl = new NewGroupAttributes();
attributeControl.ClearRows();
pnlAttributes.Controls.Add( attributeControl );
attributeControls.Add( attributeControl );
attributeControl.ID = "groupAttributes_" + category.Id.ToString();
attributeControl.CategoryId = category.Id;
foreach ( var attribute in attributeService.GetByCategoryId( category.Id ) )
{
if ( attribute.IsAuthorized( Authorization.EDIT, CurrentPerson ) )
{
attributeControl.AttributeList.Add( AttributeCache.Read( attribute ) );
}
}
}
}
}
nfmMembers.ClearRows();
nfciContactInfo.ClearRows();
var groupMemberService = new GroupMemberService(rockContext);
int defaultRoleId = _groupType.DefaultGroupRoleId ?? _groupType.Roles.Select( r => r.Id ).FirstOrDefault();
var location = new Location();
acAddress.GetValues( location );
foreach ( var groupMember in GroupMembers )
{
string groupMemberGuidString = groupMember.Person.Guid.ToString().Replace( "-", "_" );
var groupMemberRow = new NewGroupMembersRow();
groupMemberRow.GroupTypeId = _groupType.Id;
nfmMembers.Controls.Add( groupMemberRow );
groupMemberRow.ID = string.Format( "row_{0}", groupMemberGuidString );
groupMemberRow.RoleUpdated += groupMemberRow_RoleUpdated;
groupMemberRow.DeleteClick += groupMemberRow_DeleteClick;
groupMemberRow.PersonGuid = groupMember.Person.Guid;
groupMemberRow.RequireGender = nfmMembers.RequireGender;
groupMemberRow.RequireGrade = nfmMembers.RequireGrade;
groupMemberRow.RoleId = groupMember.GroupRoleId;
groupMemberRow.ShowGradeColumn = _isFamilyGroupType;
groupMemberRow.ShowGradePicker = groupMember.GroupRoleId == _childRoleId;
groupMemberRow.ValidationGroup = BlockValidationGroup;
var contactInfoRow = new NewGroupContactInfoRow();
nfciContactInfo.Controls.Add( contactInfoRow );
contactInfoRow.ID = string.Format( "ci_row_{0}", groupMemberGuidString );
contactInfoRow.PersonGuid = groupMember.Person.Guid;
contactInfoRow.IsMessagingEnabled = _SMSEnabled;
contactInfoRow.PersonName = groupMember.Person.FullName;
if ( _homePhone != null )
{
var homePhoneNumber = groupMember.Person.PhoneNumbers.Where( p => p.NumberTypeValueId == _homePhone.Id ).FirstOrDefault();
if ( homePhoneNumber != null )
{
contactInfoRow.HomePhoneNumber = PhoneNumber.FormattedNumber( homePhoneNumber.CountryCode, homePhoneNumber.Number );
contactInfoRow.HomePhoneCountryCode = homePhoneNumber.CountryCode;
}
else
{
contactInfoRow.HomePhoneNumber = string.Empty;
contactInfoRow.HomePhoneCountryCode = string.Empty;
}
}
if ( _cellPhone != null )
{
var cellPhoneNumber = groupMember.Person.PhoneNumbers.Where( p => p.NumberTypeValueId == _cellPhone.Id ).FirstOrDefault();
if ( cellPhoneNumber != null )
{
contactInfoRow.CellPhoneNumber = PhoneNumber.FormattedNumber( cellPhoneNumber.CountryCode, cellPhoneNumber.Number );
contactInfoRow.CellPhoneCountryCode = cellPhoneNumber.CountryCode;
}
else
{
contactInfoRow.CellPhoneNumber = string.Empty;
contactInfoRow.CellPhoneCountryCode = string.Empty;
}
}
//.........这里部分代码省略.........