本文整理汇总了C#中Rock.Model.ScheduleService.Select方法的典型用法代码示例。如果您正苦于以下问题:C# ScheduleService.Select方法的具体用法?C# ScheduleService.Select怎么用?C# ScheduleService.Select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.ScheduleService
的用法示例。
在下文中一共展示了ScheduleService.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowDetail
private void ShowDetail(Guid personGuid)
{
using ( var rockContext = new RockContext() )
{
var personService = new PersonService( new RockContext() );
var person = personService.Get( personGuid );
if ( person != null )
{
lName.Text = person.FullName;
string photoTag = Rock.Model.Person.GetPhotoImageTag( person, 120, 120 );
if ( person.PhotoId.HasValue )
{
lPhoto.Text = string.Format( "<a href='{0}'>{1}</a>", person.PhotoUrl, photoTag );
}
else
{
lPhoto.Text = photoTag;
}
lEmail.Visible = !string.IsNullOrWhiteSpace( person.Email );
lEmail.Text = person.GetEmailTag( ResolveRockUrl( "/" ), "btn btn-default", "<i class='fa fa-envelope'></i>" );
var childGuid = Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_CHILD.AsGuid();
var isFamilyChild = new Dictionary<int, bool>();
var allFamilyMembers = person.GetFamilyMembers( true ).ToList();
allFamilyMembers.Where( m => m.PersonId == person.Id ).ToList().ForEach(
m => isFamilyChild.Add( m.GroupId, m.GroupRole.Guid.Equals( childGuid ) ) );
string urlRoot = Request.Url.ToString().ReplaceCaseInsensitive( personGuid.ToString(), "" );
var familyMembers = allFamilyMembers.Where( m => m.PersonId != person.Id )
.OrderBy( m => m.GroupId )
.ThenBy( m => m.Person.BirthDate )
.Select( m => new
{
Url = urlRoot + m.Person.Guid.ToString(),
FullName = m.Person.FullName,
Gender = m.Person.Gender,
FamilyRole = m.GroupRole,
Note = isFamilyChild[m.GroupId] ?
( m.GroupRole.Guid.Equals( childGuid ) ? " (Sibling)" : "(Parent)" ) :
( m.GroupRole.Guid.Equals( childGuid ) ? " (Child)" : "" )
} )
.ToList();
rcwFamily.Visible = familyMembers.Any();
rptrFamily.DataSource = familyMembers;
rptrFamily.DataBind();
rptrPhones.DataSource = person.PhoneNumbers.Where( p => !p.IsUnlisted ).ToList();
rptrPhones.DataBind();
var schedules = new ScheduleService( rockContext ).Queryable()
.Where( s => s.CheckInStartOffsetMinutes.HasValue )
.ToList();
var scheduleIds = schedules.Select( s => s.Id ).ToList();
var activeScheduleIds = new List<int>();
foreach ( var schedule in schedules )
{
if ( schedule.IsScheduleOrCheckInActive )
{
activeScheduleIds.Add( schedule.Id );
}
}
int? personAliasId = person.PrimaryAliasId;
if ( !personAliasId.HasValue )
{
personAliasId = new PersonAliasService( rockContext ).GetPrimaryAliasId( person.Id );
}
var attendances = new AttendanceService( rockContext )
.Queryable( "Schedule,Group,Location" )
.Where( a =>
a.PersonAliasId.HasValue &&
a.PersonAliasId == personAliasId &&
a.ScheduleId.HasValue &&
a.GroupId.HasValue &&
a.LocationId.HasValue &&
a.DidAttend.HasValue &&
a.DidAttend.Value &&
scheduleIds.Contains( a.ScheduleId.Value ) )
.OrderByDescending( a => a.StartDateTime )
.Take( 20 )
.Select( a => new AttendanceInfo
{
Date = a.StartDateTime,
GroupId = a.Group.Id,
Group = a.Group.Name,
LocationId = a.LocationId.Value,
Location = a.Location.Name,
Schedule = a.Schedule.Name,
IsActive =
a.StartDateTime > DateTime.Today &&
//.........这里部分代码省略.........
示例2: GetEditValue
/// <summary>
/// Reads new values entered by the user for the field
/// </summary>
/// <param name="control">Parent control that controls were added to in the CreateEditControl() method</param>
/// <param name="configurationValues">The configuration values.</param>
/// <returns></returns>
public override string GetEditValue( Control control, Dictionary<string, ConfigurationValue> configurationValues )
{
var picker = control as SchedulePicker;
string result = null;
if ( picker != null )
{
var ids = picker.SelectedValuesAsInt();
var schedules = new ScheduleService( new RockContext() ).Queryable().Where( a => ids.Contains( a.Id ) );
if ( schedules.Any() )
{
result = schedules.Select( s => s.Guid.ToString() ).ToList().AsDelimited( "," );
}
}
return result;
}
示例3: ShowDetail
private void ShowDetail(Guid personGuid)
{
using ( var rockContext = new RockContext() )
{
var personService = new PersonService( rockContext );
var person = personService.Queryable( "PhoneNumbers.NumberTypeValue,RecordTypeValue", true, true )
.FirstOrDefault( a => a.Guid == personGuid );
if ( person != null )
{
lName.Text = person.FullName;
string photoTag = Rock.Model.Person.GetPersonPhotoImageTag( person, 120, 120 );
if ( person.PhotoId.HasValue )
{
lPhoto.Text = string.Format( "<div class='photoframe'><a href='{0}'>{1}</a></div>", person.PhotoUrl, photoTag );
}
else
{
lPhoto.Text = photoTag;
}
lGender.Text = person.Gender != Gender.Unknown ? person.Gender.ConvertToString() : "";
if ( person.BirthDate.HasValue )
{
string ageText = ( person.BirthYear.HasValue && person.BirthYear != DateTime.MinValue.Year ) ?
string.Format( "{0} yrs old ", person.BirthDate.Value.Age() ) : string.Empty;
lAge.Text = string.Format( "{0} <small>({1})</small><br/>", ageText, person.BirthDate.Value.ToShortDateString() );
}
else
{
lAge.Text = string.Empty;
}
lGrade.Text = person.GradeFormatted;
lEmail.Visible = !string.IsNullOrWhiteSpace( person.Email );
lEmail.Text = person.GetEmailTag( ResolveRockUrl( "/" ), "btn btn-default", "<i class='fa fa-envelope'></i>" );
// Get all family member from all families ( including self )
var allFamilyMembers = personService.GetFamilyMembers( person.Id, true ).ToList();
// Add flag for this person in each family indicating if they are a child in family.
var childGuid = Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_CHILD.AsGuid();
var isFamilyChild = new Dictionary<int, bool>();
foreach ( var thisPerson in allFamilyMembers.Where( m => m.PersonId == person.Id ) )
{
isFamilyChild.Add( thisPerson.GroupId, thisPerson.GroupRole.Guid.Equals( childGuid ) );
}
// Get the current url's root (without the person's guid)
string urlRoot = Request.Url.ToString().ReplaceCaseInsensitive( personGuid.ToString(), "" );
// Get the other family members and the info needed for rendering
var familyMembers = allFamilyMembers.Where( m => m.PersonId != person.Id )
.OrderBy( m => m.GroupId )
.ThenBy( m => m.Person.BirthDate )
.Select( m => new
{
Url = urlRoot + m.Person.Guid.ToString(),
FullName = m.Person.FullName,
Gender = m.Person.Gender,
FamilyRole = m.GroupRole,
Note = isFamilyChild[m.GroupId] ?
( m.GroupRole.Guid.Equals( childGuid ) ? " (Sibling)" : "(Parent)" ) :
( m.GroupRole.Guid.Equals( childGuid ) ? " (Child)" : "" )
} )
.ToList();
rcwFamily.Visible = familyMembers.Any();
rptrFamily.DataSource = familyMembers;
rptrFamily.DataBind();
rptrPhones.DataSource = person.PhoneNumbers.Where( p => !p.IsUnlisted ).ToList();
rptrPhones.DataBind();
var schedules = new ScheduleService( rockContext )
.Queryable().AsNoTracking()
.Where( s => s.CheckInStartOffsetMinutes.HasValue )
.ToList();
var scheduleIds = schedules.Select( s => s.Id ).ToList();
var activeScheduleIds = new List<int>();
foreach ( var schedule in schedules )
{
if ( schedule.IsScheduleOrCheckInActive )
{
activeScheduleIds.Add( schedule.Id );
}
}
int? personAliasId = person.PrimaryAliasId;
if ( !personAliasId.HasValue )
{
personAliasId = new PersonAliasService( rockContext ).GetPrimaryAliasId( person.Id );
}
//.........这里部分代码省略.........