-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddReport.aspx.cs
49 lines (42 loc) · 1.57 KB
/
addReport.aspx.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace EasyReportingTool
{
public partial class addReport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
//TODO: check for all field validation
if (Request["sql"] != null)
{
string guid = Guid.NewGuid().ToString();
using (DataClasses1DataContext dc = new DataClasses1DataContext())
{
Query q = new Query();
q.GUID = guid;
q.catalog = Request["catalog"];
q.createdby = User.Identity.Name;
q.createdon = DateTime.Now;
q.enabled = true;
q.server = Request["server"];
q.sql = Request["sql"];
q.username = Request["username"];
q.password = Request["password"];
q.url = "/report.aspx?guid=" + Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(guid));
dc.Queries.InsertOnSubmit(q);
dc.SubmitChanges();
}
Response.Write(Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(guid)));
}
}catch (Exception ex){
Response.Write("Trouble");
}
}
}
}