-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoomCountKioskBlock.cs
140 lines (123 loc) · 4.65 KB
/
RoomCountKioskBlock.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
using System;
using System.Collections.Generic;
using System.Linq;
using Rock;
using Rock.Attribute;
using Rock.Data;
using Rock.Model;
using Rock.Web;
using Rock.Web.UI;
namespace com.bricksandmortarstudio.RoomCountKiosk
{
public abstract class RoomCountKioskBlock : RockBlock
{
/// <summary>
/// The current theme.
/// </summary>
protected string CurrentTheme { get; set; }
/// <summary>
/// The current kiosk id
/// </summary>
protected int? CurrentKioskId { get; set; }
protected int? CurrentLocationId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [manager logged in].
/// </summary>
/// <value>
/// <c>true</c> if [manager logged in]; otherwise, <c>false</c>.
/// </value>
protected bool ManagerLoggedIn { get; set; }
/// <summary>
/// Holds cookie names shared across certain check-in blocks.
/// </summary>
public struct RoomKioskCookie
{
/// <summary>
/// The name of the cookie that holds the DeviceId. Setters of this cookie should
/// be sure to set the expiration to a time when the device is no longer valid.
/// </summary>
public static readonly string DEVICEID = "com.bricksandmortarstudio.RoomCountKiosk.DeviceId";
/// <summary>
/// The name of the cookie that holds whether or not the device was a mobile device.
/// </summary>
public static readonly string ISMOBILE = "com.bricksandmortarstudio.RoomCountKiosk.IsMobile";
}
/// <summary>
/// Gets a value indicating whether the kiosk has active group types and locations that
/// are open for check-in.
/// </summary>
/// <value>
/// <c>true</c> if kiosk is active; otherwise, <c>false</c>.
/// </value>
//protected bool KioskCurrentlyActive
//{
// get
// {
// if ( CurrentCheckInState == null ||
// CurrentCheckInState.Kiosk == null ||
// CurrentCheckInState.Kiosk.FilteredGroupTypes( CurrentGroupTypeIds ).Count == 0 ||
// !CurrentCheckInState.Kiosk.HasActiveLocations( CurrentGroupTypeIds ) )
// {
// return false;
// }
// else
// {
// return true;
// }
// }
//}
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
/// </summary>
/// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
protected override void OnInit( EventArgs e )
{
base.OnInit( e );
GetState();
}
/// <summary>
/// Saves the current state of the kiosk and workflow
/// </summary>
protected void SaveState()
{
if ( !string.IsNullOrWhiteSpace( CurrentTheme ) )
{
Session["CheckInTheme"] = CurrentTheme;
}
if ( CurrentKioskId.HasValue )
{
Session["CurrentKioskId"] = CurrentKioskId.Value;
}
else
{
Session.Remove( "CurrentKioskId" );
}
if ( CurrentLocationId.HasValue )
{
Session["CurrentLocationId"] = CurrentLocationId.Value;
}
else
{
Session.Remove( "CurrentLocationId" );
}
}
/// <summary>
/// Gets the state.
/// </summary>
private void GetState()
{
if ( Session["CurrentTheme"] != null )
{
CurrentTheme = Session["CurrentTheme"].ToString();
}
if ( Session["CheckInKioskId"] != null )
{
CurrentKioskId = ( int ) Session["CheckInKioskId"];
}
if ( Session["CurrentLocationId"] != null )
{
CurrentLocationId = ( int ) Session["CurrentLocationId"];
}
}
}
}