📄 addressmodify.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.Controls;
using PowerEasy.Crm;
using PowerEasy.Model.Crm;
using PowerEasy.Web.UI;
using PowerEasy.WebSite.Controls.Shop;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
public class AddressModify : AdminPage
{
protected AddressPicker AddressPick;
protected Button BtnSave;
protected Label LblUserName;
protected ScriptManager ScriptManager1;
protected ExtendedSiteMapPath SmpNavigator;
protected TextBox TxtConsigneeName;
protected TextBox TxtMobile;
protected TextBox TxtPhone;
protected TextBox TxtZipCode;
protected PowerEasy.Controls.RequiredFieldValidator ValrContacterName;
protected PowerEasy.Controls.RequiredFieldValidator ValrZipCode;
protected CustomValidator ValxPhone;
protected MobileValidator VmblMobile;
protected TelephoneValidator VtelPhone;
protected ZipCodeValidator VzipZipCode;
private void AddressPick_AddressChanged(object sender, EventArgs e)
{
this.TxtZipCode.Text = this.AddressPick.ZipCode;
}
protected void BtnSave_Click(object sender, EventArgs e)
{
AddressInfo addressInfo = new AddressInfo();
addressInfo.AddressId = BasePage.RequestInt32("AddressID");
addressInfo.UserName = this.LblUserName.Text;
addressInfo.ConsigneeName = this.TxtConsigneeName.Text.Trim();
addressInfo.Country = this.AddressPick.Country;
addressInfo.Province = this.AddressPick.Province;
addressInfo.City = this.AddressPick.City;
addressInfo.Area = this.AddressPick.Area;
addressInfo.Address = this.AddressPick.Address;
addressInfo.ZipCode = this.TxtZipCode.Text.Trim();
addressInfo.HomePhone = this.TxtPhone.Text.Trim();
addressInfo.Mobile = this.TxtMobile.Text.Trim();
if (Address.Update(addressInfo))
{
AdminPage.WriteSuccessMsg("修改收货人地址成功!", "AddressManage.aspx");
}
else
{
AdminPage.WriteErrMsg("修改收货人地址失败!", "AddressManage.aspx");
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.AddressPick.AddressChanged += new EventHandler(this.AddressPick_AddressChanged);
if (!this.Page.IsPostBack)
{
AddressInfo addressById = Address.GetAddressById(BasePage.RequestInt32("AddressID"), true);
if (!addressById.IsNull)
{
this.LblUserName.Text = addressById.UserName;
this.TxtConsigneeName.Text = addressById.ConsigneeName;
this.AddressPick.SelectRegion(addressById.Country, addressById.Province, addressById.City, addressById.Area);
this.AddressPick.Address = addressById.Address;
this.TxtZipCode.Text = addressById.ZipCode;
this.TxtPhone.Text = addressById.HomePhone;
this.TxtMobile.Text = addressById.Mobile;
}
}
}
protected void ValxPhone_ServerValidate(object source, ServerValidateEventArgs args)
{
if (string.IsNullOrEmpty(this.TxtPhone.Text) && string.IsNullOrEmpty(this.TxtMobile.Text))
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -