本文整理汇总了C#中Rock.Model.PersonService.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# PersonService.ToString方法的具体用法?C# PersonService.ToString怎么用?C# PersonService.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.PersonService
的用法示例。
在下文中一共展示了PersonService.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: gfPledges_DisplayFilterValue
/// <summary>
/// Gfs the pledges_ display filter value.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
/// <exception cref="System.NotImplementedException"></exception>
protected void gfPledges_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
{
switch ( e.Key )
{
case "Date Range":
e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
break;
case "Person":
int? personId = e.Value.AsIntegerOrNull();
if ( personId != null )
{
var person = new PersonService( new RockContext() ).Get( personId.Value );
if ( person != null )
{
e.Value = person.ToString();
}
else
{
e.Value = string.Empty;
}
}
else
{
e.Value = string.Empty;
}
break;
case "Accounts":
var accountIdList = e.Value.Split( ',' ).AsIntegerList();
if ( accountIdList.Any() )
{
var service = new FinancialAccountService( new RockContext() );
var accounts = service.GetByIds( accountIdList );
if ( accounts != null && accounts.Any() )
{
e.Value = accounts.Select( a => a.Name ).ToList().AsDelimited( "," );
}
else
{
e.Value = string.Empty;
}
}
else
{
e.Value = string.Empty;
}
break;
default:
e.Value = string.Empty;
break;
}
}
示例2: rFilter_DisplayFilterValue
/// <summary>
/// Rs the filter_ display filter value.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
/// <exception cref="System.NotImplementedException"></exception>
protected void rFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
{
var rockContext = new RockContext();
switch ( e.Key )
{
case "Date Range":
e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
break;
case "Person":
int? personId = e.Value.AsIntegerOrNull();
e.Value = null;
if ( personId.HasValue )
{
var person = new PersonService( rockContext ).Get( personId.Value );
if ( person != null )
{
e.Value = person.ToString();
}
}
break;
case "Group":
int? groupId = e.Value.AsIntegerOrNull();
e.Value = null;
if ( groupId.HasValue )
{
var group = new GroupService( rockContext ).Get( groupId.Value );
if ( group != null )
{
e.Value = group.ToString();
}
}
break;
case "Schedule":
int? scheduleId = e.Value.AsIntegerOrNull();
e.Value = null;
if ( scheduleId.HasValue )
{
var schedule = new ScheduleService( rockContext ).Get( scheduleId.Value );
if ( schedule != null )
{
e.Value = schedule.Name;
}
}
break;
case "Attended":
if ( e.Value == "1" )
{
e.Value = "Did Attend";
}
else if ( e.Value == "0" )
{
e.Value = "Did Not Attend";
}
else
{
e.Value = null;
}
break;
default:
e.Value = null;
break;
}
}
示例3: rFilter_DisplayFilterValue
/// <summary>
/// Rs the filter_ display filter value.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
/// <exception cref="System.NotImplementedException"></exception>
protected void rFilter_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
{
var rockContext = new RockContext();
switch ( e.Key )
{
case "Date Range":
e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
break;
case "Person":
var person = new PersonService( rockContext ).Get( e.Value.AsIntegerOrNull() ?? 0 );
if ( person != null )
{
e.Value = person.ToString();
}
else
{
e.Value = null;
}
break;
case "Group":
var group = new GroupService( rockContext ).Get( e.Value.AsIntegerOrNull() ?? 0 );
if ( group != null )
{
e.Value = group.ToString();
}
else
{
e.Value = null;
}
break;
case "Schedule":
var schedule = new ScheduleService( rockContext ).Get( e.Value.AsIntegerOrNull() ?? 0 );
if ( schedule != null )
{
e.Value = schedule.Name;
}
else
{
e.Value = null;
}
break;
}
}