/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack && CurrentCheckInState != null) { if (!string.IsNullOrWhiteSpace(CurrentCheckInState.CheckIn.SearchValue)) { tbSearchBox.Text = CurrentCheckInState.CheckIn.SearchValue; } string script = string.Format(@" <script> $(document).ready(function (e) {{ if (localStorage) {{ localStorage.checkInKiosk = '{0}'; localStorage.checkInGroupTypes = '{1}'; }} }}); </script> ", CurrentKioskId, CurrentGroupTypeIds.AsDelimited(",")); phScript.Controls.Add(new LiteralControl(script)); if (GetAttributeValue("ShowKeyPad").AsBoolean()) { pnlKeyPad.Visible = true; } tbSearchBox.Focus(); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack && CurrentCheckInState != null) { string script = string.Format(@" <script> $(document).ready(function (e) {{ if (localStorage) {{ localStorage.theme = '{0}' localStorage.checkInKiosk = '{1}'; localStorage.checkInType = '{2}'; localStorage.checkInGroupTypes = '{3}'; }} }}); </script> ", CurrentTheme, CurrentKioskId, CurrentCheckinTypeId, CurrentGroupTypeIds.AsDelimited(",")); phScript.Controls.Add(new LiteralControl(script)); CurrentWorkflow = null; CurrentCheckInState.CheckIn = new CheckInStatus(); SaveState(); RefreshView(); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { if (CurrentCheckInState != null) { string script = string.Format(@" <script> $(document).ready(function (e) {{ if (localStorage) {{ localStorage.theme = '{0}' localStorage.checkInKiosk = '{1}'; localStorage.checkInType = '{2}'; localStorage.checkInGroupTypes = '{3}'; }} }}); </script> ", CurrentTheme, CurrentKioskId, CurrentCheckinTypeId, CurrentGroupTypeIds.AsDelimited(",")); phScript.Controls.Add(new LiteralControl(script)); CurrentWorkflow = null; CurrentCheckInState.CheckIn = new CheckInStatus(); SaveState(); RefreshView(); lNotActiveTitle.Text = GetAttributeValue("NotActiveTitle"); lNotActiveCaption.Text = GetAttributeValue("NotActiveCaption"); lNotActiveYetTitle.Text = GetAttributeValue("NotActiveYetTitle"); lNotActiveYetCaption.Text = string.Format(GetAttributeValue("NotActiveYetCaption"), "<span class='countdown-timer'></span>"); lClosedTitle.Text = GetAttributeValue("ClosedTitle"); lClosedCaption.Text = GetAttributeValue("ClosedCaption"); string btnText = GetAttributeValue("CheckinButtonText"); if (string.IsNullOrWhiteSpace(btnText)) { btnText = CurrentCheckInState.CheckInType.AllowCheckout ? "Start" : "Check In"; } lbSearch.Text = string.Format("<span>{0}</span>", btnText); } } else { if (Request.Form["__EVENTARGUMENT"] != null) { if (Request.Form["__EVENTARGUMENT"] == "Wedge_Entry") { var dv = DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_SCANNED_ID); DoFamilySearch(dv, hfSearchEntry.Value); } else if (Request.Form["__EVENTARGUMENT"] == "Family_Id_Search") { var dv = DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_FAMILY_ID); DoFamilySearch(dv, hfSearchEntry.Value); } } } }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { if (!Page.IsPostBack) { // Set the check-in state from values passed on query string CurrentKioskId = PageParameter("KioskId").AsIntegerOrNull(); CurrentGroupTypeIds = (PageParameter("GroupTypeIds") ?? "") .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .ToList() .Select(s => s.AsInteger()) .ToList(); if (CurrentKioskId.HasValue && CurrentGroupTypeIds != null && CurrentGroupTypeIds.Any() && !UserBackedUp) { // Save the check-in state SaveState(); // Navigate to the next page NavigateToNextPage(); } else { RockPage.AddScriptLink("~/Blocks/CheckIn/Scripts/geo-min.js"); AttemptKioskMatchByIpOrName(); string script = string.Format(@" <script> $(document).ready(function (e) {{ if (localStorage) {{ if (localStorage.checkInKiosk) {{ $('[id$=""hfKiosk""]').val(localStorage.checkInKiosk); if (localStorage.checkInGroupTypes) {{ $('[id$=""hfGroupTypes""]').val(localStorage.checkInGroupTypes); }} }} {0}; }} }}); </script> ", this.Page.ClientScript.GetPostBackEventReference(lbRefresh, "")); phScript.Controls.Add(new LiteralControl(script)); // Initiate the check-in variables lbOk.Focus(); SaveState(); } } else { phScript.Controls.Clear(); } }
/// <summary> /// Redirects to the new theme page. /// </summary> /// <param name="theme">The theme.</param> private void RedirectToNewTheme(string theme) { var pageRef = RockPage.PageReference; pageRef.QueryString = new System.Collections.Specialized.NameValueCollection(); pageRef.Parameters = new Dictionary <string, string>(); pageRef.Parameters.Add("theme", theme); pageRef.Parameters.Add("KioskId", CurrentKioskId.ToStringSafe()); pageRef.Parameters.Add("CheckinTypeId", CurrentCheckinTypeId.ToStringSafe()); pageRef.Parameters.Add("GroupTypeIds", CurrentGroupTypeIds.AsDelimited(",")); pageRef.Parameters.Add("ThemeRedirect", "True"); Response.Redirect(pageRef.BuildUrl(), false); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { if (!Page.IsPostBack) { if (CurrentKioskId == null || CurrentGroupTypeIds == null || CurrentCheckInState.Kiosk == null) { var queryParams = new Dictionary <string, string>(); queryParams.Add("back", "true"); NavigateToLinkedPage("AdminPage"); } else { if (!CurrentCheckInState.Kiosk.HasLocations(CurrentGroupTypeIds) || !CurrentCheckInState.Kiosk.HasActiveLocations(CurrentGroupTypeIds)) { DateTimeOffset activeAt = CurrentCheckInState.Kiosk.FilteredGroupTypes(CurrentGroupTypeIds).Select(g => g.NextActiveTime).Min(); // not active yet, display next active time return; } else if (CurrentCheckInState.CheckIn.SearchType != null || CurrentCheckInState.CheckIn.Families.Count > 0) { if (!string.IsNullOrWhiteSpace(CurrentCheckInState.CheckIn.SearchValue)) { tbSearchBox.Text = CurrentCheckInState.CheckIn.SearchValue; } lbAdmin.Visible = false; lbBack.Visible = true; } string script = string.Format(@" <script> $(document).ready(function (e) {{ if (localStorage) {{ localStorage.checkInKiosk = '{0}'; localStorage.checkInGroupTypes = '{1}'; }} }}); </script> ", CurrentKioskId, CurrentGroupTypeIds.AsDelimited(",")); phScript.Controls.Add(new LiteralControl(script)); if (bool.Parse(GetAttributeValue("ShowKeyPad")) == true) { pnlKeyPad.Visible = true; } tbSearchBox.Focus(); SaveState(); } } }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack && CurrentCheckInState != null) { if (CurrentCheckInType.SearchType.Guid.Equals(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_PHONE_NUMBER.AsGuid())) { pnlKeyPad.Visible = true; tbSearchBox.Placeholder = "Search By Phone"; } else if (CurrentCheckInType.SearchType.Guid.Equals(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_NAME.AsGuid())) { pnlKeyPad.Visible = false; tbSearchBox.Placeholder = "Search By Last Name, First Name"; } else { pnlKeyPad.Visible = false; tbSearchBox.Placeholder = "Enter Last Name, First Name or Phone"; } if (!string.IsNullOrWhiteSpace(CurrentCheckInState.CheckIn.SearchValue)) { tbSearchBox.Text = CurrentCheckInState.CheckIn.SearchValue; } string script = string.Format(@" <script> $(document).ready(function (e) {{ if (localStorage) {{ localStorage.theme = '{0}'; localStorage.checkInKiosk = '{1}'; localStorage.checkInType = '{2}'; localStorage.checkInGroupTypes = '{3}'; }} }}); </script> ", CurrentTheme, CurrentKioskId, CurrentCheckinTypeId, CurrentGroupTypeIds.AsDelimited(",")); phScript.Controls.Add(new LiteralControl(script)); // make sure the checkin type isn't set to name only if (GetAttributeValue("ShowKeyPad").AsBoolean() && !CurrentCheckInType.SearchType.Guid.Equals(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_NAME.AsGuid())) { pnlKeyPad.Visible = true; } tbSearchBox.Focus(); } }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { if (!Page.IsPostBack) { // Set the check-in state from values passed on query string var themeRedirect = PageParameter("ThemeRedirect").AsBoolean(false); var preferredKioskId = PageParameter("KioskId").AsIntegerOrNull(); if (preferredKioskId != null) { CurrentKioskId = preferredKioskId; } var checkinTypeId = PageParameter("CheckinTypeId").AsIntegerOrNull(); if (checkinTypeId != null) { CurrentCheckinTypeId = checkinTypeId; } var queryStringConfig = PageParameter("GroupTypeIds"); if (!string.IsNullOrEmpty(queryStringConfig)) { CurrentGroupTypeIds = queryStringConfig.ToStringSafe() .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .ToList() .Select(s => s.AsInteger()) .ToList(); } if (CurrentCheckInState != null && CurrentCheckInState.Kiosk != null && CurrentGroupTypeIds != null && CurrentGroupTypeIds.Any() && !UserBackedUp) { // Set the local cache if a session is already active CurrentKioskId = CurrentCheckInState.DeviceId; CurrentGroupTypeIds = CurrentCheckInState.ConfiguredGroupTypes; CurrentCheckInState = null; CurrentWorkflow = null; // If checkin type not set, try to calculate it from the group types. if (!CurrentCheckinTypeId.HasValue) { foreach (int groupTypeId in CurrentGroupTypeIds) { var checkinType = GetCheckinType(groupTypeId); if (checkinType != null) { CurrentCheckinTypeId = checkinType.Id; break; } } } // Save the check-in state SaveState(); // Navigate to the next page NavigateToNextPage(); } else { if (GetAttributeValue("AllowManualSetup").AsBoolean()) { ddlKiosk.Visible = true; } else if (!GetAttributeValue("EnableLocationSharing").AsBoolean()) { lbOk.Visible = true; AttemptKioskMatchByIpOrName(); } else { // Inject script used for geo location determination RockPage.AddScriptLink("~/Blocks/CheckIn/Scripts/geo-min.js"); lbRefresh.Visible = true; AddGeoLocationScript(); } AttemptKioskMatchByIpOrName(); var script = string.Format(@"<script> $(document).ready(function (e) {{ if (localStorage) {{ if (localStorage.checkInKiosk) {{ $('[id$=""hfKiosk""]').val(localStorage.checkInKiosk); if (localStorage.theme) {{ $('[id$=""hfTheme""]').val(localStorage.theme); }} if (localStorage.checkInType) {{ $('[id$=""hfCheckinType""]').val(localStorage.checkInType); }} if (localStorage.checkInGroupTypes) {{ $('[id$=""hfGroupTypes""]').val(localStorage.checkInGroupTypes); }} }} window.location = ""javascript:{0}""; }} }}); </script>", this.Page.ClientScript.GetPostBackEventReference(lbRefresh, "") ); using (var literalControl = new LiteralControl(script)) { phScript.Controls.Add(literalControl); } if (GetAttributeValue("AllowManualSetup").AsBoolean()) { ddlTheme.Items.Clear(); var di = new DirectoryInfo(this.Page.Request.MapPath(ResolveRockUrl("~~"))); foreach (var themeDir in di.Parent.EnumerateDirectories().OrderBy(a => a.Name)) { ddlTheme.Items.Add(new ListItem(themeDir.Name, themeDir.Name.ToLower())); } if (!string.IsNullOrWhiteSpace(CurrentTheme)) { ddlTheme.SetValue(CurrentTheme); } else { ddlTheme.SetValue(RockPage.Site.Theme.ToLower()); } ddlKiosk.Items.Clear(); var kioskDeviceType = Rock.SystemGuid.DefinedValue.DEVICE_TYPE_CHECKIN_KIOSK.AsGuid(); using (var rockContext = new RockContext()) { ddlKiosk.DataSource = new DeviceService(rockContext) .Queryable().AsNoTracking() .Where(d => d.DeviceType.Guid.Equals(kioskDeviceType)) .OrderBy(d => d.Name) .Select(d => new { d.Id, d.Name }) .ToList(); } ddlKiosk.DataBind(); ddlKiosk.Items.Insert(0, new ListItem(None.Text, None.IdValue)); if (CurrentKioskId.HasValue) { ddlKiosk.SetValue(CurrentKioskId); } } // Initiate the check-in variables lbOk.Focus(); SaveState(); } } else if (Request["__EVENTTARGET"] == lbTestPrint.ClientID) { SendTestPrint(); } else { phScript.Controls.Clear(); } }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { if (CurrentCheckInState != null) { string script = string.Format(@" <script> $(document).ready(function (e) {{ if (localStorage) {{ localStorage.theme = '{0}' localStorage.checkInKiosk = '{1}'; localStorage.checkInType = '{2}'; localStorage.checkInGroupTypes = '{3}'; }} }}); </script> ", CurrentTheme, CurrentKioskId, CurrentCheckinTypeId, CurrentGroupTypeIds.AsDelimited(",")); phScript.Controls.Add(new LiteralControl(script)); CurrentWorkflow = null; CurrentCheckInState.CheckIn = new CheckInStatus(); CurrentCheckInState.Messages = new List <CheckInMessage>(); SaveState(); string familyId = PageParameter("FamilyId"); if (familyId.IsNotNullOrWhiteSpace()) { var dv = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_FAMILY_ID); DoFamilySearch(dv, familyId); } else { RefreshView(); lNotActiveTitle.Text = GetAttributeValue("NotActiveTitle"); lNotActiveCaption.Text = GetAttributeValue("NotActiveCaption"); lNotActiveYetTitle.Text = GetAttributeValue("NotActiveYetTitle"); lNotActiveYetCaption.Text = string.Format(GetAttributeValue("NotActiveYetCaption"), "<span class='countdown-timer'></span>"); lClosedTitle.Text = GetAttributeValue("ClosedTitle"); lClosedCaption.Text = GetAttributeValue("ClosedCaption"); string checkinButtonText = GetAttributeValue("CheckinButtonText").IfEmpty("Start"); var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields(this.RockPage, null, new Rock.Lava.CommonMergeFieldsOptions { GetLegacyGlobalMergeFields = false }); mergeFields.Add("CheckinButtonText", checkinButtonText); mergeFields.Add("Kiosk", CurrentCheckInState.Kiosk); mergeFields.Add("RegistrationModeEnabled", CurrentCheckInState.Kiosk.RegistrationModeEnabled); if (CurrentGroupTypeIds != null) { var checkInAreas = CurrentGroupTypeIds.Select(a => GroupTypeCache.Get(a)); mergeFields.Add("CheckinAreas", checkInAreas); } lStartButtonHtml.Text = CurrentCheckInState.CheckInType.StartLavaTemplate.ResolveMergeFields(mergeFields); } } } else { if (Request.Form["__EVENTARGUMENT"] != null) { if (Request.Form["__EVENTARGUMENT"] == "Wedge_Entry") { var dv = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_SCANNED_ID); DoFamilySearch(dv, hfSearchEntry.Value); } else if (Request.Form["__EVENTARGUMENT"] == "Family_Id_Search") { var dv = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_FAMILY_ID); DoFamilySearch(dv, hfSearchEntry.Value); } else if (Request.Form["__EVENTARGUMENT"] == "StartClick") { HandleStartClick(); } } } }
protected override void OnLoad(EventArgs e) { RockPage.AddScriptLink("~/Blocks/CheckIn/Scripts/geo-min.js"); RockPage.AddScriptLink("~/Scripts/iscroll.js"); RockPage.AddScriptLink("~/Scripts/CheckinClient/checkin-core.js"); if (!Page.IsPostBack) { // Set the check-in state from values passed on query string CurrentKioskId = PageParameter("KioskId").AsIntegerOrNull(); CurrentGroupTypeIds = (PageParameter("GroupTypeIds") ?? "") .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .ToList() .Select(s => s.AsInteger()) .ToList(); // If valid parameters were used, set state and navigate to welcome page if (CurrentKioskId.HasValue && CurrentGroupTypeIds.Any()) { // Save the check-in state SaveState(); // Navigate to the check-in home (welcome) page NavigateToNextPage(); } else { bool enableLocationSharing = GetAttributeValue("EnableLocationSharing").AsBoolean(); // Inject script used for geo location determiniation if (enableLocationSharing) { lbRetry.Visible = true; AddGeoLocationScript(); } else { pnlManualConfig.Visible = true; lbOk.Visible = true; AttemptKioskMatchByIpOrName(); } string script = string.Format(@" <script> $(document).ready(function (e) {{ if (localStorage) {{ if (localStorage.checkInKiosk) {{ $('[id$=""hfKiosk""]').val(localStorage.checkInKiosk); if (localStorage.theme) {{ $('[id$=""hfTheme""]').val(localStorage.theme); }} if (localStorage.checkInGroupTypes) {{ $('[id$=""hfGroupTypes""]').val(localStorage.checkInGroupTypes); }} {0}; }} }} }}); </script> ", this.Page.ClientScript.GetPostBackEventReference(lbRefresh, "")); phScript.Controls.Add(new LiteralControl(script)); ddlTheme.Items.Clear(); DirectoryInfo di = new DirectoryInfo(this.Page.Request.MapPath(ResolveRockUrl("~~"))); foreach (var themeDir in di.Parent.EnumerateDirectories().OrderBy(a => a.Name)) { ddlTheme.Items.Add(new ListItem(themeDir.Name, themeDir.Name.ToLower())); } if (!string.IsNullOrWhiteSpace(CurrentTheme)) { ddlTheme.SetValue(CurrentTheme); } else { ddlTheme.SetValue(RockPage.Site.Theme.ToLower()); } Guid kioskDeviceType = Rock.SystemGuid.DefinedValue.DEVICE_TYPE_CHECKIN_KIOSK.AsGuid(); ddlKiosk.Items.Clear(); using (var rockContext = new RockContext()) { ddlKiosk.DataSource = new DeviceService(rockContext) .Queryable().AsNoTracking() .Where(d => d.DeviceType.Guid.Equals(kioskDeviceType)) .OrderBy(d => d.Name) .Select(d => new { d.Id, d.Name }) .ToList(); } ddlKiosk.DataBind(); ddlKiosk.Items.Insert(0, new ListItem(None.Text, None.IdValue)); if (CurrentKioskId.HasValue) { ListItem item = ddlKiosk.Items.FindByValue(CurrentKioskId.Value.ToString()); if (item != null) { item.Selected = true; BindGroupTypes(); } } } } else { phScript.Controls.Clear(); } }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (CurrentWorkflow == null || CurrentCheckInState == null) { NavigateToHomePage(); } else { if (!Page.IsPostBack) { try { lTitle.Text = GetAttributeValue("Title"); string detailMsg = GetAttributeValue("DetailMessage"); var printFromClient = new List <CheckInLabel>(); var printFromServer = new List <CheckInLabel>(); List <CheckinResult> checkinResultList = new List <CheckinResult>(); // Print the labels foreach (var family in CurrentCheckInState.CheckIn.Families.Where(f => f.Selected)) { lbAnother.Visible = CurrentCheckInState.CheckInType.TypeOfCheckin == TypeOfCheckin.Individual && family.People.Count > 1; foreach (var person in family.GetPeople(true)) { foreach (var groupType in person.GetGroupTypes(true)) { foreach (var group in groupType.GetGroups(true)) { foreach (var location in group.GetLocations(true)) { foreach (var schedule in location.GetSchedules(true)) { string detailMessage = string.Format(detailMsg, person.ToString(), group.ToString(), location.Location.Name, schedule.ToString(), person.SecurityCode); CheckinResult checkinResult = new CheckinResult(); checkinResult.Person = person; checkinResult.Group = group; checkinResult.Location = location.Location; checkinResult.Schedule = schedule; checkinResult.DetailMessage = detailMessage; checkinResultList.Add(checkinResult); } } } if (groupType.Labels != null && groupType.Labels.Any()) { printFromClient.AddRange(groupType.Labels.Where(l => l.PrintFrom == Rock.Model.PrintFrom.Client)); printFromServer.AddRange(groupType.Labels.Where(l => l.PrintFrom == Rock.Model.PrintFrom.Server)); } } } } var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields(this.RockPage, null, new Rock.Lava.CommonMergeFieldsOptions { GetLegacyGlobalMergeFields = false }); mergeFields.Add("CheckinResultList", checkinResultList); mergeFields.Add("Kiosk", CurrentCheckInState.Kiosk); mergeFields.Add("RegistrationModeEnabled", CurrentCheckInState.Kiosk.RegistrationModeEnabled); mergeFields.Add("Messages", CurrentCheckInState.Messages); if (CurrentGroupTypeIds != null) { var checkInAreas = CurrentGroupTypeIds.Select(a => Rock.Web.Cache.GroupTypeCache.Get(a)); mergeFields.Add("CheckinAreas", checkInAreas); } if (printFromClient.Any()) { var urlRoot = string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Authority); printFromClient .OrderBy(l => l.PersonId) .ThenBy(l => l.Order) .ToList() .ForEach(l => l.LabelFile = urlRoot + l.LabelFile); AddLabelScript(printFromClient.ToJson()); } if (printFromServer.Any()) { var messages = ZebraPrint.PrintLabels(printFromServer); mergeFields.Add("ZebraPrintMessageList", messages); } var successLavaTemplate = CurrentCheckInState.CheckInType.SuccessLavaTemplate; lCheckinResultsHtml.Text = successLavaTemplate.ResolveMergeFields(mergeFields); } catch (Exception ex) { LogException(ex); } } } }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack && CurrentCheckInState != null) { if (CurrentCheckInType.SearchType.Guid.Equals(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_PHONE_NUMBER.AsGuid())) { pnlKeyPad.Visible = true; tbSearchBox.Placeholder = "Search By Phone"; } else if (CurrentCheckInType.SearchType.Guid.Equals(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_NAME.AsGuid())) { pnlKeyPad.Visible = false; tbSearchBox.Placeholder = "Search By Last Name, First Name"; } else { pnlKeyPad.Visible = false; tbSearchBox.Placeholder = "Enter Last Name, First Name or Phone"; } if (!string.IsNullOrWhiteSpace(CurrentCheckInState.CheckIn.SearchValue)) { tbSearchBox.Text = CurrentCheckInState.CheckIn.SearchValue; } var script = string.Format(@" <script> $(document).ready(function (e) {{ if (localStorage) {{ localStorage.theme = '{0}'; localStorage.checkInKiosk = '{1}'; localStorage.checkInType = '{2}'; localStorage.checkInGroupTypes = '{3}'; }} }}); </script> ", CurrentTheme, CurrentKioskId, CurrentCheckinTypeId, CurrentGroupTypeIds.AsDelimited(",")); using (var literalControl = new LiteralControl(script)) { phScript.Controls.Add(literalControl); } // make sure the checkin type isn't set to name only if (GetAttributeValue("ShowKeyPad").AsBoolean() && !CurrentCheckInType.SearchType.Guid.Equals(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_NAME.AsGuid())) { pnlKeyPad.Visible = true; } tbSearchBox.Focus(); } else { if (Request.Form["__EVENTARGUMENT"] != null) { if (Request.Form["__EVENTARGUMENT"] == "Wedge_Entry") { var dv = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_SCANNED_ID); SearchFamilyById(dv, hfSearchEntry.Value); } else if (Request.Form["__EVENTARGUMENT"] == "Family_Id_Search") { var dv = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_FAMILY_ID); SearchFamilyById(dv, hfSearchEntry.Value); } } } }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { if (!Page.IsPostBack) { // Set the check-in state from values passed on query string bool themeRedirect = PageParameter("ThemeRedirect").AsBoolean(false); var preferredKioskId = PageParameter("KioskId").AsIntegerOrNull(); if (preferredKioskId != null) { CurrentKioskId = preferredKioskId; } var checkinTypeId = PageParameter("CheckinTypeId").AsIntegerOrNull(); if (checkinTypeId != null) { CurrentCheckinTypeId = checkinTypeId; } var queryStringConfig = PageParameter("GroupTypeIds"); if (!string.IsNullOrEmpty(queryStringConfig)) { CurrentGroupTypeIds = queryStringConfig.ToStringSafe() .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .ToList() .Select(s => s.AsInteger()) .ToList(); } if (CurrentCheckInState != null && CurrentCheckInState.Kiosk != null && CurrentGroupTypeIds != null && CurrentGroupTypeIds.Any() && !UserBackedUp) { // Set the local cache if a session is already active CurrentKioskId = CurrentCheckInState.DeviceId; CurrentGroupTypeIds = CurrentCheckInState.ConfiguredGroupTypes; CurrentCheckInState = null; CurrentWorkflow = null; if (!CurrentCheckinTypeId.HasValue) { foreach (int groupTypeId in CurrentGroupTypeIds) { var checkinType = GetCheckinType(groupTypeId); if (checkinType != null) { CurrentCheckinTypeId = checkinType.Id; break; } } } // Save the check-in state SaveState(); // Navigate to the next page NavigateToNextPage(); } else { bool useGeoLocationService = GetAttributeValue("EnableLocationSharing").AsBoolean(); // Inject script used for geo location determiniation if (!useGeoLocationService) { lbOk.Visible = true; AttemptKioskMatchByIpOrName(); } else { RockPage.AddScriptLink("~/Blocks/CheckIn/Scripts/geo-min.js"); lbRefresh.Visible = true; AddGeoLocationScript(); } AttemptKioskMatchByIpOrName(); string script = string.Format(@"<script> $(document).ready(function (e) {{ if (localStorage) {{ if (localStorage.checkInKiosk) {{ $('[id$=""hfKiosk""]').val(localStorage.checkInKiosk); if (localStorage.checkInType) {{ $('[id$=""hfCheckinType""]').val(localStorage.checkInType); }} if (localStorage.checkInGroupTypes) {{ $('[id$=""hfGroupTypes""]').val(localStorage.checkInGroupTypes); }} }} {0}; }} }}); </script>", this.Page.ClientScript.GetPostBackEventReference(lbRefresh, "") ); phScript.Controls.Add(new LiteralControl(script)); // Initiate the check-in variables lbOk.Focus(); SaveState(); } } else if (Request["__EVENTTARGET"] == lbTestPrint.ClientID) { SendTestPrint(); } else { phScript.Controls.Clear(); } }