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

📄 customertypeoption.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>
	///		CustomerTypeOption 的摘要说明。
	/// </summary>
	public class CustomerTypeOption : CRM.Web.Utility.UserControlBase
	{
		protected System.Web.UI.WebControls.Button Back;
		protected System.Web.UI.WebControls.Label Msg;
		protected System.Web.UI.WebControls.Label name1;
		protected System.Web.UI.WebControls.Label CustomerType_FatherName;
		protected System.Web.UI.WebControls.TextBox CustomerType_Name;
		protected System.Web.UI.WebControls.RequiredFieldValidator ss2;
		protected System.Web.UI.WebControls.TextBox CustomerType_Des;
		protected System.Web.UI.HtmlControls.HtmlInputButton submit1;
		protected System.Web.UI.HtmlControls.HtmlInputButton reset1;

		protected CRM.Model.Parameter parms;
		protected CRM.Model.UserPower power;
		protected CRM.Model.CustomerTypeInfo type=new CRM.Model.CustomerTypeInfo();

		private void Page_Load(object sender, System.EventArgs e)
		{
			this.PageMsgDisplay("");
			this.parms = base.GetRequestParm();
			this.power = base.GetUserPower(this.parms);
			this.name1.Text = "分类ID";
			if (parms.ClassId != "" && parms.ClassId != null)
			{
				this.name1.Text = "父类名称";
				this.CustomerType_FatherName.Text = BLL.CustomerType.GetTypeById(parms.ClassId).TypeName;
			}
			if (parms.Action == "Read")
			{
				this.PageDateBind("Read");
				this.PageControlsVisible(false);
			}
			else if (parms.Action == "Update" && this.power.Update == true)
			{
				this.PageDateBind("Update");
				this.PageControlsVisible(true);
			}
			else if (parms.Action == "Add")
			{
				this.PageControlsVisible(true);
			}
			else
			{
				this.PageControlsVisible(false);
				this.PageMsgDisplay(base.PostForbiden);
			}
		}

		protected void GetWebNavigate()
		{
			this.Response.Write(base.InitWebNavigate(this.parms));
		}

		#region 页面控件数据绑定
		protected void PageDateBind(string option)
		{
			this.type = BLL.CustomerType.GetTypeById(parms.ClassId);
			if (!Page.IsPostBack)
			{
				this.CustomerType_Name.Text = this.type.TypeName;
				this.CustomerType_Des.Text = this.type.BZ;
			}
		}
		#endregion
		
		#region 页面数据收集
		protected void PageCollectData()
		{
			this.type.TypeName= BLL.Common.CleanString(this.CustomerType_Name.Text,50);
			this.type.BZ  = BLL.Common.CleanString(this.CustomerType_Des.Text,500);
		}
		#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.submit1.Disabled = true;
				this.reset1.Disabled = true;
			}
		}
		#endregion

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

		private void submit1_ServerClick(object sender, System.EventArgs e)
		{
			if (this.PageInputCheck() == true)
			{
				this.PageCollectData();
				if (parms.Action == "Add")
				{
					this.type.TypeId=this.parms.ClassId;//记录父分类ID
					this.PageMsgDisplay(base.CustomerTypeOption("Add",this.type,this.parms));
				}
				else if (parms.Action == "Update")
				{
					this.PageMsgDisplay(base.CustomerTypeOption("Update",this.type,this.parms));
				}
			}
		}

		private void Back_Click(object sender, System.EventArgs e)
		{
			base.BackToListPage(this.parms);
		}

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

		}
		#endregion
	}
}

⌨️ 快捷键说明

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