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

📄 adminpage.aspx.cs

📁 校友管理系统(可以通过excel导入和导出校友信息)
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace UserInfoManage
{
	/// <summary>
	/// Summary description for AdminPage.
	/// </summary>
	public class AdminPage : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.ListBox lstUser075;
		protected System.Web.UI.WebControls.Button btnEdit075;
		protected System.Web.UI.WebControls.Button btnDel075;
		protected System.Web.UI.WebControls.Button btnLogout075;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			DataSet ds=new DataSet();
			System.Data.OleDb.OleDbDataAdapter adpt=(System.Data.OleDb.OleDbDataAdapter)this.Session["adpt"];
			adpt.SelectCommand.CommandText="select * from userinfo";
			adpt.Fill(ds);			
			lstUser075.DataSource=ds.Tables["userinfo"];
			lstUser075.DataTextField="name";
			lstUser075.DataValueField="name";
			lstUser075.DataBind();		
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.btnEdit075.Click += new System.EventHandler(this.btnEdit075_Click);
			this.btnDel075.Click += new System.EventHandler(this.btnDel075_Click);
			this.btnLogout075.Click += new System.EventHandler(this.btnLogout075_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void btnEdit075_Click(object sender, System.EventArgs e)
		{
			if(this.Request.Form["lstUser075"]!=null)
			{				
				this.Server.Transfer("EditAccount.aspx");
			}	
		}

		private void btnDel075_Click(object sender, System.EventArgs e)
		{
			string name=this.Request.Form["lstUser075"];
			System.Data.OleDb.OleDbDataAdapter adpt=(System.Data.OleDb.OleDbDataAdapter)this.Session["adpt"];
			adpt.SelectCommand.CommandText="select * from userinfo where name='"+name+"'";
			DataSet ds=new DataSet();			
			adpt.Fill(ds);
			DataTable dt=ds.Tables["userinfo"];
			DataRow row=dt.Rows[0];			
			row.Delete();
			adpt.Update(dt);
			if(System.IO.Directory.Exists(Request.MapPath(Request.ApplicationPath)+  "\\face\\"+name))
			{
				System.IO.Directory.Delete(Request.MapPath(Request.ApplicationPath)+  "\\face\\"+name,true);
			}
			this.Server.Transfer("AdminPage.aspx");
		}

		private void btnLogout075_Click(object sender, System.EventArgs e)
		{
			this.Session.Abandon();
			this.Response.Redirect("Login.aspx");
		}
	}
}

⌨️ 快捷键说明

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