-
Notifications
You must be signed in to change notification settings - Fork 11
/
CurrencySelector.ascx.vb
executable file
·63 lines (48 loc) · 2.61 KB
/
CurrencySelector.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
Imports DotNetNuke.Services.Localization
Namespace Ventrian.PropertyAgent
Partial Public Class CurrencySelector
Inherits PropertyAgentControl
Private ReadOnly Property ResourceFile() As String
Get
Return "~/DesktopModules/PropertyAgent/App_LocalResources/EditLayoutSettings"
End Get
End Property
Private Sub BindCurrency()
For Each value As Integer In System.Enum.GetValues(GetType(CurrencyType))
If (PropertySettings.CurrencyShowAll) Then
Dim li As New ListItem
li.Value = System.Enum.GetName(GetType(CurrencyType), value)
li.Text = Localization.GetString(System.Enum.GetName(GetType(CurrencyType), value), ResourceFile)
drpCurrency.Items.Add(li)
Else
For Each currency As String In PropertySettings.CurrencyAvailable.Split(","c)
Dim li As New ListItem
li.Value = System.Enum.GetName(GetType(CurrencyType), value)
li.Text = Localization.GetString(System.Enum.GetName(GetType(CurrencyType), value), ResourceFile)
If (currency = li.Value) Then
drpCurrency.Items.Add(li)
End If
Next
End If
Next
If (Request.Cookies("PA-" & ModuleID.ToString() & "-Currency") IsNot Nothing) Then
If (drpCurrency.Items.FindByValue(Request.Cookies("PA-" & ModuleID.ToString() & "-Currency").Value) IsNot Nothing) Then
drpCurrency.SelectedValue = Request.Cookies("PA-" & ModuleID.ToString() & "-Currency").Value
End If
Else
If (drpCurrency.Items.FindByValue(PropertySettings.Currency.ToString()) IsNot Nothing) Then
drpCurrency.SelectedValue = PropertySettings.Currency.ToString()
End If
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (IsPostBack = False) Then
BindCurrency()
End If
End Sub
Protected Sub drpCurrency_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles drpCurrency.SelectedIndexChanged
Response.Cookies("PA-" & ModuleID.ToString() & "-Currency").Value = drpCurrency.SelectedValue
Response.Redirect(Request.RawUrl, True)
End Sub
End Class
End Namespace