-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathEditReceipts.ascx.vb
executable file
·261 lines (170 loc) · 8.16 KB
/
EditReceipts.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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
Imports System.Web.UI.WebControls
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Tabs
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Imports Ventrian.SubscriptionTools.Entities
Namespace Ventrian.SubscriptionTools
Partial Public Class EditReceipts
Inherits ModuleBase
#Region " Private Members "
Dim _currentPage As Integer = 1
Dim _pageRecords As Integer = Null.NullInteger
Dim _receipts As ArrayList
#End Region
#Region " Private Methods "
Private Sub ReadQueryString()
If Not (Request("CurrentPage") Is Nothing) Then
_currentPage = Convert.ToInt32(Request("CurrentPage"))
End If
If Not (Request("PageRecords") Is Nothing) Then
_pageRecords = Convert.ToInt32(Request("PageRecords"))
End If
If (_pageRecords <> Null.NullInteger) Then
If Not (drpRecordsPerPage.Items.FindByValue(_pageRecords.ToString()) Is Nothing) Then
drpRecordsPerPage.SelectedValue = _pageRecords.ToString()
End If
End If
If Not (Request("UserName") Is Nothing) Then
txtUserName.Text = Server.UrlDecode(Request("UserName").Trim())
End If
End Sub
Private Sub BindCrumbs()
Dim crumbs As New ArrayList
Dim objCrumbMain As New CrumbInfo
objCrumbMain.Caption = Localization.GetString("Main", LocalResourceFile)
objCrumbMain.Url = NavigateURL()
crumbs.Add(objCrumbMain)
Dim objEditReceipts As New CrumbInfo
objEditReceipts.Caption = Localization.GetString("EditReceipts", LocalResourceFile)
objEditReceipts.Url = EditUrl("EditReceipts")
crumbs.Add(objEditReceipts)
rptBreadCrumbs.DataSource = crumbs
rptBreadCrumbs.DataBind()
End Sub
Private Sub BindReceipts()
Dim PageSize As Integer = Convert.ToInt32(drpRecordsPerPage.SelectedItem.Value)
Dim objReceiptController As New ReceiptController
Localization.LocalizeDataGrid(grdReceipts, Me.LocalResourceFile)
_receipts = objReceiptController.List(Me.PortalId, Me.ModuleId, Null.NullInteger, txtUserName.Text.Trim())
Dim objPagedDataSource As New PagedDataSource
objPagedDataSource.AllowPaging = True
objPagedDataSource.DataSource = _receipts
If (_pageRecords = Null.NullInteger) Then
objPagedDataSource.PageSize = PageSize
Else
objPagedDataSource.PageSize = _pageRecords
End If
objPagedDataSource.CurrentPageIndex = _currentPage - 1
If (_receipts.Count > 0) Then
grdReceipts.DataSource = objPagedDataSource
grdReceipts.DataBind()
grdReceipts.Visible = True
lblNoReceipts.Visible = False
ctlPagingControl.Visible = True
ctlPagingControl.Visible = True
ctlPagingControl.TotalRecords = _receipts.Count
ctlPagingControl.PageSize = PageSize
ctlPagingControl.CurrentPage = _currentPage
ctlPagingControl.QuerystringParams = "ctl=EditReceipts&mid=" & Me.ModuleId.ToString()
If (Request("UserName") <> "") Then
ctlPagingControl.QuerystringParams = ctlPagingControl.QuerystringParams & "&UserName=" + Server.UrlEncode(Request("UserName"))
End If
If (drpRecordsPerPage.SelectedIndex <> 0) Then
ctlPagingControl.QuerystringParams = ctlPagingControl.QuerystringParams & "&PageRecords=" & drpRecordsPerPage.SelectedValue
End If
ctlPagingControl.TabID = TabId
Else
grdReceipts.Visible = False
lblNoReceipts.Visible = True
ctlPagingControl.Visible = False
End If
End Sub
#End Region
#Region " Protected Methods "
Protected Function GetDateEnd(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 objReceipt.DateEnd.ToShortDateString()
End If
End If
Return ""
End Function
Protected Function GetServiceFee(ByVal obj As Object) As String
Dim objReceipt As ReceiptInfo = CType(obj, ReceiptInfo)
If Not (objReceipt Is Nothing) Then
Dim currency As String = Me.Currency
If (objReceipt.Currency <> "") Then
currency = objReceipt.Currency
End If
Dim symbol As String = "$"
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 If
Return ""
End Function
#End Region
#Region " Event Handlers "
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
If (Page.IsPostBack = False) Then
ReadQueryString()
BindCrumbs()
BindReceipts()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub drpRecordsPerPage_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpRecordsPerPage.SelectedIndexChanged
Try
Response.Redirect(EditUrl("UserName", Server.UrlEncode(txtUserName.Text.Trim()), "EditReceipts", "PageRecords=" & drpRecordsPerPage.SelectedValue), True)
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub cmdAddReceipt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddReceipt.Click
Try
Response.Redirect(EditUrl("EditReceipt"), True)
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub cmdReturnToModule_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdReturnToModule.Click
Try
Response.Redirect(NavigateURL(), True)
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
Try
Response.Redirect(EditUrl("UserName", Server.UrlEncode(txtUserName.Text.Trim()), "EditReceipts"), True)
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
Try
Response.Redirect(EditUrl("EditReceipts"), True)
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
End Class
End Namespace