This repository has been archived by the owner on Feb 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathReports.ascx.vb
182 lines (123 loc) · 5.64 KB
/
Reports.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
'***********************************************************************************
' Connect UsersLibrary
'
' Copyright (C) 2013-2014 DNN-Connect Association, Philipp Becker
' http://dnn-connect.org
'
' This program is free software; you can redistribute it and/or
' modify it under the terms of the GNU General Public License
' as published by the Free Software Foundation; either version 2
' of the License, or (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software
' Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'
'***********************************************************************************
Imports DotNetNuke.Entities.Modules
Imports Connect.Libraries.UserManagement
Imports DotNetNuke.Entities.Users
Imports DotNetNuke.Security.Membership
Imports Telerik.Web.UI
Imports DotNetNuke.Security.Roles
Imports DotNetNuke.Entities.Profile
Imports DotNetNuke.UI.Skins.Controls
Imports DotNetNuke.Framework.JavaScriptLibraries
Namespace Connect.Modules.UserManagement.AccountManagement
Partial Class Reports
Inherits ConnectUsersModuleBase
Private Sub Page_Init(sender As Object, e As System.EventArgs) Handles Me.Init
JavaScript.RequestRegistration(CommonJs.DnnPlugins)
End Sub
Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
BindReports()
End If
End Sub
Private Sub cmdNewReport_Click(sender As Object, e As EventArgs) Handles cmdNewReport.Click
BindEditForm(Null.NullInteger)
End Sub
Private Sub cmdAddReport_Click(sender As Object, e As EventArgs) Handles cmdAddReport.Click
AddReport()
pnlReportForm.Visible = False
BindReports()
End Sub
Private Sub cmdUpdateReport_Click(sender As Object, e As EventArgs) Handles cmdUpdateReport.Click
Dim ReportId As Integer = Convert.ToInt32(cmdUpdateReport.CommandArgument)
UpdateReport(ReportId)
pnlReportForm.Visible = False
BindReports()
End Sub
Private Sub cmdCancelReport_Click(sender As Object, e As EventArgs) Handles cmdCancelReport.Click
pnlReportForm.Visible = False
txtReportName.Text = ""
txtReportSql.Text = ""
End Sub
Private Sub cmdDeleteReport_Click(sender As Object, e As EventArgs) Handles cmdDeleteReport.Click
Dim ReportId As Integer = Convert.ToInt32(cmdDeleteReport.CommandArgument)
UserReportsController.DeleteReport(ReportId)
BindReports()
End Sub
Public Sub cmdEditReportFromList_Click(sender As Object, e As EventArgs)
Dim ReportId As Integer = Convert.ToInt32(CType(sender, LinkButton).CommandArgument)
BindEditForm(ReportId)
End Sub
Public Sub cmdDeleteReportFromList_Click(sender As Object, e As EventArgs)
Dim ReportId As Integer = Convert.ToInt32(CType(sender, LinkButton).CommandArgument)
UserReportsController.DeleteReport(ReportId)
BindReports()
End Sub
Private Sub cmdBack_Click(sender As Object, e As EventArgs) Handles cmdBack.Click
Response.Redirect(NavigateURL(TabId))
End Sub
#Region "Private Methods"
Private Sub AddReport()
Dim objReport As New UserReportInfo
objReport.FriendlyName = txtReportName.Text
objReport.PortalId = PortalId
objReport.Sql = txtReportSql.Text
objReport.NeedsParameters = False
UserReportsController.AddReport(objReport)
End Sub
Private Sub UpdateReport(ReportId As Integer)
Dim objReport As UserReportInfo = UserReportsController.GetReport(ReportId)
If Not objReport Is Nothing Then
objReport.Sql = txtReportSql.Text
objReport.FriendlyName = txtReportName.Text
UserReportsController.UpdateReport(objReport)
End If
End Sub
Private Sub BindReports()
Dim reports As New List(Of UserReportInfo)
reports = UserReportsController.GetReports(PortalId)
rptReports.DataSource = reports
rptReports.DataBind()
End Sub
Private Sub BindEditForm(ReportId As Integer)
pnlReportForm.Visible = True
txtReportName.Text = ""
txtReportSql.Text = ""
cmdUpdateReport.Visible = False
cmdDeleteReport.Visible = False
cmdAddReport.Visible = True
If ReportId <> Null.NullInteger Then
Dim objReport As UserReportInfo = UserReportsController.GetReport(ReportId)
If Not objReport Is Nothing Then
txtReportName.Text = objReport.FriendlyName
txtReportSql.Text = objReport.Sql
cmdAddReport.Visible = False
cmdUpdateReport.Visible = True
cmdUpdateReport.CommandArgument = objReport.ReportId.ToString
cmdDeleteReport.Visible = True
cmdDeleteReport.CommandArgument = objReport.ReportId.ToString
End If
End If
End Sub
#End Region
End Class
End Namespace