📄 deputyinfooption.ascx.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>
/// DeputyInfoOption 的摘要说明。
/// </summary>
public class DeputyInfoOption : CRM.Web.Utility.UserControlBase
{
protected System.Web.UI.WebControls.Label Msg;
protected System.Web.UI.WebControls.TextBox DeputyName;
protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator3;
protected System.Web.UI.WebControls.DropDownList Sex;
protected System.Web.UI.WebControls.TextBox Birthday;
protected System.Web.UI.WebControls.DropDownList Month;
protected System.Web.UI.WebControls.DropDownList Day;
protected System.Web.UI.WebControls.TextBox MobilePhone;
protected System.Web.UI.WebControls.RegularExpressionValidator Regularexpressionvalidator7;
protected System.Web.UI.WebControls.TextBox Phone;
protected System.Web.UI.WebControls.RegularExpressionValidator Regularexpressionvalidator1;
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.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 CRM.Model.DeputyInfo deputy = new CRM.Model.DeputyInfo();
private void Page_Load(object sender, System.EventArgs e)
{
this.parms = base.GetRequestParm();
this.power = base.GetUserPower(this.parms);
if (parms.Action == "DeputyUpdate")
{
this.PageDateBind("Update");
this.PageControlsVisible(true);
}
else if (parms.Action == "DeputyAdd")
{
this.PageControlsVisible(true);
}
}
#region 页面导航
protected void GetWebNavigate()
{
this.Response.Write(base.InitWebNavigate(this.parms));
}
#endregion
#region 页面控件数据绑定
protected void PageDateBind(string option)
{
this.deputy = BLL.Deputy.GetDeputyById(this.parms.ItemId);
if (!Page.IsPostBack)
{
this.DeputyName.Text = this.deputy.TrueName;
this.Sex.SelectedValue = this.deputy.Sex.Trim();
if (this.deputy.Birthday.Length ==10)
{
this.Birthday.Text = this.deputy.Birthday.Substring(0,4);
this.Month.SelectedValue = this.deputy.Birthday.Substring(5,2);
this.Day.SelectedValue = this.deputy.Birthday.Substring(8,2);
}
this.MobilePhone.Text = this.deputy.MobilePhone.Trim();
this.Phone.Text = this.deputy.Phone.Trim();
this.Email.Text = this.deputy.Email.Trim();
this.PostCode.Text = this.deputy.PostCode.Trim();
this.Address.Text = this.deputy.Address;
this.BZ.Value = this.deputy.BZ;
}
}
#endregion
#region 页面数据收集
protected void PagePageCollectData()
{
this.deputy.TrueName = this.DeputyName.Text;
this.deputy.Sex = this.Sex.SelectedValue;
if (this.Birthday.Text != "")
{
this.deputy.Birthday = this.Birthday.Text +"-"+ this.Month.SelectedValue +"-"+ this.Day.SelectedValue;
}
this.deputy.MobilePhone = this.MobilePhone.Text;
this.deputy.Phone = this.Phone.Text;
this.deputy.Email = this.Email.Text;
this.deputy.PostCode = this.PostCode.Text;
this.deputy.Address = this.Address.Text;
this.deputy.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
#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
private void UserInfo_Submit_Click(object sender, System.EventArgs e)
{
if (this.PageInputCheck() == true)
{
this.PagePageCollectData();
if (parms.Action == "DeputyAdd")
{
if (base.DeputyOption("Add",this.deputy,this.parms)==base.AddSucceed)
{this.Msg.Text =base.AddSucceed;}
else
{this.Msg.Text=base.AddFailed;}
}
else if (parms.Action == "DeputyUpdate")
{
if (base.DeputyOption("Update",this.deputy,this.parms)==base.UpdateSucceed)
{this.Msg.Text=base.UpdateSucceed;}
else
{this.Msg.Text=base.UpdateFailed;}
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -