forked from ventrian/News-Articles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathucEmailTemplates.ascx.vb
executable file
·106 lines (63 loc) · 3.03 KB
/
ucEmailTemplates.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
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
'
' News Articles for DotNetNuke - http://www.dotnetnuke.com
' Copyright (c) 2002-2007
' by Ventrian ( [email protected] ) ( http://www.ventrian.com )
'
Imports DotNetNuke.Services.Exceptions
Imports Ventrian.NewsArticles.Base
Namespace Ventrian.NewsArticles
Partial Public Class ucEmailTemplates
Inherits NewsArticleModuleBase
#Region " Private Methods "
Private Sub BindTemplateTypes()
drpTemplate.DataSource = System.Enum.GetValues(GetType(EmailTemplateType))
drpTemplate.DataBind()
End Sub
Private Sub BindTemplate()
Dim objTemplateController As New EmailTemplateController
Dim objTemplate As EmailTemplateInfo = objTemplateController.Get(Me.ModuleId, CType(System.Enum.Parse(GetType(EmailTemplateType), drpTemplate.SelectedValue), EmailTemplateType))
If Not (objTemplate Is Nothing) Then
txtSubject.Text = objTemplate.Subject
txtTemplate.Text = objTemplate.Template
End If
End Sub
#End Region
#Region " Event Handlers "
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
If (IsPostBack = False) Then
BindTemplateTypes()
BindTemplate()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub drpTemplate_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpTemplate.SelectedIndexChanged
Try
BindTemplate()
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
Try
Dim objTemplateController As New EmailTemplateController
Dim objTemplate As EmailTemplateInfo = objTemplateController.Get(Me.ModuleId, CType(System.Enum.Parse(GetType(EmailTemplateType), drpTemplate.SelectedValue), EmailTemplateType))
objTemplate.Subject = txtSubject.Text
objTemplate.Template = txtTemplate.Text
objTemplateController.Update(objTemplate)
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
Try
Response.Redirect(EditArticleUrl("AdminOptions"), True)
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
End Class
End Namespace