private void ShowCheckinCompletion() { pnlQr.Visible = false; pnlPostCheckin.Visible = true; ltPostCheckin.Text = GetAttributeValue(AttributeKeys.PostCheckinInstructions); //This is all an elaborate effort to get the family's checkin data in an organized fashion without touching the db //The thought is I can add more webservers I can't add more database servers right now. var personIds = CurrentPerson.PrimaryFamily.Members.Select(m => m.Person) .OrderBy(p => p.AgeClassification) .ThenBy(p => p.BirthDate) .Select(p => p.Id) .ToList(); var attendances = AttendanceCache.All() .Where(a => personIds.Contains(a.PersonId) && a.AttendanceState != AttendanceState.CheckedOut) .ToList(); var scheduleIds = attendances.Select(a => a.ScheduleId).Distinct().ToList(); var tokenOccurrences = OccurrenceCache.All() //Just need the schedule data so we can order stuff. .Where(o => scheduleIds.Contains(o.ScheduleId)) .DistinctBy(o => o.ScheduleId) .OrderBy(o => o.ScheduleStartTime) .ToList(); var attendanceData = new StringBuilder(); foreach (var tokenOccurrence in tokenOccurrences) { if (attendances.Where(a => a.ScheduleId == tokenOccurrence.ScheduleId).Any()) { attendanceData.Append("<b>" + tokenOccurrence.ScheduleName + "</b><ul>"); foreach (var personId in personIds) { var attendance = attendances.FirstOrDefault(a => a.PersonId == personId && a.ScheduleId == tokenOccurrence.ScheduleId); if (attendance == null) { continue; } OccurrenceCache occurrence = OccurrenceCache.Get(attendance.OccurrenceAccessKey); if (occurrence == null) { continue; } attendanceData.Append(string.Format("<li>{0}: {1} in {2}</li>", attendance.PersonName, occurrence.GroupName, occurrence.LocationName)); } attendanceData.Append("</ul>"); } } ltAttendance.Text = attendanceData.ToString(); }
protected void btnOccurrences_Click(object sender, EventArgs e) { btnOccurrences.CssClass = activeCss; btnAttendances.CssClass = defaultCss; btnMobileRecords.CssClass = defaultCss; btnKioskTypes.CssClass = defaultCss; pnlOccurrences.Visible = true; pnlAttendances.Visible = false; pnlMobileRecords.Visible = false; pnlKioskTypes.Visible = false; pnlVerify.Visible = false; var occurrences = OccurrenceCache.All().Select(o => new CacheContainer(o, o.AccessKey)).ToList(); gOccurrences.DataSource = occurrences; gOccurrences.DataBind(); }