-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAdminShipMethod.ascx.vb
More file actions
180 lines (142 loc) · 8.15 KB
/
AdminShipMethod.ascx.vb
File metadata and controls
180 lines (142 loc) · 8.15 KB
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
' --- Copyright (c) notice NevoWeb ---
' Copyright (c) 2008 SARL NevoWeb. www.nevoweb.com. BSD License.
' Author: D.C.Lee
' ------------------------------------------------------------------------
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
' ------------------------------------------------------------------------
' This copyright notice may NOT be removed, obscured or modified without written consent from the author.
' --- End copyright notice ---
Imports DotNetNuke
Imports DotNetNuke.Common
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Imports NEvoWeb.Modules.NB_Store.SharedFunctions
Namespace NEvoWeb.Modules.NB_Store
Partial Public Class AdminShipMethod
Inherits BaseAdminModule
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
If Not Page.IsPostBack Then
populateList()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub cmdUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
Try
UpdateList()
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub cmdNew_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdNew.Click
Try
Dim objCtrl As New ShipController
Dim objInfo As New NB_Store_ShippingMethodInfo
objInfo.PortalID = PortalId
objInfo.ShipMethodID = -1
objInfo.MethodDesc = ""
objInfo.MethodName = ""
objInfo.SortOrder = 1
objInfo.TemplateName = ""
objInfo.URLtracker = ""
objCtrl.UpdateObjShippingMethod(objInfo)
populateList()
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub populateList()
Dim objCtrl As New ShipController
DotNetNuke.Services.Localization.Localization.LocalizeDataGrid(dgList, LocalResourceFile)
' get content
Dim aryList As ArrayList
aryList = objCtrl.GetShippingMethodList(PortalId)
dgList.DataSource = aryList
dgList.DataBind()
End Sub
Private Sub UpdateList()
If Page.IsValid = True Then
Dim objRow As DataGridItem
Dim objCtrl As New ShipController
Dim objInfo As NB_Store_ShippingMethodInfo
For Each objRow In dgList.Items
objInfo = objCtrl.GetShippingMethod(CInt(objRow.Cells(1).Text))
If Not objInfo Is Nothing Then
objInfo.MethodName = CType(objRow.FindControl("txtMethodName"), TextBox).Text
objInfo.MethodDesc = CType(objRow.FindControl("txtMethodDesc"), TextBox).Text
objInfo.TemplateName = CType(objRow.FindControl("ddlTemplateName"), DropDownList).SelectedValue
objInfo.URLtracker = CType(objRow.FindControl("ddlTrackerTemplate"), DropDownList).SelectedValue
objInfo.Disabled = CType(objRow.FindControl("chkDisabled"), CheckBox).Checked
objInfo.SortOrder = CType(objRow.FindControl("txtSortOrder"), TextBox).Text
objInfo.PortalID = PortalId
objInfo.Dealer = CType(objRow.FindControl("chkDealer"), CheckBox).Checked
objInfo.NonDealer = CType(objRow.FindControl("chkNonDealer"), CheckBox).Checked
objCtrl.UpdateObjShippingMethod(objInfo)
End If
Next
populateList()
End If
End Sub
Private Sub dgList_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgList.DeleteCommand
Dim item As DataGridItem = e.Item
Dim ItemId As Integer = Int32.Parse(e.CommandArgument.ToString)
Dim objCtrl As New ShipController
Dim objMInfo As NB_Store_ShippingMethodInfo
objMInfo = objCtrl.GetShippingMethod(ItemId)
If Not objMInfo Is Nothing Then
If objMInfo.Disabled Then
'restore deleted
objCtrl.DeleteShippingMethod(objMInfo.ShipMethodID)
End If
End If
populateList()
End Sub
Private Sub dgList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgList.ItemCommand
If e.CommandName = "Copy" Then
Dim item As DataGridItem = e.Item
Dim ItemId As Integer = Int32.Parse(e.CommandArgument.ToString)
Dim objCtrl As New ShipController
objCtrl.CopyShippingMethod(ItemId)
populateList()
End If
End Sub
Private Sub dgList_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgList.ItemDataBound
Dim item As DataGridItem = e.Item
If item.ItemType = ListItemType.Item Or _
item.ItemType = ListItemType.AlternatingItem Or _
item.ItemType = ListItemType.SelectedItem Then
Dim imgColumnControl As Control = item.Controls(0).Controls(0)
If TypeOf imgColumnControl Is ImageButton Then
Dim remImage As ImageButton = CType(imgColumnControl, ImageButton)
If item.ItemIndex = 0 Or Not CBool(DataBinder.Eval(item.DataItem, "Disabled")) Then
remImage.Visible = False
If item.ItemIndex = 0 Then CType(item.FindControl("chkDisabled"), CheckBox).Visible = False
Else
remImage.Attributes.Add("onClick", "javascript:return confirm('" & Localization.GetString("cmdDeleteMsg", LocalResourceFile) & "');")
remImage.ToolTip = Localization.GetString("cmdDeleteTip", LocalResourceFile)
End If
End If
Dim dll As DropDownList = item.FindControl("ddlTemplateName")
If Not dll Is Nothing Then
populateTemplateList(PortalId, dll, ".shiptemplate", "NONE", Localization.GetString("None", LocalResourceFile), DataBinder.Eval(item.DataItem, "TemplateName"))
End If
Dim imgColumnControl2 As Control = item.Controls(8).Controls(0)
If TypeOf imgColumnControl2 Is ImageButton Then
Dim remImage2 As ImageButton = CType(imgColumnControl2, ImageButton)
remImage2.Attributes.Add("onClick", "javascript:return confirm('" & Localization.GetString("cmdCopyMsg", LocalResourceFile) & "');")
remImage2.ToolTip = Localization.GetString("cmdCopyTip", LocalResourceFile)
End If
Dim dllT As DropDownList = item.FindControl("ddlTrackerTemplate")
If Not dllT Is Nothing Then
populateTemplateList(PortalId, dllT, ".tracktemplate", "NONE", Localization.GetString("None", LocalResourceFile), DataBinder.Eval(item.DataItem, "URLTracker"))
End If
End If
End Sub
End Class
End Namespace