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

📄 dept_info.ascx.cs

📁 人力资源管理系统 读者须安装好IIS和Microsoft Visual Stutio.NET相关开发环境
💻 CS
字号:
namespace HRAdmin.USL
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using HRAdmin.BLL ;
	using HRAdmin.COMMON ;

	/// <summary>
	///		Dept_Info 的摘要说明。
	/// </summary>
	public class Dept_Info : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.TextBox tb_DeptName;
		protected System.Web.UI.WebControls.TextBox tb_Personnel;
		protected System.Web.UI.WebControls.TextBox tb_Budget;
		protected System.Web.UI.WebControls.TextBox tb_DeptDsc;
		protected System.Web.UI.HtmlControls.HtmlInputHidden h_ID;
		protected System.Web.UI.WebControls.RequiredFieldValidator R1;
		protected System.Web.UI.WebControls.CompareValidator C1;
		protected System.Web.UI.WebControls.CompareValidator C2;
		protected System.Web.UI.WebControls.TextBox tb_Governor;

		/// <summary>
		/// 属性:Hidden框中保存的部门ID
		/// </summary>
		public string a_DeptID
		{
			get
			{
				return h_ID.Value ;
			}
			set
			{
				h_ID.Value = value ;
			}
		}

		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!IsPostBack)
			{					
				//从URL中获取公告信息ID,并转换成整型
				int deptid = CommHandler.StringToInt(Request["DEPTID"]) ;

				//获取公告信息ID成功
				if(deptid != 0)
				{					
					//实例一个公告信息信息对象
					DeptInfo di = new DeptInfo() ;
					//调用业务逻辑层的方法,通过公告信息ID获得公告信息对象
					int i = di.GetDept(deptid) ;
					if(i==0)
					{
						//将公告信息对象显示在界面
						ShowInfo(di) ;
					}
				}
			}
		}

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

		}
		#endregion

		/// <summary>
		/// 显示部门信息在界面上
		/// </summary>
		/// <param name="di">部门信息对象</param>
		public void ShowInfo(DeptInfo di)
		{
			//文本框
			this.tb_Budget.Text = di.Budget.ToString() ;
			this.tb_DeptDsc.Text = di.DeptDsc ;
			this.tb_DeptName.Text = di.DeptName ;
			this.tb_Governor.Text = di.Governor ;
			this.tb_Personnel.Text = di.Personnel.ToString() ;

			//部门信息ID
			h_ID.Value = di.DeptID.ToString() ;
		}

		/// <summary>
		/// 为部门信息对象绑定属性
		/// </summary>
		/// <param name="di">部门信息对象</param>
		public void BindInfo(DeptInfo di)
		{
			//部门预算(需转换为Double型)
			di.Budget = CommHandler.StringToDouble(tb_Budget.Text.Trim() ) ;
			//描述
			di.DeptDsc = tb_DeptDsc.Text.Trim() ;
			//部门ID号,需转换为整型
			di.DeptID = CommHandler.StringToInt(h_ID.Value) ;
			//部门名称
			di.DeptName = tb_DeptName.Text.Trim() ;
			//部门总监
			di.Governor = tb_Governor.Text.Trim() ;
			//人员编制,需转换为整型
			di.Personnel = CommHandler.StringToInt(tb_Personnel.Text.Trim()) ;			
		}
	}
}

⌨️ 快捷键说明

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