📄 contacterui.cs
字号:
namespace PowerEasy.WebSite.Admin.Crm
{
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Crm;
using PowerEasy.Enumerations;
using PowerEasy.Model.Crm;
using PowerEasy.ModelControls;
using PowerEasy.Web.UI;
using PowerEasy.WebSite.Controls.Crm;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
public class ContacterUI : AdminPage
{
protected Button BtnSave;
protected CrmSelectControl ClientSelect;
protected LiaisonInformation LiaisonInformation1;
private string m_action;
protected PersonalInformation PersonalInformation1;
protected RadioButtonList RadlUserType;
protected CrmSelectControl SelectContacter;
protected ScriptManager SmgeRegion;
protected ExtendedSiteMapPath SmpNavigator;
protected TextBox TxtDepartment;
protected TextBox TxtOperation;
protected TextBox TxtPosition;
protected TextBox TxtTitle;
protected TextBox TxtTrueName;
protected PowerEasy.Controls.RequiredFieldValidator ValrClientId;
protected PowerEasy.Controls.RequiredFieldValidator ValrTrue;
protected void BtnSave_Click(object sender, EventArgs e)
{
int num;
bool flag;
ContacterInfo contacterInfo = new ContacterInfo();
if (this.m_action != "Modify")
{
num = Contacter.GetMaxId() + 1;
}
else
{
num = BasePage.RequestInt32("ContacterId");
}
contacterInfo.ContacterId = num;
contacterInfo.ClientId = DataConverter.CLng(this.ClientSelect.DataKey);
contacterInfo.ParentId = DataConverter.CLng(this.SelectContacter.DataKey);
contacterInfo.UserType = (ContacterType) Enum.Parse(typeof(ContacterType), this.RadlUserType.SelectedValue);
contacterInfo.TrueName = this.TxtTrueName.Text;
contacterInfo.Department = this.TxtDepartment.Text;
contacterInfo.Position = this.TxtPosition.Text;
contacterInfo.Operation = this.TxtOperation.Text;
contacterInfo.Title = this.TxtTitle.Text;
contacterInfo.Owner = PEContext.Current.Admin.AdminName;
this.PersonalInformation1.GetContacter(contacterInfo);
this.LiaisonInformation1.GetContacter(contacterInfo);
if (this.m_action != "Modify")
{
flag = Contacter.Add(contacterInfo);
}
else
{
flag = Contacter.Update(contacterInfo);
}
if (flag)
{
AdminPage.WriteSuccessMsg("保存联系人信息成功!", "ContacterManage.aspx");
}
else
{
AdminPage.WriteErrMsg("保存联系人信息失败!");
}
}
private void EvaluateToForm()
{
ContacterInfo contacterById = Contacter.GetContacterById(BasePage.RequestInt32("ContacterId"));
ContacterInfo info2 = Contacter.GetContacterById(contacterById.ParentId);
ClientInfo clientById = Client.GetClientById(contacterById.ClientId);
this.ClientSelect.Text = clientById.ShortedForm;
if (info2.IsNull)
{
this.SelectContacter.Text = "";
}
else
{
this.SelectContacter.Text = DataSecurity.HtmlDecode(info2.TrueName);
}
this.TxtTrueName.Text = DataSecurity.HtmlDecode(contacterById.TrueName);
this.TxtTitle.Text = DataSecurity.HtmlDecode(contacterById.Title);
this.SelectContacter.DataKey = contacterById.ParentId.ToString();
this.ClientSelect.DataKey = contacterById.ClientId.ToString();
BasePage.SetSelectedIndexByValue(this.RadlUserType, contacterById.UserType.ToString("D"));
this.TxtDepartment.Text = contacterById.Department;
this.TxtPosition.Text = contacterById.Position;
this.TxtOperation.Text = contacterById.Operation;
this.PersonalInformation1.SetContacter(contacterById);
this.LiaisonInformation1.SetContacter(contacterById);
}
protected void Page_Load(object sender, EventArgs e)
{
this.m_action = BasePage.RequestString("Action", "Add");
if (!this.Page.IsPostBack)
{
if (this.m_action == "Modify")
{
this.EvaluateToForm();
}
else
{
int clientId = BasePage.RequestInt32("ClientID");
if (clientId > 0)
{
this.ClientSelect.Text = Client.GetClientNameById(clientId);
this.ClientSelect.DataKey = clientId.ToString();
}
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -