-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdelete_priority.aspx
More file actions
105 lines (78 loc) · 2.23 KB
/
delete_priority.aspx
File metadata and controls
105 lines (78 loc) · 2.23 KB
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
<%@ Page language="C#"%>
<!--
Copyright 2002-2008 Corey Trager
Distributed under the terms of the GNU General Public License
-->
<!-- #include file = "inc.aspx" -->
<script language="C#" runat="server">
String sql;
Security security;
void Page_Init (object sender, EventArgs e) {ViewStateUserKey = Session.SessionID;}
///////////////////////////////////////////////////////////////////////
void Page_Load(Object sender, EventArgs e)
{
Util.do_not_cache(Response);
security = new Security();
security.check_security( HttpContext.Current, Security.MUST_BE_ADMIN);
if (IsPostBack)
{
// do delete here
sql = @"delete priorities where pr_id = $1";
sql = sql.Replace("$1", row_id.Value);
btnet.DbUtil.execute_nonquery(sql);
Server.Transfer ("priorities.aspx");
}
else
{
titl.InnerText = Util.get_setting("AppTitle","BugTracker.NET") + " - "
+ "delete priority";
string id = Util.sanitize_integer(Request["id"]);
sql = @"declare @cnt int
select @cnt = count(1) from bugs where bg_priority = $1
select pr_name, @cnt [cnt] from priorities where pr_id = $1";
sql = sql.Replace("$1", id);
DataRow dr = btnet.DbUtil.get_datarow(sql);
if ((int) dr["cnt"] > 0)
{
Response.Write ("You can't delete priority \""
+ Convert.ToString(dr["pr_name"])
+ "\" because some bugs still reference it.");
Response.End();
}
else
{
confirm_href.InnerText = "confirm delete of \""
+ Convert.ToString(dr["pr_name"])
+ "\"";
row_id.Value = id;
}
}
}
</script>
<html>
<head>
<title id="titl" runat="server">btnet delete priority</title>
<link rel="StyleSheet" href="btnet.css" type="text/css">
</head>
<body>
<% security.write_menu(Response, "admin"); %>
<p>
<div class=align>
<p> </p>
<a href=priorities.aspx>back to priorities</a>
<p>or<p>
<script>
function submit_form()
{
var frm = document.getElementById("frm");
frm.submit();
return true;
}
</script>
<form runat="server" id="frm">
<a id="confirm_href" runat="server" href="javascript: submit_form()"></a>
<input type="hidden" id="row_id" runat="server">
</form>
</div>
<% Response.Write(Application["custom_footer"]); %></body>
</html>