Exemplo n.º 1
0
        /// <summary>
        /// Saves plugin custom settings to cookie.
        /// </summary>
        /// <param name="customSettings">The custom settings.</param>
        public static void SaveCustomSettingsToCookie(Dictionary <string, string> customSettings)
        {
            CheckinManagerConfiguration checkinManagerConfiguration = GetCheckinManagerConfigurationFromCookie();

            checkinManagerConfiguration.CustomSettings = customSettings;
            SaveCheckinManagerConfigurationToCookie(checkinManagerConfiguration);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Saves the room list filter to the response cookie
        /// </summary>
        /// <param name="roomListScheduleIdsFilter">The room list schedule ids filter.</param>
        public static void SaveRoomListFilterToCookie(int[] roomListScheduleIdsFilter)
        {
            CheckinManagerConfiguration checkinManagerConfiguration = GetCheckinManagerConfigurationFromCookie();

            checkinManagerConfiguration.RoomListScheduleIdsFilter = roomListScheduleIdsFilter;
            SaveCheckinManagerConfigurationToCookie(checkinManagerConfiguration);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Saves the selected label printer to cookie.
        /// Use labelPrinterGuid of Guid.Empty for "local printer".
        /// Use null for nothing selected.
        /// </summary>
        /// <param name="labelPrinterGuid">The label printer unique identifier.</param>
        public static void SaveSelectedLabelPrinterToCookie(Guid?labelPrinterGuid)
        {
            CheckinManagerConfiguration checkinManagerConfiguration = GetCheckinManagerConfigurationFromCookie();

            checkinManagerConfiguration.LabelPrinterGuid = labelPrinterGuid;
            SaveCheckinManagerConfigurationToCookie(checkinManagerConfiguration);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Saves the selected checkin area unique identifier to the response cookie
        /// </summary>
        /// <returns></returns>
        public static void SaveSelectedCheckinAreaGuidToCookie(Guid?checkinAreaGuid)
        {
            CheckinManagerConfiguration checkinManagerConfiguration = GetCheckinManagerConfigurationFromCookie();

            checkinManagerConfiguration.CheckinAreaGuid = checkinAreaGuid;
            SaveCheckinManagerConfigurationToCookie(checkinManagerConfiguration);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Saves the roster configuration to the response cookie.
        /// </summary>
        /// <param name="rosterStatusFilter">The roster status filter.</param>
        public static void SaveRosterConfigurationToCookie(RosterStatusFilter rosterStatusFilter)
        {
            CheckinManagerConfiguration checkinManagerConfiguration = GetCheckinManagerConfigurationFromCookie();

            checkinManagerConfiguration.RosterStatusFilter = rosterStatusFilter;
            SaveCheckinManagerConfigurationToCookie(checkinManagerConfiguration);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Saves the checkin manager configuration to response cookie.
        /// </summary>
        /// <param name="checkinManagerConfiguration">The checkin manager configuration.</param>
        private static void SaveCheckinManagerConfigurationToCookie(CheckinManagerConfiguration checkinManagerConfiguration)
        {
            var checkinManagerConfigurationJson = checkinManagerConfiguration.ToJson(indentOutput: false);

            Rock.Web.UI.RockPage.AddOrUpdateCookie(CheckInManagerCookieKey.CheckinManagerConfiguration, checkinManagerConfigurationJson, RockDateTime.Now.AddYears(1));

            // Also save the Configuration in the Request.Items so that we can grab the configuration from there instead
            // of the Cookie if the configuration changes from what is in the request cookie.
            HttpContext.Current.AddOrReplaceItem(CheckInManagerCookieKey.CheckinManagerConfiguration, checkinManagerConfigurationJson);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Saves the campus location configuration to the response cookie
        /// </summary>
        /// <param name="campusId">The campus identifier.</param>
        /// <param name="locationId">The location identifier.</param>
        public static void SaveCampusLocationConfigurationToCookie(int campusId, int?locationId)
        {
            CheckinManagerConfiguration checkinManagerConfiguration = GetCheckinManagerConfigurationFromCookie();

            if (locationId.HasValue)
            {
                checkinManagerConfiguration.LocationIdFromSelectedCampusId.AddOrReplace(campusId, locationId.Value);
            }
            else
            {
                checkinManagerConfiguration.LocationIdFromSelectedCampusId.Remove(campusId);
            }

            SaveCheckinManagerConfigurationToCookie(checkinManagerConfiguration);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Gets the roster configuration from the request cookie.
        /// Always returns a non-null CheckinManagerConfiguration.
        /// </summary>
        /// <returns></returns>
        public static CheckinManagerConfiguration GetCheckinManagerConfigurationFromCookie()
        {
            CheckinManagerConfiguration checkinManagerConfiguration = null;

            // First check Request.Items in case we have changed the configuration during this request.
            var currentlySavedCheckinManagerConfigurationJson = HttpContext.Current.Items[CheckInManagerCookieKey.CheckinManagerConfiguration] as string;

            if (currentlySavedCheckinManagerConfigurationJson.IsNotNullOrWhiteSpace())
            {
                checkinManagerConfiguration = currentlySavedCheckinManagerConfigurationJson.FromJsonOrNull <CheckinManagerConfiguration>();
            }
            else
            {
                // If we haven't changed the configuration in this request yet, get it from the cookie.
                var checkinManagerRosterConfigurationRequestCookie = HttpContext.Current.Request.Cookies[CheckInManagerCookieKey.CheckinManagerConfiguration];
                if (checkinManagerRosterConfigurationRequestCookie != null)
                {
                    checkinManagerConfiguration = checkinManagerRosterConfigurationRequestCookie.Value.FromJsonOrNull <CheckinManagerConfiguration>();
                }
            }

            if (checkinManagerConfiguration == null)
            {
                checkinManagerConfiguration = new CheckinManagerConfiguration();
            }

            if (checkinManagerConfiguration.LocationIdFromSelectedCampusId == null)
            {
                checkinManagerConfiguration.LocationIdFromSelectedCampusId = new Dictionary <int, int>();
            }

            if (checkinManagerConfiguration.RoomListScheduleIdsFilter == null)
            {
                checkinManagerConfiguration.RoomListScheduleIdsFilter = new int[0];
            }

            if (checkinManagerConfiguration.CustomSettings == null)
            {
                checkinManagerConfiguration.CustomSettings = new Dictionary <string, string>();
            }

            return(checkinManagerConfiguration);
        }