-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSignupDetails.ascx.vb
executable file
·233 lines (160 loc) · 8.4 KB
/
SignupDetails.ascx.vb
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
Imports System.Web.UI.WebControls
Imports DotNetNuke
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Modules.Actions
Imports DotNetNuke.Entities.Tabs
Imports DotNetNuke.Security
Imports DotNetNuke.Security.Roles
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Imports Ventrian.SubscriptionTools.Entities
Namespace Ventrian.SubscriptionTools
Partial Public Class SignupDetails
Inherits ModuleBase
#Region " Protected Methods "
Protected Function FormatAmount(ByVal obj As Object) As String
Dim objReceipt As ReceiptInfo = CType(obj, ReceiptInfo)
Dim symbol As String = "$"
Dim currency As String = Me.Currency
If (objReceipt.Currency <> "") Then
currency = objReceipt.Currency
End If
Select Case currency.ToUpper()
Case "USD"
symbol = "$"
Case "GBP"
symbol = "£"
Case "EUR"
symbol = "€"
Case "CAD"
symbol = "$"
Case "JPY"
symbol = "¥"
End Select
Return symbol & objReceipt.ServiceFee.ToString("##0.00")
End Function
Protected Function FormatDetails(ByVal obj As Object) As String
Dim objReceipt As ReceiptInfo = CType(obj, ReceiptInfo)
Return objReceipt.Details
End Function
Protected Function FormatEndDate(ByVal obj As Object) As String
Dim objReceipt As ReceiptInfo = CType(obj, ReceiptInfo)
If Not (objReceipt Is Nothing) Then
If (objReceipt.DateEnd = Null.NullDate) Then
Return ""
Else
Return objReceipt.DateEnd.ToShortDateString()
End If
End If
Return ""
End Function
#End Region
#Region " Private Methods "
Private Sub BindReceipts()
Dim objReceiptController As New ReceiptController
Dim objReceipts As ArrayList = objReceiptController.List(Me.PortalId, Me.ModuleId, Me.UserId, Null.NullString)
For Each objReceiptItem As ReceiptInfo In objReceipts
If (objReceiptItem.AutoRenew) Then
End If
Next
grdReceipts.DataSource = objReceipts
grdReceipts.DataBind()
grdReceipts.Columns(6).Visible = Me.InvoiceSend
If (objReceipts.Count > 0) Then
Dim objReceipt As ReceiptInfo
Dim subscribedTo As String = ""
For Each objReceipt In objReceipts
If ((objReceipt.DateEnd > DateTime.Now Or objReceipt.DateEnd = Null.NullDate)) Then
If (subscribedTo = "") Then
subscribedTo = objReceipt.Name
Else
subscribedTo = subscribedTo & ", " & objReceipt.Name
End If
End If
Next
objReceipt = CType(objReceipts(0), ReceiptInfo)
If ((objReceipt.DateEnd > DateTime.Now Or objReceipt.DateEnd = Null.NullDate)) Then
If (objReceipt.Status.ToLower() = "pending") Then
lblCurrent.Text = Localization.GetString("SubscribedTo", Me.LocalResourceFile).Replace("[PLANS]", subscribedTo) & " " & Localization.GetString("Pending", Me.LocalResourceFile)
Else
If (objReceipt.DateEnd = Null.NullDate) Then
lblCurrent.Text = "You are currently subscribed to " & subscribedTo & ". Your access never expires."
Else
If Me.AllowMultipleSubscriptions Then
lblCurrent.Text = Localization.GetString("SubscribedTo", Me.LocalResourceFile).Replace("[PLANS]", subscribedTo) & " " & Localization.GetString("Extend", Me.LocalResourceFile).Replace("[LINK]", NavigateURL(Me.TabId, Null.NullString, "signupType=plan"))
Else
lblCurrent.Text = Localization.GetString("SubscribedTo", Me.LocalResourceFile).Replace("[PLANS]", subscribedTo) & " " & Localization.GetString("ExpiresIn", Me.LocalResourceFile).Replace("[DAYS]", (DateDiff(DateInterval.Day, DateTime.Now, objReceipt.DateEnd) + 1).ToString()) & " " & Localization.GetString("Extend", Me.LocalResourceFile).Replace("[LINK]", NavigateURL(Me.TabId, Null.NullString, "signupType=plan"))
End If
End If
End If
Else
lblCurrent.Text = Localization.GetString("Expired", Me.LocalResourceFile).Replace("[PLAN]", objReceipt.Name) & " " & Localization.GetString("Renew", Me.LocalResourceFile).Replace("[LINK]", NavigateURL(Me.TabId, Null.NullString, "signupType=plan"))
End If
Else
If (Request("Pending") = "True") Then
lblCurrent.Text = Localization.GetString("Refresh", Me.LocalResourceFile).Replace("[LINK]", Request.RawUrl)
Else
Response.Redirect(NavigateURL(Me.TabId), True)
End If
End If
End Sub
Private Sub BindReminder()
Dim objUserSettingController As New UserSettingController
Dim objUserSetting As UserSettingInfo = objUserSettingController.Get(Me.UserId, Constants.REMINDER_RECEIVE_NOTIFICATIONS)
If (objUserSetting Is Nothing) Then
chkReminder.Checked = True
Else
chkReminder.Checked = Convert.ToBoolean(objUserSetting.SettingValue)
End If
End Sub
#End Region
#Region " Protected Methods "
Protected Function GetInvoiceUrl(ByVal receiptID As String) As String
Return NavigateURL(Me.TabId, Null.NullString, "signupType=invoice", "ReceiptID=" & receiptID)
End Function
#End Region
#Region " Event Handlers "
Private Sub Page_Initialization(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
Try
If (Request("Clear") = "1") Then
' Clear Role Cookie
Response.Cookies.Remove("portalroles")
Response.Redirect(NavigateURL(Me.TabId, "", "signupType=Details", "Pending=True"), True)
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
If (Page.IsPostBack = False) Then
BindReceipts()
BindReminder()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub chkReminder_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkReminder.CheckedChanged
Try
Dim objUserSettingController As New UserSettingController
Dim objUserSetting As UserSettingInfo = objUserSettingController.Get(Me.UserId, Constants.REMINDER_RECEIVE_NOTIFICATIONS)
If (objUserSetting Is Nothing) Then
objUserSetting = New UserSettingInfo
objUserSetting.UserID = Me.UserId
objUserSetting.SettingName = Constants.REMINDER_RECEIVE_NOTIFICATIONS
objUserSetting.SettingValue = chkReminder.Checked.ToString()
objUserSettingController.Add(objUserSetting)
Else
objUserSetting.SettingValue = chkReminder.Checked.ToString()
objUserSettingController.Update(objUserSetting)
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
End Class
End Namespace