Ejemplo n.º 1
0
        /// <summary>
        /// Gets the attendance count for all of the schedules for a location. This will show on the schedule buttons.
        /// </summary>
        /// <param name="location"></param>
        protected void GetScheduleAttendance(CheckInLocation location)
        {
            if (location != null)
            {
                var rockContext       = new RockContext();
                var attendanceService = new AttendanceService(rockContext);
                var attendanceQuery   = attendanceService.GetByDateAndLocation(DateTime.Now, location.Location.Id);

                ScheduleAttendanceList.Clear();
                foreach (var schedule in location.Schedules)
                {
                    var attendance = new ScheduleAttendance();
                    attendance.ScheduleId      = schedule.Schedule.Id;
                    attendance.AttendanceCount = attendanceQuery.Where(l => l.ScheduleId == attendance.ScheduleId).Count();
                    ScheduleAttendanceList.Add(attendance);
                }
            }
        }
        /// <summary>
        /// Gets the attendance count for all of the schedules for a location. This will show on the schedule buttons.
        /// </summary>
        /// <param name="location"></param>
        protected void GetScheduleAttendance( CheckInLocation location )
        {
            if ( location != null )
            {
                var rockContext = new RockContext();
                var attendanceService = new AttendanceService( rockContext );
                var attendanceQuery = attendanceService.GetByDateAndLocation( DateTime.Now, location.Location.Id );

                ScheduleAttendanceList.Clear();
                foreach ( var schedule in location.Schedules )
                {
                    var attendance = new ScheduleAttendance();
                    attendance.ScheduleId = schedule.Schedule.Id;
                    attendance.AttendanceCount = attendanceQuery.Where( l => l.ScheduleId == attendance.ScheduleId ).Count();
                    ScheduleAttendanceList.Add( attendance );
                }
            }
        }