-
Notifications
You must be signed in to change notification settings - Fork 7
/
Default.aspx.cs
81 lines (77 loc) · 2.2 KB
/
Default.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
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
using System;
using System.Web.UI;
using System.Data;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
using CustomControls;
namespace RFID
{
public partial class _Default : Page
{
public string ThisUID()
{
return common.SafeParam(Request.QueryString["UID"]);
}
public string ThisMAC()
{
return common.SafeParam(Request.QueryString["MAC"]);
}
public string ThisMSG()
{
return common.SafeParam(Request.QueryString["MSG"]);
}
public int MyProperty { get; set; }
private string _ResultMessage = "";
public string ResultMessage
{
get {
return _ResultMessage;
}
}
//{
// string p = ThisUID();
// return p;
//}
public void SaveData()
{
SqlParameter[] sqlParams = new SqlParameter[]
{
new SqlParameter("@CARDSN",ThisUID()),
new SqlParameter("@MAC",ThisMAC()),
new SqlParameter("@MSG",ThisMSG()),
new SqlParameter("@echo_output","true"),
new SqlParameter("@debug_status","0"),
};
string strSQL = "dbo.proc_add_RFID_UID_log";
try
{
string thisConnectionString = common.strConnectionString("Tracker");
_ResultMessage = SqlHelper.ExecuteScalar(thisConnectionString, CommandType.StoredProcedure, strSQL, sqlParams).ToString();
}
catch (Exception ex)
{
_ResultMessage = ex.Message;
}
}
protected void Page_Load(object sender, EventArgs e)
{
string FoundUID = ThisUID();
if ((FoundUID != null) && (FoundUID.Length == 8))
{
try
{
SaveData();
}
catch (Exception ex)
{
_ResultMessage = ex.Message;
}
}
else
{
_ResultMessage = "Error: 404";
}
}
}
}