/// <summary> /// Gets the local device configuration status. /// </summary> /// <param name="localDeviceConfiguration">The local device configuration.</param> /// <param name="httpRequest">The HTTP request.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">LocalDeviceConfiguration with a valid KioskId and Checkin Type is required</exception> public static LocalDeviceConfigurationStatus GetLocalDeviceConfigurationStatus(LocalDeviceConfiguration localDeviceConfiguration, HttpRequest httpRequest) { if (localDeviceConfiguration?.CurrentKioskId == null || localDeviceConfiguration?.CurrentCheckinTypeId == null) { throw new ArgumentNullException("LocalDeviceConfiguration with a valid KioskId and Checkin Type is required"); } var kiosk = KioskDevice.Get(localDeviceConfiguration.CurrentKioskId.Value, localDeviceConfiguration.CurrentGroupTypeIds); DateTime nextActiveDateTime = kiosk.FilteredGroupTypes(localDeviceConfiguration.CurrentGroupTypeIds).Min(g => ( DateTime? )g.NextActiveTime) ?? DateTime.MaxValue; nextActiveDateTime = DateTime.SpecifyKind(nextActiveDateTime, DateTimeKind.Unspecified); bool isMobileAndExpired = CheckinConfigurationHelper.IsMobileAndExpiredDevice(httpRequest); CheckInState checkInState = new CheckInState(localDeviceConfiguration); CheckinConfigurationHelper.CheckinStatus checkinStatus = CheckinConfigurationHelper.GetCheckinStatus(checkInState); var rockVersion = Rock.VersionInfo.VersionInfo.GetRockProductVersionFullName(); CheckIn.CheckinType checkinType = new Rock.CheckIn.CheckinType(localDeviceConfiguration.CurrentCheckinTypeId.Value); var configurationData = new { CheckinType = checkinType, IsMobileAndExpired = isMobileAndExpired, Kiosk = kiosk, CheckinStatus = checkinStatus, NextActiveDateTime = nextActiveDateTime, RockVersion = rockVersion }; var configurationString = configurationData.ToJson(); DateTime campusCurrentDateTime = RockDateTime.Now; if (kiosk.CampusId.HasValue) { campusCurrentDateTime = CampusCache.Get(kiosk.CampusId.Value)?.CurrentDateTime ?? RockDateTime.Now; } LocalDeviceConfigurationStatus localDeviceConfigurationStatus = new LocalDeviceConfigurationStatus(); localDeviceConfigurationStatus.ConfigurationHash = Rock.Security.Encryption.GetSHA1Hash(configurationString); localDeviceConfigurationStatus.ServerCurrentDateTime = RockDateTime.Now; localDeviceConfigurationStatus.CampusCurrentDateTime = campusCurrentDateTime; localDeviceConfigurationStatus.NextActiveDateTime = nextActiveDateTime; return(localDeviceConfigurationStatus); }