-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTtkGISProjectDef.aspx.vb
308 lines (285 loc) · 14.7 KB
/
TtkGISProjectDef.aspx.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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
Imports Ext.Net
Imports Immap.Service
Partial Class TtkGISProjectDef
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim database As String = Convert.ToString(Session("database"))
ImmapService.GetInstance().CheckDatabaseIsExitIfNotRedirectTologin()
If Not (Page.IsPostBack) Then
Session("TITLE") = "Map Library"
UserGroupService.GetInstance().LoadUserGroupStore(database, UserGroupStore)
If Not (Session("cboUserGroupValue") Is Nothing) Then
cboUserGroups.SetValue(Session("cboUserGroupsSelectedItem"))
cboUserGroups.DataBind()
ReloadTtkGISProjectDef()
End If
End If
End Sub
Protected Sub cboUserGroups_Select(sender As Object, e As Ext.Net.DirectEventArgs)
Session("cboUserGroupValue") = cboUserGroups.SelectedItem.Value
Session("cboUserGroupText") = cboUserGroups.SelectedItem.Text
ReloadTtkGISProjectDef()
End Sub
Protected Sub TtkGISProjectDefStore_Refresh(sender As Object, e As Ext.Net.StoreRefreshDataEventArgs)
ReloadTtkGISProjectDef()
End Sub
Public Sub ReloadTtkGISProjectDef()
Try
Dim database As String = Convert.ToString(Session("database"))
If String.IsNullOrWhiteSpace(cboUserGroups.SelectedItem.Text) = True Then
cboUserGroups.SetValue(Session("cboUserGroupsSelectedItem"))
cboUserGroups.DataBind()
End If
Dim userGroup As String = cboUserGroups.SelectedItem.Text
TtkGISProjectDefService.GetInstance().FindAll(database, userGroup, Me.TtkGISProjectDefStore)
Catch ex As Exception
End Try
End Sub
Protected Sub UserGroupStore_Refresh(sender As Object, e As StoreRefreshDataEventArgs)
If Session("database") Is Nothing Then
Exit Sub
End If
End Sub
Protected Sub RowDelete(sender As Object, e As DirectEventArgs)
Dim database As String = Convert.ToString(Session("database"))
Dim msg As New MessageBox()
Dim userGroup As String = cboUserGroups.SelectedItem.Text
Dim sGUID As String = e.ExtraParams("sGUID")
If sGUID Is Nothing Then
e.Success = False
e.ErrorMessage = "The list of ID is empty"
Exit Sub
End If
Try
TtkGISProjectDefService.GetInstance().DeleteById(database, userGroup, sGUID)
e.Success = True
Catch ex As Exception
e.Success = False
End Try
frmTtkGISProjectDef.Reset()
ReloadTtkGISProjectDef()
End Sub
Protected Sub btnInsert_Click(sender As Object, e As DirectEventArgs)
InsertOrUpdate("INSERT")
End Sub
Protected Sub btnUpdate_Click(sender As Object, e As DirectEventArgs)
InsertOrUpdate("UPDATE")
End Sub
Protected Sub InsertOrUpdate(ByVal command As String)
Dim database As String = Convert.ToString(Session("database"))
Dim msg As New MessageBox()
Dim userGroup As String = cboUserGroups.SelectedItem.Text
If String.IsNullOrWhiteSpace(txtsGUID.Text) Then
End If
If command.Equals("UPDATE") Then
If String.IsNullOrWhiteSpace(txtsGUID.Text) Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "Please select Map library before update",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
End If
End If
Dim centerX As String = ""
Dim centerY As String = ""
Dim EPSG As String = ""
Dim isNum As Boolean = False
Dim Num As Double
If String.IsNullOrEmpty(txtXMAX.Text.Trim()) = False Then
isNum = Double.TryParse(txtXMAX.Text, Num)
If isNum = False Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "Please enter number only on XMAX",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
End If
End If
If String.IsNullOrEmpty(txtXMIN.Text.Trim()) = False Then
isNum = Double.TryParse(txtXMIN.Text, Num)
If isNum = False Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "Please enter number only on XMIN",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
End If
End If
If String.IsNullOrEmpty(txtYMAX.Text.Trim()) = False Then
isNum = Double.TryParse(txtYMAX.Text, Num)
If isNum = False Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "Please enter number only on YMAX",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
End If
End If
If String.IsNullOrEmpty(txtYMIN.Text.Trim()) = False Then
isNum = Double.TryParse(txtYMIN.Text, Num)
If isNum = False Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "Please enter number only on YMIN",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
End If
End If
If String.IsNullOrEmpty(txtCenterX.Text.Trim()) = False Then
isNum = Double.TryParse(txtCenterX.Text, Num)
If isNum = False Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "Please enter number only on CenterX",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
Else
centerX = Num.ToString()
End If
End If
If String.IsNullOrEmpty(txtCenterY.Text.Trim()) = False Then
isNum = Double.TryParse(txtCenterY.Text, Num)
If isNum = False Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "Please enter number only on center Y",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
Else
centerY = Num.ToString()
End If
End If
If String.IsNullOrEmpty(txtEPSG.Text.Trim()) = False Then
isNum = Double.TryParse(txtEPSG.Text, Num)
If isNum = False Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "Please enter number only on EPSG",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
Else
EPSG = Num.ToString()
End If
End If
Dim CreatedDate As String = txtCreateDate.Text
If command.Equals("INSERT") Then
Dim isDuplicate As Boolean = TtkGISProjectDefService.GetInstance().CheckDuplicateName(database, userGroup, txtsName.Text.Trim())
If isDuplicate Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "This name is duplicated",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
End If
TtkGISProjectDefService.GetInstance().Insert(database, userGroup,
If(chkInUse.Checked = True, 1, 0),
txtsName.Text,
txtaMapData.Text,
ImmapUtil.NewGUid(),
If(String.IsNullOrWhiteSpace(txtXMIN.Text) = True, 0.0, CDbl(txtXMIN.Text)),
If(String.IsNullOrWhiteSpace(txtXMAX.Text) = True, 0.0, CDbl(txtXMAX.Text)),
If(String.IsNullOrWhiteSpace(txtYMIN.Text) = True, 0.0, CDbl(txtYMIN.Text)),
If(String.IsNullOrWhiteSpace(txtYMAX.Text) = True, 0.0, CDbl(txtYMAX.Text)),
txtSInfo.Text,
If(chkbSavedToDB.Checked = True, 1, 0),
txtsFilePath.Text,
centerX,
centerY,
EPSG,
txtScale.Text,
txtCreateBy.Text,
CreatedDate,
txtDescription.Text,
txtContact.Text,
txtRestrictions.Text,
txtCopyright.Text,
txturl.Text,
txtStandardLyrs.Text,
txtSource.Text,
txtAdminLyr1Name.Text,
txtAdminLyr2Name.Text,
txtAdminLyr3Name.Text,
txtAdminLyr4Name.Text,
txtAdminLyr5Name.Text)
frmTtkGISProjectDef.Reset()
ReloadTtkGISProjectDef()
Dim sm As RowSelectionModel = TryCast(Me.gpTtkGISProjectDef.SelectionModel.Primary, RowSelectionModel)
sm.ClearSelections()
gpTtkGISProjectDef.Call("clearMemory")
ElseIf command.Equals("UPDATE") Then
Dim isDuplicate As Boolean = TtkGISProjectDefService.GetInstance().CheckDuplicateByNameAndSguid(database, userGroup, txtsName.Text.Trim(), txtsGUID.Text)
If isDuplicate Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "This map library name is duplicated",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmTtkGISProjectDef.ClientID
})
Exit Sub
End If
TtkGISProjectDefService.GetInstance().Update(database, userGroup,
If(chkInUse.Checked = True, 1, 0),
txtsName.Text,
txtaMapData.Text,
txtsGUID.Text,
If(String.IsNullOrWhiteSpace(txtXMIN.Text) = True, 0.0, CDbl(txtXMIN.Text)),
If(String.IsNullOrWhiteSpace(txtXMAX.Text) = True, 0.0, CDbl(txtXMAX.Text)),
If(String.IsNullOrWhiteSpace(txtYMIN.Text) = True, 0.0, CDbl(txtYMIN.Text)),
If(String.IsNullOrWhiteSpace(txtYMAX.Text) = True, 0.0, CDbl(txtYMAX.Text)),
txtSInfo.Text,
If(chkbSavedToDB.Checked = True, 1, 0),
txtsFilePath.Text,
centerX,
centerY,
EPSG,
txtScale.Text,
txtCreateBy.Text,
CreatedDate,
txtDescription.Text,
txtContact.Text,
txtRestrictions.Text,
txtCopyright.Text,
txturl.Text,
txtStandardLyrs.Text,
txtSource.Text,
txtAdminLyr1Name.Text,
txtAdminLyr2Name.Text,
txtAdminLyr3Name.Text,
txtAdminLyr4Name.Text,
txtAdminLyr5Name.Text)
frmTtkGISProjectDef.Reset()
ReloadTtkGISProjectDef()
Dim sm As RowSelectionModel = TryCast(Me.gpTtkGISProjectDef.SelectionModel.Primary, RowSelectionModel)
sm.ClearSelections()
gpTtkGISProjectDef.Call("clearMemory")
End If
End Sub
End Class