⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delete_comment.aspx

📁 Bug管理系统
💻 ASPX
字号:
<%@ Page language="C#"%>
<!--
Copyright 2002-2005 Corey Trager
Distributed under the terms of the GNU General Public License
-->
<!-- #include file = "inc.aspx" -->

<script language="C#" runat="server">


String sql;
DbUtil dbutil;
Security security;

///////////////////////////////////////////////////////////////////////
void Page_Load(Object sender, EventArgs e)
{

	Util.do_not_cache(Response);
	dbutil = new DbUtil();
	security = new Security();

	if (Util.get_setting("AllowCommentDeletionForNonAdmins","1") == "1")
	{
		security.check_security(dbutil, Request, Response, Security.ANY_USER_OK_EXCEPT_GUEST);
	}
	else
	{
		security.check_security(dbutil, Request, Response, Security.MUST_BE_ADMIN);
	}

	title.InnerText = Util.get_setting("AppTitle","BugTracker.NET") + " - " 
		+ "delete comment";


	string id = Util.sanitize_integer(Request["id"]);
	string bug_id = Util.sanitize_integer(Request["bug_id"]);
	string confirm = Request.QueryString["confirm"];

	if (confirm == "y")
	{
		// do delete here

		sql = @"delete bug_comments where bc_id = $1";
		sql = sql.Replace("$1", id);
		dbutil.execute_nonquery(sql);
		Response.Redirect ("edit_bug.aspx?id=" + bug_id);
	}
	else
	{
		back_href.HRef = "edit_bug.aspx?id=" + bug_id;
		confirm_href.HRef = "delete_comment.aspx?confirm=y&id=" + id + "&bug_id=" + bug_id;
		
		sql = @"select bc_comment from bug_comments where bc_id = $1";
		sql = sql.Replace("$1", id);
			
		DataRow dr = dbutil.get_datarow(sql);
		
		// show the first few chars of the comment
		string s = Convert.ToString(dr["bc_comment"]);
		int len = 20;
		if (s.Length < len) {len = s.Length;}
		
		confirm_href.InnerText = "confirm delete of comment: "
				+ s.Substring(0,len)
				+ "...";
		
	}


}

void Page_Unload(Object sender, EventArgs e)
{
	if (dbutil != null) {dbutil.close();}
}


</script>

<html>
<head>
<title id="title" runat="server">btnet edit attachment</title>
<link rel="StyleSheet" href="btnet.css" type="text/css">
</head>
<body>
<% security.write_menu(Response, Util.get_setting("PluralBugLabel","bugs")); %>
<p>
<div class=align>
<p>&nbsp</p>
<a id="back_href" runat="server" href="">back to <% Response.Write(Util.get_setting("SingularBugLabel","bug")); %></a>
<p>
or
<p>
<a id="confirm_href" runat="server" href="">confirm delete</a>
</div>
</body>
</html>


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -