本文整理汇总了C#中Person.SetAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C# Person.SetAttributeValue方法的具体用法?C# Person.SetAttributeValue怎么用?C# Person.SetAttributeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person.SetAttributeValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEditValues
/// <summary>
/// Gets the edit values.
/// </summary>
/// <param name="person">The person.</param>
public void GetEditValues( Person person )
{
EnsureChildControls();
int i = 0;
foreach ( var attribute in AttributeList )
{
person.SetAttributeValue( attribute.Key, attribute.FieldType.Field.GetEditValue( attribute.GetControl( Controls[i] ), attribute.QualifierValues ) );
i++;
}
}
示例2: lbSubmit_Click
protected void lbSubmit_Click( object sender, EventArgs e )
{
if ( Page.IsValid )
{
RockContext rockContext = new RockContext();
var adultRole = new GroupTypeRoleService( rockContext ).Get( Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT.AsGuid() );
var childRole = new GroupTypeRoleService( rockContext ).Get( Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_CHILD.AsGuid() );
Person parent = new Person();
parent.FirstName = rtbParentFirstName.Text;
parent.LastName = rtbParentLastName.Text;
parent.LoadAttributes( rockContext );
PhoneNumber parentPhone = new PhoneNumber();
parentPhone.Number = pnbParentPhoneNumber.Number;
parent.PhoneNumbers.Add( parentPhone );
List<GroupMember> familyMembers = new List<GroupMember>();
GroupMember parentGM = new GroupMember();
parentGM.Person = parent;
parentGM.GroupRoleId = adultRole.Id;
familyMembers.Add( parentGM );
foreach ( KidData kidData in kidsList )
{
Person kid = new Person();
kid.FirstName = kidData.FirstName;
kid.LastName = kidData.LastName;
kid.Gender = kidData.Gender;
kid.SetBirthDate( kidData.Birthdate );
kid.GradeOffset = kidData.Grade.Value.AsIntegerOrNull();
kid.LoadAttributes( rockContext );
kid.SetAttributeValue( "AbilityLevel", kidData.AbilityLevel.Guid.ToString() );
kid.SetAttributeValue( "Allergy", kidData.Allergy );
kid.SetAttributeValue( "LegalNotes", kidData.LegalNotes );
GroupMember kidGM = new GroupMember();
kidGM.Person = kid;
kidGM.GroupRoleId = childRole.Id;
familyMembers.Add( kidGM );
}
Group family = GroupService.SaveNewFamily( rockContext, familyMembers, cpCampus.SelectedValueAsInt(), true );
if ( !String.IsNullOrWhiteSpace( GetAttributeValue( "PersonDetailsPage" ) ) )
{
NavigateToLinkedPage( "PersonDetailsPage", new Dictionary<string, string>() { { "PersonId", parent.Id.ToString() } } );
}
else
{
NavigateToCurrentPage( new Dictionary<string, string>() { { "PersonId", parent.Id.ToString() } } );
}
}
}