-
Notifications
You must be signed in to change notification settings - Fork 0
/
Role.ascx.vb
65 lines (45 loc) · 2.39 KB
/
Role.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
Imports Albatros.DNN.Modules.Registration.Entities.Roles
Imports Albatros.DNN.Modules.Registration.Entities.RoleLocalizations
Public Class Role
Inherits ModuleBase
Public Property Role As RegistrationRoleInfo = Nothing
Private Sub Page_Init(sender As Object, e As System.EventArgs) Handles Me.Init
Me.LocalResourceFile = "/DesktopModules/Albatros/Registration/App_LocalResources/Role"
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
ddRedirectTab.DataSource = DotNetNuke.Entities.Tabs.TabController.GetPortalTabs(PortalId, -1, False, False)
ddRedirectTab.DataBind()
ddRedirectTab.Items.Insert(0, New ListItem(LocalizeString("NoRedirect"), "-1"))
Try
ddRedirectTab.Items.FindByValue(Role.RedirectTab.ToString).Selected = True
Catch ex As Exception
End Try
End If
rpLocalizations.DataSource = RoleLocalizationsController.GetRoleLocalizationsByRole(PortalId, Role.RoleID)
rpLocalizations.DataBind()
End Sub
Private Sub rpLocalizations_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rpLocalizations.ItemDataBound
If (e.Item.ItemType = ListItemType.Item) Or (e.Item.ItemType = ListItemType.AlternatingItem) Then
Dim rl As RoleLocalizationInfo = CType(e.Item.DataItem, RoleLocalizationInfo)
Dim lblLocale As Label = CType(e.Item.FindControl("lblLocale"), Label)
Dim txtName As TextBox = CType(e.Item.FindControl("txtName"), TextBox)
Dim txtPresentation As TextBox = CType(e.Item.FindControl("txtPresentation"), TextBox)
lblLocale.Text = rl.Locale
txtName.Text = rl.RoleName
txtPresentation.Text = rl.Presentation
End If
End Sub
Public Sub Update()
Data.DataProvider.Instance.RemoveRoleLocalizations(Role.RoleID)
For Each itm As RepeaterItem In rpLocalizations.Items
Dim locale As String = CType(itm.FindControl("lblLocale"), Label).Text
Dim name As String = CType(itm.FindControl("txtName"), TextBox).Text.Trim
Dim presentation As String = CType(itm.FindControl("txtPresentation"), TextBox).Text.Trim
If Not (String.IsNullOrEmpty(name) And String.IsNullOrEmpty(presentation)) Then
Data.DataProvider.Instance.SetRoleLocalization("", "", locale, presentation, Role.RoleID, name)
End If
Next
Data.DataProvider.Instance().UpdateRoleSetting(Role.RoleID, Integer.Parse(ddRedirectTab.SelectedValue))
End Sub
End Class