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

📄 departmentmng.aspx.cs

📁 人事管理系统源码 主要功能有: 员工管理:员工信息管理 员工调动管理 部门管理:部门信息管理 部门人员管理 用户管理:用户管理 修改密码
💻 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 PMS.DesktopModules.DepartmentInfo
{
	/// <summary>
	/// DepartmentMng 的摘要说明。
	/// </summary>
	public partial class DepartmentMng : System.Web.UI.Page
	{
	
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			///判断用户是否登陆
			if(Session["UserID"] == null)
			{
				Response.Redirect("~/Default.aspx");
			}
			if(!Page.IsPostBack)
			{
				PMS.Components.Department Depart = new PMS.Components.Department();
				DataTable DT = Depart.GetDepartment();
				DepartList.DataSource = DT;
				DepartList.DataBind();
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			
		}
		#endregion

		protected void AddDepartment_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("AddDepartment.aspx");
		}		
       
        protected void DepartList_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            DepartList.PageIndex = e.NewPageIndex;//判断当前页码是多少?并传入下页的页码
            PMS.Components.Department Depart = new PMS.Components.Department();
            DataTable DT = Depart.GetDepartment();
            DepartList.DataSource = DT;
            DepartList.DataBind();
        }
        protected void DepartList_RowEditing(object sender, GridViewEditEventArgs e)
        {
            Session["DepartUpdate_ID"] = DepartList.Rows[e.NewEditIndex].Cells[0].Text.ToString();
			Response.Redirect("UpdateDepartment.aspx");
		}
        protected void  DepartList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {

            PMS.Components.Department Depart =new PMS.Components.Department();
			string id = DepartList.Rows[e.RowIndex].Cells[0].Text;
			if(Depart.IsHaveEmployee(id))
			{
				Response.Write ("<script>window.alert('" + "此部门下存在员工信息,不能删除!!!"+"')</script>");
			}
			else
			{
				try
				{	
					if(Depart.DeleteDepartment(id))
					{
						///显示操作结果信息
						Response.Write ("<script>window.alert('" + "删除成功!!!"+"')</script>");
						DataTable DT = Depart.GetDepartment();
						DepartList.DataSource = DT;
						DepartList.DataBind();
					}
					
				}
				catch(Exception ex)
				{
					PMS.Common.SystemError.SystemLog(ex.Message) ;
					Response.Redirect(ex.Message) ;
				}
		   
			}
}
}
}

⌨️ 快捷键说明

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