-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathViewDataExporter.ascx.cs
131 lines (114 loc) · 3.15 KB
/
ViewDataExporter.ascx.cs
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
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using forDNN.Modules.DataExporter.Business;
namespace forDNN.Modules.DataExporter
{
partial class ViewDataExporter : PortalModuleBase
{
#region "Event Handlers"
protected void Page_Load(object sender, System.EventArgs e)
{
try
{
InitForm();
}
catch (Exception exc)
{
//Module failed to load
Exceptions.ProcessModuleLoadException(this, exc);
}
}
private void InitForm()
{
if (!IsPostBack)
{
try
{
ddlTables.DataSource = Business.CommonController.GetListOfTables();
ddlTables.DataTextField = "Title";
ddlTables.DataValueField = "ObjectName";
ddlTables.DataBind();
}
catch (Exception Exc)
{
DotNetNuke.UI.Skins.Skin.AddModuleMessage(this,
"Tables Error: " + Exc.Message,
DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
}
try
{
ddlViews.DataSource = Business.CommonController.GetListOfViews();
ddlViews.DataTextField = "Title";
ddlViews.DataValueField = "ObjectName";
ddlViews.DataBind();
}
catch (Exception Exc)
{
DotNetNuke.UI.Skins.Skin.AddModuleMessage(this,
"Views Error: " + Exc.Message,
DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
}
ddlSource.Attributes.Add("onchange", "javascript:sourceChanged();");
}
lblIcon.Visible = true;
lblIcon.Style["display"] = "block";
lblIcon.Text = "<a href=\"http://forDNN.com\" target=\"_blank\"><img src=\"http://forDNN.com/forDNNTeam.gif\" border=\"0\"/></a>";
ddlTables.Style["display"] = "none";
ddlViews.Style["display"] = "none";
tbQuery.Style["display"] = "none";
switch (ddlSource.SelectedValue)
{
case "0":
ddlTables.Style["display"] = "block";
break;
case "1":
ddlViews.Style["display"] = "block";
break;
case "2":
tbQuery.Style["display"] = "block";
break;
}
}
#endregion
protected void btnExport_Click(object sender, EventArgs e)
{
try
{
switch (ddlSource.SelectedValue)
{
case "0":
Business.CommonController.ExportData(SourceOfData.Table,
ddlTables.SelectedValue,
(ExportType)Convert.ToInt32(rblExportType.SelectedValue));
break;
case "1":
Business.CommonController.ExportData(SourceOfData.View,
ddlViews.SelectedValue,
(ExportType)Convert.ToInt32(rblExportType.SelectedValue));
break;
case "2":
Business.CommonController.ExportData(SourceOfData.Query,
tbQuery.Text,
(ExportType)Convert.ToInt32(rblExportType.SelectedValue));
break;
}
}
catch (Exception Exc)
{
DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Exc.Message, DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
}
}
}
}