本文整理汇总了C#中Person.SaveAttributeValues方法的典型用法代码示例。如果您正苦于以下问题:C# Person.SaveAttributeValues方法的具体用法?C# Person.SaveAttributeValues怎么用?C# Person.SaveAttributeValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person.SaveAttributeValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveAssessmentResults
/// <summary>
/// Saves Assessment results to a Person's PersonProperties
/// </summary>
/// <param name="person"></param>
/// <param name="ABd">Adaptive Behavior D</param>
/// <param name="ABi">Adaptive Behavior I</param>
/// <param name="ABs">Adaptive Behavior S</param>
/// <param name="ABc">Adaptive Behavior C</param>
/// <param name="NBd">Natural Behavior D</param>
/// <param name="NBi">Natural Behavior I</param>
/// <param name="NBs">Natural Behavior S</param>
/// <param name="NBc">Natural Behavior C</param>
/// <param name="personalityType">One or two letters of DISC that represents the personality.</param>
static public void SaveAssessmentResults( Person person, string ABd, string ABi, string ABs, string ABc, string NBd, string NBi, string NBs, string NBc, string personalityType )
{
person.LoadAttributes();
var discAttributes = person.Attributes.Values.Where( a => a.Categories.Any( c => c.Guid == new Guid( "0B187C81-2106-4875-82B6-FBF1277AE23B" ) ) ).Select( a => a.Key );
foreach ( string attrib in discAttributes )
{
switch ( attrib )
{
case AttributeKeys.AdaptiveD:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], ABd );
break;
case AttributeKeys.AdaptiveI:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], ABi );
break;
case AttributeKeys.AdaptiveS:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], ABs );
break;
case AttributeKeys.AdaptiveC:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], ABc );
break;
case AttributeKeys.NaturalD:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], NBd );
break;
case AttributeKeys.NaturalI:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], NBi );
break;
case AttributeKeys.NaturalS:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], NBs );
break;
case AttributeKeys.NaturalC:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], NBc );
break;
case AttributeKeys.PersonalityType:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], personalityType );
break;
case AttributeKeys.LastSaveDate:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], RockDateTime.Now.ToString( "o" ) );
break;
}
}
person.SaveAttributeValues();
}
示例2: SaveTestResults
static public void SaveTestResults( Person person, string prophecy, string ministry, string teaching, string encouragement, string giving, string leadership, string mercy, string gifting )
{
person.LoadAttributes();
var discAttributes = person.Attributes.Values.Where( a => a.Categories.Any( c => c.Guid == new Guid( "12d8e61f-ed07-41d9-be0b-43c73907896d" ) ) ).Select( a => a.Key );
foreach ( string attrib in discAttributes )
{
switch ( attrib )
{
case AttributeKeys.Prophecy:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], prophecy );
break;
case AttributeKeys.Ministry:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], ministry );
break;
case AttributeKeys.Teaching:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], teaching );
break;
case AttributeKeys.Encouragement:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], encouragement );
break;
case AttributeKeys.Giving:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], giving );
break;
case AttributeKeys.Leadership:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], leadership );
break;
case AttributeKeys.Mercy:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], mercy );
break;
case AttributeKeys.Gifting:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], gifting );
break;
case AttributeKeys.LastSaveDate:
Rock.Attribute.Helper.SaveAttributeValue( person, person.Attributes[attrib], RockDateTime.Now.ToString( "o" ) );
break;
}
}
person.SaveAttributeValues();
}