Demo/Prize.aspx.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using Demo.Helper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Demo
{
public partial class Prize : Page
{
private string LoginId = CookieHelper.GetCookie("Aid", "LoginId");
protected void Page_Load(object sender, EventArgs e)
{
if(string.IsNullOrEmpty(LoginId))
{
Response.Write("<script>alert('请您先登录再操作!');window.location.href='Login.aspx';</script>");
Response.End();
}
DataSet datauser = DBHelper.GetDataTable($"select * from UserInfo where id='{LoginId}'").DataSet;
if (Convert.ToString(datauser.Tables[0].Rows[0][1]) != "1")
{
Response.Write("<script>alert('您不是管理员不能访问该页面哦,抱歉!');window.location.href='RedeemPrize.aspx'</script>");
Response.End();
}
if (!IsPostBack)
{
bind();
}
}
//绑定数据
public void bind()
{
DataTable data = DBHelper.GetDataTable($"select * from [Prize]");
GridViewbook.DataSource = data.DataSet;
GridViewbook.DataBind();
}
protected void GridViewbook_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridViewbook.EditIndex = -1;//将gridview从编辑模式切换成浏览模式
bind();
}
protected void GridViewbook_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int id = Convert.ToInt32(this.GridViewbook.DataKeys[e.RowIndex].Value);
string str = "delete from [Prize] where id=" + id;
int num = DBHelper.ExecuteNonQuery(str);
if (num > 0)
{
Response.Write("<script>alert('删除成功!')</script>");
}
else
{
Response.Write("<script>alert('删除失败!')</script>");
}
bind();
后面还有 47 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。