コード例 #1
0
        protected void ppAddPerson_SelectPerson(object sender, EventArgs e)
        {
            string template = GetAttributeValue("LavaTemplate");

            if (ppAddPerson.PersonId.HasValue)
            {
                if (!_attendees.Any(a => a.PersonId == ppAddPerson.PersonId.Value))
                {
                    var Person = new PersonService(new RockContext()).Get((int)ppAddPerson.PersonId.Value);
                    if (Person != null)
                    {
                        var attendee = new GroupAttendanceAttendee();
                        attendee.PersonId  = Person.Id;
                        attendee.NickName  = Person.NickName;
                        attendee.LastName  = Person.LastName;
                        attendee.Attended  = true;
                        attendee.CampusIds = Person.GetCampusIds();

                        var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields(null);
                        mergeFields.Add("Person", Person);
                        mergeFields.Add("Attended", true);
                        attendee.MergedTemplate = template.ResolveMergeFields(mergeFields);
                        _attendees.Add(attendee);
                        BindAttendees();
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Handles the SelectPerson event of the ppAddPerson control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void ppAddPerson_SelectPerson(object sender, EventArgs e)
        {
            string template = GetAttributeValue("LavaTemplate");

            if (ppAddPerson.PersonId.HasValue)
            {
                if (!_attendees.Any(a => a.PersonId == ppAddPerson.PersonId.Value))
                {
                    var rockContext = new RockContext();
                    var person      = new PersonService(rockContext).Get(ppAddPerson.PersonId.Value);
                    if (person != null)
                    {
                        string addPersonAs = GetAttributeValue("AddPersonAs");
                        if (!addPersonAs.IsNullOrWhiteSpace() && addPersonAs == "Group Member")
                        {
                            AddPersonAsGroupMember(person, rockContext);
                        }

                        var attendee = new GroupAttendanceAttendee();
                        attendee.PersonId  = person.Id;
                        attendee.NickName  = person.NickName;
                        attendee.LastName  = person.LastName;
                        attendee.Attended  = true;
                        attendee.CampusIds = person.GetCampusIds();

                        var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields(null);
                        mergeFields.Add("Person", person);
                        mergeFields.Add("Attended", true);
                        attendee.MergedTemplate = template.ResolveMergeFields(mergeFields);
                        _attendees.Add(attendee);
                        BindAttendees();
                    }
                }
            }
        }
コード例 #3
0
 protected void ppAddPerson_SelectPerson(object sender, EventArgs e)
 {
     if (ppAddPerson.PersonId.HasValue)
     {
         if (!_attendees.Any(a => a.PersonId == ppAddPerson.PersonId.Value))
         {
             var Person = new PersonService(new RockContext()).Get(ppAddPerson.PersonId.Value);
             if (Person != null)
             {
                 var attendee = new GroupAttendanceAttendee();
                 attendee.PersonId = Person.Id;
                 attendee.NickName = Person.NickName;
                 attendee.LastName = Person.LastName;
                 attendee.Attended = true;
                 _attendees.Add(attendee);
                 BindAttendees();
             }
         }
     }
 }
コード例 #4
0
        protected void ppAddPerson_SelectPerson( object sender, EventArgs e )
        {
            string template = GetAttributeValue( "LavaTemplate" );

            if ( ppAddPerson.PersonId.HasValue )
            {
                if ( !_attendees.Any( a => a.PersonId == ppAddPerson.PersonId.Value ) )
                {
                    var Person = new PersonService( new RockContext() ).Get( ppAddPerson.PersonId.Value );
                    if ( Person != null )
                    {
                        var attendee = new GroupAttendanceAttendee();
                        attendee.PersonId = Person.Id;
                        attendee.NickName = Person.NickName;
                        attendee.LastName = Person.LastName;
                        attendee.Attended = true;
                        attendee.CampusIds = Person.GetCampusIds();

                        var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields( null );
                        mergeFields.Add( "Person", Person );
                        mergeFields.Add( "Attended", true );
                        attendee.MergedTemplate = template.ResolveMergeFields( mergeFields );
                        _attendees.Add( attendee );
                        BindAttendees();
                    }
                }
            }
        }
コード例 #5
0
 protected void ppAddPerson_SelectPerson( object sender, EventArgs e )
 {
     if ( ppAddPerson.PersonId.HasValue )
     {
         if ( !_attendees.Any( a => a.PersonId == ppAddPerson.PersonId.Value ) )
         {
             var Person = new PersonService( new RockContext() ).Get( ppAddPerson.PersonId.Value );
             if ( Person != null )
             {
                 var attendee = new GroupAttendanceAttendee();
                 attendee.PersonId = Person.Id;
                 attendee.NickName = Person.NickName;
                 attendee.LastName = Person.LastName;
                 attendee.Attended = true;
                 _attendees.Add( attendee );
                 BindAttendees();
             }
         }
     }
 }