Helper class for storing the current attendance for a given kiosk group
        /// <summary>
        /// Adds the attendance record.
        /// </summary>
        /// <param name="kioskLocationAttendance">The kiosk location attendance.</param>
        /// <param name="attendance">The attendance.</param>
        private static void AddAttendanceRecord(KioskLocationAttendance kioskLocationAttendance, Attendance attendance)
        {
            if (attendance.GroupId.HasValue && attendance.ScheduleId.HasValue && attendance.PersonId.HasValue)
            {
                var groupAttendance = kioskLocationAttendance.Groups.Where(g => g.GroupId == attendance.GroupId).FirstOrDefault();
                if (groupAttendance == null)
                {
                    groupAttendance           = new KioskGroupAttendance();
                    groupAttendance.GroupId   = attendance.GroupId.Value;
                    groupAttendance.GroupName = attendance.Group.Name;
                    groupAttendance.Schedules = new List <KioskScheduleAttendance>();
                    kioskLocationAttendance.Groups.Add(groupAttendance);
                }

                var scheduleAttendance = groupAttendance.Schedules.Where(s => s.ScheduleId == attendance.ScheduleId).FirstOrDefault();
                if (scheduleAttendance == null)
                {
                    scheduleAttendance              = new KioskScheduleAttendance();
                    scheduleAttendance.ScheduleId   = attendance.ScheduleId.Value;
                    scheduleAttendance.ScheduleName = attendance.Schedule.Name;
                    scheduleAttendance.PersonIds    = new List <int>();
                    groupAttendance.Schedules.Add(scheduleAttendance);
                }

                scheduleAttendance.PersonIds.Add(attendance.PersonId.Value);
            }
        }
示例#2
0
        /// <summary>
        /// Adds the attendance record.
        /// </summary>
        /// <param name="kioskLocationAttendance">The kiosk location attendance.</param>
        /// <param name="attendance">The attendance.</param>
        private static void AddAttendanceRecord(KioskLocationAttendance kioskLocationAttendance, Attendance attendance)
        {
            if (attendance.Occurrence?.GroupId != null &&
                attendance.Occurrence?.ScheduleId != null &&
                attendance.PersonAlias != null)
            {
                var groupAttendance = kioskLocationAttendance.Groups.Where(g => g.GroupId == attendance.Occurrence.GroupId).FirstOrDefault();
                if (groupAttendance == null)
                {
                    groupAttendance           = new KioskGroupAttendance();
                    groupAttendance.GroupId   = attendance.Occurrence.GroupId.Value;
                    groupAttendance.GroupName = attendance.Occurrence.Group.Name;
                    groupAttendance.Schedules = new List <KioskScheduleAttendance>();
                    kioskLocationAttendance.Groups.Add(groupAttendance);
                }

                var scheduleAttendance = groupAttendance.Schedules.Where(s => s.ScheduleId == attendance.Occurrence.ScheduleId).FirstOrDefault();
                if (scheduleAttendance == null)
                {
                    scheduleAttendance              = new KioskScheduleAttendance();
                    scheduleAttendance.ScheduleId   = attendance.Occurrence.ScheduleId.Value;
                    scheduleAttendance.ScheduleName = attendance.Occurrence.Schedule.Name;
                    scheduleAttendance.IsActive     = attendance.IsCurrentlyCheckedIn;
                    scheduleAttendance.PersonIds    = new List <int>();
                    groupAttendance.Schedules.Add(scheduleAttendance);
                }

                if (!scheduleAttendance.PersonIds.Contains(attendance.PersonAlias.PersonId))
                {
                    scheduleAttendance.PersonIds.Add(attendance.PersonAlias.PersonId);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Adds the attendance record.
        /// </summary>
        /// <param name="kioskLocationAttendance">The kiosk location attendance.</param>
        /// <param name="attendance">The attendance.</param>
        private static void AddAttendanceRecord(KioskLocationAttendance kioskLocationAttendance, AttendanceInfo attendance)
        {
            if (attendance.GroupId == null && attendance.Schedule == null)
            {
                // Shouldn't happen, but just in case...
                return;
            }

            if (attendance.PersonId == null)
            {
                // Shouldn't happen, but just in case...
                return;
            }

            var groupAttendance = kioskLocationAttendance.Groups.Where(g => g.GroupId == attendance.GroupId).FirstOrDefault();

            if (groupAttendance == null)
            {
                groupAttendance           = new KioskGroupAttendance();
                groupAttendance.GroupId   = attendance.GroupId.Value;
                groupAttendance.GroupName = attendance.GroupName;
                groupAttendance.Schedules = new List <KioskScheduleAttendance>();
                kioskLocationAttendance.Groups.Add(groupAttendance);
            }

            var scheduleAttendance = groupAttendance.Schedules.Where(s => s.ScheduleId == attendance.Schedule.Id).FirstOrDefault();

            if (scheduleAttendance == null)
            {
                scheduleAttendance              = new KioskScheduleAttendance();
                scheduleAttendance.ScheduleId   = attendance.Schedule.Id;
                scheduleAttendance.ScheduleName = attendance.Schedule.Name;
                scheduleAttendance.IsActive     = Attendance.CalculateIsCurrentlyCheckedIn(attendance.StartDateTime, attendance.EndDateTime, attendance.CampusId, attendance.Schedule);
                scheduleAttendance.PersonIds    = new List <int>();
                groupAttendance.Schedules.Add(scheduleAttendance);
            }

            if (!scheduleAttendance.PersonIds.Contains(attendance.PersonId.Value))
            {
                scheduleAttendance.PersonIds.Add(attendance.PersonId.Value);
            }
        }
示例#4
0
        /// <summary>
        /// Adds the attendance record.
        /// </summary>
        /// <param name="kioskLocationAttendance">The kiosk location attendance.</param>
        /// <param name="attendance">The attendance.</param>
        private static void AddAttendanceRecord( KioskLocationAttendance kioskLocationAttendance, Attendance attendance )
        {
            if ( attendance.GroupId.HasValue && attendance.ScheduleId.HasValue && attendance.PersonId.HasValue )
            {
                var groupAttendance = kioskLocationAttendance.Groups.Where( g => g.GroupId == attendance.GroupId ).FirstOrDefault();
                if ( groupAttendance == null )
                {
                    groupAttendance = new KioskGroupAttendance();
                    groupAttendance.GroupId = attendance.GroupId.Value;
                    groupAttendance.GroupName = attendance.Group.Name;
                    groupAttendance.Schedules = new List<KioskScheduleAttendance>();
                    kioskLocationAttendance.Groups.Add( groupAttendance );
                }

                var scheduleAttendance = groupAttendance.Schedules.Where( s => s.ScheduleId == attendance.ScheduleId ).FirstOrDefault();
                if ( scheduleAttendance == null )
                {
                    scheduleAttendance = new KioskScheduleAttendance();
                    scheduleAttendance.ScheduleId = attendance.ScheduleId.Value;
                    scheduleAttendance.ScheduleName = attendance.Schedule.Name;
                    scheduleAttendance.PersonIds = new List<int>();
                    groupAttendance.Schedules.Add( scheduleAttendance );
                }

                scheduleAttendance.PersonIds.Add( attendance.PersonId.Value );
            }
        }