-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathQueries.aspx.vb
115 lines (105 loc) · 4.8 KB
/
Queries.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
Imports Immap.Service
Imports Ext.Net
Imports System.Data
Partial Class Queries
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) AndAlso Not (RequestManager.IsAjaxRequest) Then
Session("TITLE") = "Queries"
ReloadDynamicDataManager()
End If
End Sub
Protected Sub DynamicDataManagerStore_Refresh(sender As Object, e As Ext.Net.StoreRefreshDataEventArgs)
ReloadDynamicDataManager()
End Sub
Protected Sub cboDynamicModule_Select(sender As Object, e As Ext.Net.DirectEventArgs)
ClearFormNearbyFeatures()
If (cboDynamicModule.SelectedItem IsNot Nothing) Then
ReloadQueries(cboDynamicModule.SelectedItem.Text)
End If
End Sub
Protected Sub gpQuries_RowDelete(sender As Object, e As DirectEventArgs)
Dim database As String = Convert.ToString(Session("database"))
Dim DDDefName As String = cboDynamicModule.SelectedItem.Text
Dim GUID1 As String = e.ExtraParams("GUID1")
If GUID1 Is Nothing Then
e.Success = False
Exit Sub
End If
Try
If Not String.IsNullOrEmpty(GUID1) Then
QueriesServices.GetInstance().DeleteById(database, DDDefName, GUID1)
ReloadQueries(cboDynamicModule.SelectedItem.Text)
ClearFormNearbyFeatures()
End If
e.Success = True
Catch ex As Exception
e.Success = False
End Try
End Sub
Protected Sub btnInsert_Click(sender As Object, e As DirectEventArgs)
If cboDynamicModule.SelectedItem IsNot Nothing Then
Dim DDDefName As String = cboDynamicModule.SelectedItem.Text
SaveQueries(ImmapUtil.SaveType.INSERT, DDDefName)
End If
End Sub
Protected Sub btnUpdate_Click(sender As Object, e As DirectEventArgs)
If cboDynamicModule.SelectedItem IsNot Nothing Then
Dim DDDefName As String = cboDynamicModule.SelectedItem.Text
SaveQueries(ImmapUtil.SaveType.UPDATE, DDDefName)
End If
End Sub
Protected Sub SaveQueries(ByVal saveType As ImmapUtil.SaveType, ByVal DDDefName As String)
Dim GUID1 As String = ""
Dim msg As New MessageBox()
Dim database As String = Convert.ToString(Session("database"))
Select Case saveType
Case ImmapUtil.SaveType.INSERT
GUID1 = ImmapUtil.NewGUid()
QueriesServices.GetInstance().Insert(database,
DDDefName,
GUID1,
txtQueryName.Text,
txtaQuerySQL.Text,
txtaQueryMSSQL.Text)
Case ImmapUtil.SaveType.UPDATE
GUID1 = txtGUID1.Text
If String.IsNullOrWhiteSpace(GUID1) Then
msg.Show(New MessageBoxConfig() With {
.Title = "Warning",
.Message = "Please select Queries",
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.WARNING,
.AnimEl = Me.frmQueries.ClientID
})
Exit Sub
End If
QueriesServices.GetInstance().Update(database,
DDDefName,
GUID1,
txtQueryName.Text,
txtaQuerySQL.Text,
txtaQueryMSSQL.Text)
End Select
ClearFormNearbyFeatures()
ReloadQueries(DDDefName)
Dim sm As RowSelectionModel = TryCast(Me.gpQuries.SelectionModel.Primary, RowSelectionModel)
sm.ClearSelections()
gpQuries.Call("clearMemory")
End Sub
Protected Sub ReloadDynamicDataManager()
Dim database As String = Convert.ToString(Session("database"))
DynamicDataManagerService.GetInstance().GetDDDefNameAll(database, DynamicDataManagerStore)
End Sub
Protected Sub ReloadQueries(ByVal DDDefName As String)
If Not (String.IsNullOrEmpty(DDDefName)) Then
Dim database As String = Convert.ToString(Session("database"))
QueriesServices.GetInstance().FindAll(database, DDDefName, QuriesStore)
End If
End Sub
Protected Sub ClearFormNearbyFeatures()
frmQueries.Reset()
End Sub
End Class