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

📄 empolyeecustomerinfooption.ascx.cs

📁 某个公司需要维持良好的客户关系
💻 CS
字号:
namespace CRM.Web.Controls
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///		EmpolyeeCustomerInfoOption 的摘要说明。
	/// </summary>
	public class EmpolyeeCustomerInfoOption : CRM.Web.Utility.UserControlBase
	{
		protected System.Web.UI.WebControls.Label Msg;
		protected System.Web.UI.WebControls.TextBox CustomerName;
		protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator3;
		protected System.Web.UI.WebControls.DropDownList CustomerTypeList;
		protected System.Web.UI.WebControls.TextBox Leader;
		protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator1;
		protected System.Web.UI.WebControls.DropDownList DeputyList;
		protected System.Web.UI.WebControls.DropDownList LevelList;
		protected System.Web.UI.WebControls.TextBox Credit;
		protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator2;
		protected System.Web.UI.WebControls.TextBox Phone;
		protected System.Web.UI.WebControls.RegularExpressionValidator Regularexpressionvalidator1;
		protected System.Web.UI.WebControls.TextBox Fax;
		protected System.Web.UI.WebControls.RegularExpressionValidator Regularexpressionvalidator3;
		protected System.Web.UI.WebControls.TextBox Email;
		protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator4;
		protected System.Web.UI.WebControls.TextBox PostCode;
		protected System.Web.UI.WebControls.RegularExpressionValidator Regularexpressionvalidator2;
		protected System.Web.UI.WebControls.TextBox Address;
		protected System.Web.UI.WebControls.TextBox HomePage;
		protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator4;
		protected System.Web.UI.WebControls.Button UserInfo_Submit;
		protected System.Web.UI.WebControls.Button UserInfo_Reset;
		protected System.Web.UI.HtmlControls.HtmlTextArea BZ;

		protected CRM.Model.UserPower power;
		protected CRM.Model.Parameter parms;
		protected System.Web.UI.WebControls.RegularExpressionValidator Regularexpressionvalidator5;
		protected System.Web.UI.WebControls.Button DeputyAdd;
		protected CRM.Model.CustomerInfo customer = new CRM.Model.CustomerInfo();

		private void Page_Load(object sender, System.EventArgs e)
		{
			this.parms = base.GetRequestParm();
			this.power = base.GetUserPower(this.parms);
			if (!Page.IsPostBack)
			{
				object[] filed={"TypeId",0,"TypeName",1,""};//加载客户分类下拉列表
				base.TreeListConvert(BLL.CustomerType.GetAllType(),filed,10,ref this.CustomerTypeList,"--") ;

				this.DeputyList.DataSource = BLL.Deputy.GetAllDeputy();
				this.DeputyList.DataTextField = "TrueName";
				this.DeputyList.DataValueField = "DeputyId";
				this.DeputyList.DataBind();

				this.LevelList.DataSource = BLL.Level.GetAllLevel();
				this.LevelList.DataTextField = "LevelName";
				this.LevelList.DataValueField = "LevelId";
				this.LevelList.DataBind(); 
			}
			if (parms.Action == "Read")
			{
				this.PageDateBind("Read");
				this.PageControlsVisible(false);
			}
			else if (parms.Action == "Update")
			{
				this.PageDateBind("Update");
				this.PageControlsVisible(true);
			}
			else if (parms.Action == "Add")
			{
				this.PageControlsVisible(true);
			}	
			
		}
		protected void GetWebNavigate()
		{
			this.Response.Write(base.InitWebNavigate(this.parms));
		}

		#region 页面控件数据绑定
		protected void PageDateBind(string option)
		{
			try
			{
				this.customer = BLL.Customer.GetCustomerById(this.parms.ItemId);
				if (!Page.IsPostBack)
				{
					this.CustomerName.Text = this.customer.CustomerName;
					this.CustomerTypeList.SelectedValue = this.customer.TypeId;
					this.Leader.Text = this.customer.Leader;
					this.DeputyList.SelectedValue = this.customer.DeputyId;
					this.LevelList.SelectedValue = this.customer.LevelId;
					this.Credit.Text = this.customer.Credit.Trim();
					this.Phone.Text = this.customer.Phone.Trim();
					this.Fax.Text = this.customer.Fax.Trim();
					this.Email.Text = this.customer.Email.Trim();
					this.PostCode.Text = this.customer.PostCode.Trim();
					this.Address.Text = this.customer.Address.Trim();
					this.HomePage.Text = this.customer.HomePage.Trim();
					this.BZ.Value = this.customer.BZ.Trim();
				}
			}
			catch
			{}
		}
		#endregion

		#region 页面数据收集
		protected void PagePageCollectData()
		{
			this.customer.CustomerName = this.CustomerName.Text;
			this.customer.TypeId = this.CustomerTypeList.SelectedValue;
			this.customer.Leader = this.Leader.Text;
			this.customer.DeputyId = this.DeputyList.SelectedValue;
			this.customer.LevelId = this.LevelList.SelectedValue;
			this.customer.Credit = this.Credit.Text.Trim();
			this.customer.Phone = this.Phone.Text.Trim();
			this.customer.Fax = this.Fax.Text.Trim();
			this.customer.Email = this.Email.Text.Trim();
			this.customer.PostCode = this.PostCode.Text.Trim();
			this.customer.Address = this.Address.Text.Trim();
			this.customer.HomePage = this.HomePage.Text.Trim();
			this.customer.BZ = this.BZ.Value;
		}
		#endregion

		#region 输入数据验证
		protected bool PageInputCheck()
		{
			if (Page.IsValid == true)
			{return true;}
			else
			{return false;}
		}
		#endregion

		#region 页面控件可编辑性设置
		protected void PageControlsVisible(bool visible)
		{
			if (visible == false)
			{
				this.UserInfo_Submit.Enabled = false;
				this.UserInfo_Reset.Enabled = false;
			}

		}
		#endregion

		#region 页面提示信息设置
		protected void PageMsgDisplay(string msg)
		{
			this.Msg.Text = msg;
		}
		#endregion

		private void UserInfo_Submit_Click(object sender, System.EventArgs e)
		{
			if (this.PageInputCheck() == true)
			{
				this.PagePageCollectData();
				if (parms.Action == "Add")
				{
					if (base.CustomerInfoOption("Add",this.customer,this.parms)==base.AddSucceed)
					{this.Msg.Text =base.AddSucceed;}
					else
					{this.Msg.Text=base.AddFailed;}
				
				}
				else if (parms.Action == "Update")
				{
					if (base.CustomerInfoOption("Update",this.customer,this.parms)==base.UpdateSucceed)
					{this.Msg.Text=base.UpdateSucceed;}
					else
					{this.Msg.Text=base.UpdateFailed;}
				}
			}
		}


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

		}
		#endregion
	}
}

⌨️ 快捷键说明

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