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

📄 personnel_information.aspx.cs

📁 用ASP.NET做的人事管理系统,主要处理公司雇员的人事信息.
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;


namespace PMS
{
	/// <summary>
	/// personnel_information 的摘要说明。
	/// </summary>
	public class personnel_information : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.TextBox Tbx_uid;
		protected System.Web.UI.WebControls.DataGrid Dgd_information;
		protected System.Web.UI.WebControls.Label Lbl_remind;
		protected System.Web.UI.WebControls.Button Btn_search;
		protected System.Web.UI.WebControls.Button Btn_update;
		protected System.Web.UI.WebControls.Button Btn_back;
	    SqlConnection cn;
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			string strconn= ConfigurationSettings.AppSettings["dsn"];
			cn=new SqlConnection(strconn);	
			if(!IsPostBack)
			{  
				Bindgrid();
			}
		
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Btn_search.Click += new System.EventHandler(this.Btn_search_Click);
			this.Btn_update.Click += new System.EventHandler(this.Btn_update_Click);
			this.Btn_back.Click += new System.EventHandler(this.Btn_back_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
		public void DataGrid_Page(object sender,DataGridPageChangedEventArgs e)
		{
			Dgd_information.CurrentPageIndex=e.NewPageIndex;
			Bindgrid();
		}
		public void Bindgrid()
		{
			string strsql="select UID,UName,UDepartment,UPosition from personnel_information";
			SqlDataAdapter da=new SqlDataAdapter(strsql,cn); 
			DataSet ds=new DataSet();
			da.Fill(ds);
			Dgd_information.DataSource=ds;
			Dgd_information.DataBind();
		}

		private void Btn_update_Click(object sender, System.EventArgs e)
		{
			if((int)Session["userpower"]==1)
			{
				Response.Redirect("updateinformation.aspx");
			}
			else
			{
				Lbl_remind.Text="对不起,您没有权限!";
			};
		}

		private void Btn_search_Click(object sender, System.EventArgs e)
		{
			string strsql="select UID,UName,UDepartment,UPosition from personnel_information where UID='"+Tbx_uid.Text+"'";
			SqlDataAdapter da=new SqlDataAdapter(strsql,cn);
			DataSet ds=new DataSet();
			da.Fill(ds);
			Dgd_information.DataSource=ds;
			Dgd_information.DataBind();
			
		}

		private void Btn_back_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("default.aspx");
		}
	}
}

⌨️ 快捷键说明

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