protected void btnMobileRecords_Click(object sender, EventArgs e)
 {
     btnOccurrences.CssClass   = defaultCss;
     btnAttendances.CssClass   = defaultCss;
     btnMobileRecords.CssClass = activeCss;
     btnKioskTypes.CssClass    = defaultCss;
     pnlOccurrences.Visible    = false;
     pnlAttendances.Visible    = false;
     pnlMobileRecords.Visible  = true;
     pnlKioskTypes.Visible     = false;
     pnlVerify.Visible         = false;
     gMobileRecords.DataSource = MobileCheckinRecordCache.All();
     gMobileRecords.DataBind();
 }
        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Execute(IJobExecutionContext context)
        {
            JobDataMap dataMap = context.JobDetail.JobDataMap;

            var records = MobileCheckinRecordCache.All()
                          .Where(r => !r.ExpirationDateTime.HasValue || r.ExpirationDateTime < Rock.RockDateTime.Now ||
                                 (r.CreatedDateTime.HasValue && r.CreatedDateTime < Rock.RockDateTime.Today))
                          .ToList();

            foreach (var record in records)
            {
                MobileCheckinRecordCache.CancelReservation(record, true);
            }

            context.Result = $"Removed {records.Count} expired records.";
        }
Example #3
0
        private void UpdateView()
        {
            pnlQr.Visible           = false;
            pnlLoading.Visible      = false;
            pnlPostCheckin.Visible  = false;
            pnlSelectCampus.Visible = false;

            if (currentUser == null)
            {
                ltError.Text     = GetAttributeValue(AttributeKeys.NotLoggedInMessage);
                pnlError.Visible = true;
                return;
            }

            string kioskName = currentUser.UserName;

            var mobileCheckinRecord = MobileCheckinRecordCache.GetActiveByFamilyGroupId(currentPerson.PrimaryFamilyId ?? 0);

            if (mobileCheckinRecord == null)
            {
                mobileCheckinRecord = MobileCheckinRecordCache.GetActiveByUserName(kioskName);
            }

            if (mobileCheckinRecord != null)
            {
                ShowQRCode(mobileCheckinRecord);
                return;
            }
            else
            {
                var completeMobileCheckins = MobileCheckinRecordCache.All()
                                             .Where(r => r.FamilyGroupId == currentPerson.PrimaryFamilyId && r.Status == MobileCheckinStatus.Complete)
                                             .SelectMany(r => r.AttendanceIds)
                                             .Select(i => AttendanceCache.Get(i))
                                             .Where(a => a.AttendanceState != AttendanceState.CheckedOut)
                                             .Any();
                if (completeMobileCheckins)
                {
                    ShowCheckinCompletion();
                    return;
                }
            }

            ConfigureForUser(kioskName);

            pnlSelectCampus.Visible = true;
        }
 protected void btnFlushMCR_Click(object sender, EventArgs e)
 {
     MobileCheckinRecordCache.Clear();
     MobileCheckinRecordCache.All();
 }