本文整理汇总了C#中Person.GetSpouse方法的典型用法代码示例。如果您正苦于以下问题:C# Person.GetSpouse方法的具体用法?C# Person.GetSpouse怎么用?C# Person.GetSpouse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person.GetSpouse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadByModel
/// <summary>
/// Loads the by model.
/// </summary>
/// <param name="person">The person.</param>
/// <returns></returns>
public static PersonIndex LoadByModel(Person person )
{
var personIndex = new PersonIndex();
personIndex.SourceIndexModel = "Rock.Model.Person";
personIndex.ModelConfiguration = "nofilters";
personIndex.Id = person.Id;
personIndex.FirstName = person.FirstName;
personIndex.NickName = person.NickName;
personIndex.LastName = person.LastName;
personIndex.ModelOrder = 10;
if ( person.SuffixValue != null )
{
personIndex.Suffix = person.SuffixValue.Value;
}
personIndex.CampusId = person.GetCampusIds().FirstOrDefault();
personIndex.ConnectionStatusValueId = person.ConnectionStatusValueId;
personIndex.RecordStatusValueId = person.RecordStatusValueId;
personIndex.PreviousLastNames = string.Join(",", person.GetPreviousNames().Select( n => n.LastName ));
personIndex.Age = person.Age;
personIndex.Gender = person.Gender.ToString();
personIndex.PhotoUrl = person.PhotoUrl;
personIndex.Email = person.Email;
personIndex.DocumentName = person.FullName;
if ( person.PhoneNumbers != null )
{
personIndex.PhoneNumbers = string.Join( "|", person.PhoneNumbers.Select( p => p.NumberTypeValue.Value + "^" + p.Number ) );
}
// get family role
var familyRole = person.GetFamilyRole();
if (familyRole != null )
{
personIndex.FamilyRole = familyRole.Name;
}
// get home address
var address = person.GetHomeLocation();
if (address != null )
{
personIndex.StreetAddress = address.Street1 + " " + address.Street2;
personIndex.City = address.City;
personIndex.State = address.State;
personIndex.PostalCode = address.PostalCode;
personIndex.Country = address.Country;
}
// get spouse
var spouse = person.GetSpouse();
if ( spouse != null )
{
personIndex.Spouse = person.GetSpouse().FullName;
}
AddIndexableAttributes( personIndex, person );
return personIndex;
}