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

📄 empinf.aspx.cs

📁 专业的办公oa代码下载 c#语言编写 三层结构
💻 CS
字号:
using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using qminoa.BLL;
using qminoa.Common;
using qminoa.DA;

namespace qminoa.Webs.MR
{
	public class EmpInf : qminoa.Webs.PageBase
	{
		protected System.Web.UI.WebControls.DropDownList dropBranch;
		protected System.Web.UI.WebControls.DropDownList dropDep;
		protected System.Web.UI.WebControls.TextBox txtName;
		protected System.Web.UI.WebControls.ImageButton cmdQuery;
		protected System.Web.UI.WebControls.Label lblEmpNum;
		protected System.Web.UI.WebControls.DataGrid dgEmpInfo;
		protected System.Web.UI.WebControls.HyperLink lnkAdd;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			this.PageBegin("人员管理",true);
			if(this.EmpRightCode  >= 2)
				lnkAdd.NavigateUrl="empbase.aspx";
			if(!Page.IsPostBack)
				DataBind();
		}

		public DataTable BraTB
		{
			get
			{	 
				return (new DepSystem()).GetBraTB();
			}
		}

		public DataTable DepTB
		{
			get
			{
				int branchID = Convert.ToInt32(dropBranch.SelectedItem.Value,10);
				return (new DepSystem()).GetDepTB_By_BranchID(branchID);
			}
		}

		public DataTable EmpTB
		{
			get
			{
				return Query();
			}
			
		}

		private DataTable Query()
		{
			string[] array = new string[3];
			array[0] = dropBranch.SelectedItem.Value;
			if(dropDep.SelectedItem == null)
				array[1] = string.Empty ;
			else
				array[1] = dropDep.SelectedItem.Value;
			array[2] = txtName.Text;
			DataTable dtQuery = (new EmpSystem()).GetEmpTB_By_QueryStr(array[0],array[1],array[2]);
			lblEmpNum.Text = dtQuery.Rows.Count.ToString();
			return dtQuery;
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			InitializeComponent();
			base.OnInit(e);
		}
		
		private void InitializeComponent()
		{    
			this.dropBranch.SelectedIndexChanged += new System.EventHandler(this.dropBranch_SelectedIndexChanged);
			this.dropDep.SelectedIndexChanged += new System.EventHandler(this.dropDep_SelectedIndexChanged);
			this.cmdQuery.Click += new System.Web.UI.ImageClickEventHandler(this.cmdQuery_Click);
			this.dgEmpInfo.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgEmpInfo_StopCommand);
			this.dgEmpInfo.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgEmpInfo_ItemDataBound);
			this.dgEmpInfo.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.dgEmpInfo_PageIndexChanged);
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion

		private void cmdQuery_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			if(this.EmpRightCode  >= 1)
				dgEmpInfo.DataBind();
			else
				JScript.Alert("您没有权限进行此操作!");
		}

		private void dgEmpInfo_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
		{
			dgEmpInfo.CurrentPageIndex = e.NewPageIndex;
			dgEmpInfo.DataBind();
		}

		private void dgEmpInfo_StopCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
		{
			if(this.EmpRightCode  == 4)
			{
				int index = e.Item.ItemIndex;
				int empID = Convert.ToInt16(dgEmpInfo.DataKeys[index].ToString(),10);
				MrBaseInf EmpAccess = new MrBaseInf();
				if(EmpAccess.StopEmpLogin(empID,0))
				{
					dgEmpInfo.DataBind();
					this.WriteOptLog("停用帐号"+empID.ToString());
					JScript.Alert("停用用户帐号操作成功!");
				}
				else
					JScript.Alert("停用用户帐号操作失败!");
			}
			else
				JScript.Alert("您没有权限进行此操作!");
		}

		private void dropBranch_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			dropDep.DataBind();
			dgEmpInfo.CurrentPageIndex = 0;
			dgEmpInfo.DataBind();
		}

		private void dropDep_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			dgEmpInfo.CurrentPageIndex = 0;
			dgEmpInfo.DataBind();
		}

		private void dgEmpInfo_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
			ListItemType itemType = e.Item.ItemType;
			e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ;
			if (itemType == ListItemType.Item )
			{
				e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#dedfde';";
			}
			else if( itemType == ListItemType.AlternatingItem)
			{
				e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#ffffff';";
			}
			if (e.Item.ItemType == ListItemType.Item ||
				e.Item.ItemType == ListItemType.AlternatingItem) 
			{
				ImageButton button = (ImageButton) e.Item.FindControl("Imagebutton2");
				button.Attributes.Add ("onclick",
					"return confirm (\"确定要停用此帐号吗?\");");
			}
		}
	}
}

⌨️ 快捷键说明

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