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

📄 depnew.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.Common.Data;

namespace qminoa.Webs.MR
{
	public class DepNew : qminoa.Webs.PageBase
	{
		protected System.Web.UI.WebControls.Label lblErr;
		protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
		protected System.Web.UI.WebControls.ImageButton cmdExi;
		protected System.Web.UI.WebControls.ImageButton cmdSaveExi;
		protected System.Web.UI.WebControls.ImageButton cmdSaveCon;
		protected System.Web.UI.WebControls.DropDownList lstBranch;
		protected System.Web.UI.WebControls.RequiredFieldValidator valName;
		protected System.Web.UI.WebControls.TextBox txtPostCode;
		protected System.Web.UI.WebControls.Label Label13;
		protected System.Web.UI.WebControls.Label Label12;
		protected System.Web.UI.WebControls.Label Label11;
		protected System.Web.UI.WebControls.TextBox txtStreet;
		protected System.Web.UI.WebControls.Label Label10;
		protected System.Web.UI.WebControls.TextBox txtDistrict;
		protected System.Web.UI.WebControls.Label Label9;
		protected System.Web.UI.WebControls.TextBox txtCity;
		protected System.Web.UI.WebControls.Label Label8;
		protected System.Web.UI.WebControls.TextBox txtProvince;
		protected System.Web.UI.WebControls.Label Label7;
		protected System.Web.UI.WebControls.TextBox txtTel2;
		protected System.Web.UI.WebControls.Label Label6;
		protected System.Web.UI.WebControls.TextBox txtTel1;
		protected System.Web.UI.WebControls.Label Label5;
		protected System.Web.UI.WebControls.TextBox txtFax;
		protected System.Web.UI.WebControls.Label Label4;
		protected System.Web.UI.WebControls.TextBox txtManager;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.TextBox txtName;
		protected System.Web.UI.WebControls.Label Label1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			this.PageBegin("部门管理",true);
			if(!Page.IsPostBack)
				DataBind();
		}

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

		private void CreateNewDep()
		{
			DepData depData = new DepData();

			DataTable depTB = depData.Tables[DepData.DEP_TABLE_NAME]; 
			
			DataRow row = depTB.NewRow();

			row[DepData.BRANCHID_FIELD] = Convert.ToInt32(lstBranch.SelectedItem.Value,10);
			row[DepData.DEPNAME_FIELD] = txtName.Text.ToString().Trim();
			row[DepData.MANAGER_FIELD] = txtManager.Text.ToString().Trim();
			row[DepData.TEL1_FIELD] = txtTel1.Text.ToString().Trim();
			row[DepData.TEL2_FIELD] = txtTel2.Text.ToString().Trim();
			row[DepData.FAX_FIELD] = txtFax.Text.ToString().Trim();
			row[DepData.POSTCODE_FIELD] = txtPostCode.Text.ToString().Trim();
			row[DepData.PROVINCE_FIELD] = txtProvince.Text.ToString().Trim();
			row[DepData.CITY_FIELD] = txtCity.Text.ToString().Trim();
			row[DepData.DISTRICT_FIELD] = txtDistrict.Text.ToString().Trim();
			row[DepData.STREET_FIELD] = txtStreet.Text.ToString().Trim();

			depTB.Rows.Add(row);
			bool result = (new DepSystem()).CreateDep(depData);
		}

		#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.cmdSaveCon.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSaveCon_Click);
			this.cmdSaveExi.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSaveExi_Click);
			this.cmdExi.Click += new System.Web.UI.ImageClickEventHandler(this.cmdExi_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void cmdSaveExi_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			if(this.EmpRightCode  >= 2)
			{
				CreateNewDep();
				Response.Redirect("DepInf.aspx",false);
			}
			else
				JScript.Alert("您没有权限进行此操作!");
		}

		private void cmdSaveCon_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			if(this.EmpRightCode  >= 2)
			{
				CreateNewDep();

				txtName.Text = String.Empty;
				lstBranch.SelectedIndex = -1;
				txtManager.Text = String.Empty;
				txtTel1.Text = String.Empty;
				txtTel2.Text = String.Empty;
				txtFax.Text = String.Empty;
				txtProvince.Text = String.Empty;
				txtCity.Text = String.Empty;
				txtDistrict.Text = String.Empty;
				txtStreet.Text = String.Empty;
				txtPostCode.Text = String.Empty;
			}
			else
				JScript.Alert("您没有权限进行此操作!");
		}

		private void cmdExi_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			Response.Redirect("DepInf.aspx",false);
		}
	}
}

⌨️ 快捷键说明

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