📄 rylist.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Admin_RyList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//显示人员信息列表
this.GridView1.DataSource = DataControl.GetData("select * from 人员 where 帐号<>'admin'");
this.GridView1.DataBind();
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
string idKey = this.GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)]["帐号"].ToString();
if (e.CommandName == "Mod")
{
//传递修改的标志 跳转页面
Response.Redirect("RyEdit.aspx?ID=" + idKey);
}
else if (e.CommandName == "Del")
{
//判断是否允许删除
if (DataControl.GetData("select * from 固定车车位收费 where 帐号='" + idKey + "'").Rows.Count > 0)
{
Response.Write("<script>alert('当前人员的信息正在使用中');</script>");
return;
}
if (DataControl.GetData("select * from 固定车进出情况 where 帐号='" + idKey + "'").Rows.Count > 0)
{
Response.Write("<script>alert('当前人员的信息正在使用中');</script>");
return;
}
if (DataControl.GetData("select * from 临时车登记 where 帐号='" + idKey + "'").Rows.Count > 0)
{
Response.Write("<script>alert('当前人员的信息正在使用中');</script>");
return;
}
//删除当前的人员信息 刷新列表
DataControl.Execute("delete from 人员 where 帐号='" + idKey + "'");
this.GridView1.DataSource = DataControl.GetData("select * from 人员 where 帐号<>'admin'");
this.GridView1.DataBind();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
//跳转页面
Response.Redirect("RyEdit.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -