📄 shopconfigui.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.ExtendedControls;
using PowerEasy.ModelControls;
using PowerEasy.Web.UI;
using PowerEasy.WebSite.Controls;
using System;
using System.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
public class ShopConfigUI : AdminPage
{
protected ExtendedButton BtnSubmit;
protected CompareValidator CompareValidator1;
protected Label LblTitle;
protected ShowPointName PointName;
protected ShowPointName PointUnit;
protected RadioButtonList RadlEnableCoupon;
protected RadioButtonList RadlEnableGuestBuy;
protected RadioButton RadlEnablePartPay0;
protected RadioButton RadlEnablePartPay1;
protected RadioButtonList RadlSetFunctionary;
protected RadioButtonList RadlThumb;
protected RadioButtonList RadlWatermark;
protected RegionControl Region1;
protected ShowPointName ShowPointName1;
protected ScriptManager SmgeRegion;
protected ExtendedSiteMapPath SmpNavigator;
protected TaxRateSetting TaxRateTypeSet;
protected TextBox TxtAgainBuy;
protected TextBox txtAge;
protected TextBox TxtContinueBuy;
protected TextBox TxtEmailOfDeliver;
protected TextBox TxtEmailOfInvoice;
protected TextBox TxtEmailOfOrderConfirm;
protected TextBox TxtEmailOfReceiptMoney;
protected TextBox TxtEmailOfRefund;
protected TextBox TxtEmailOfSendCard;
protected TextBox TxtLabels;
protected TextBox TxtMoneyPresentPoint;
protected TextBox txtOrderProductNumber;
protected TextBox TxtPostCode;
protected TextBox TxtPrefixOrderFormNum;
protected TextBox TxtPrefixPaymentNum;
protected TextBox TxtTaxRate;
protected RegularExpressionValidator ValePostCode;
protected System.Web.UI.WebControls.RequiredFieldValidator valrOrderProductNumber;
protected RangeValidator valrOrderProductNumberMin;
protected RangeValidator ValrPriceAge;
protected void BtnSubmit_Click(object sender, EventArgs e)
{
if (base.IsValid)
{
SiteConfig config = new SiteConfig();
SiteConfigInfo info = SiteConfig.ConfigInfo();
info.ShopConfig.EnableGuestBuy = DataConverter.CBool(this.RadlEnableGuestBuy.SelectedValue);
if (this.RadlEnablePartPay1.Checked)
{
info.ShopConfig.EnablePartPay = true;
info.ShopConfig.PartPayAge = Convert.ToInt32(this.txtAge.Text.Trim());
}
else
{
info.ShopConfig.EnablePartPay = false;
}
info.ShopConfig.OrderProductNumber = Convert.ToInt32(this.txtOrderProductNumber.Text.Trim());
info.ShopConfig.TaxRateType = (int) this.TaxRateTypeSet.TaxRate;
info.ShopConfig.TaxRate = Convert.ToSingle(DataConverter.CDouble(this.TxtTaxRate.Text));
info.ShopConfig.PrefixOrderFormNum = this.TxtPrefixOrderFormNum.Text.Trim();
info.ShopConfig.PrefixPaymentNum = this.TxtPrefixPaymentNum.Text.Trim();
info.ShopConfig.Country = this.Region1.Country;
info.ShopConfig.Province = this.Region1.Province;
info.ShopConfig.City = this.Region1.City;
info.ShopConfig.PostCode = this.TxtPostCode.Text.Trim();
info.ShopConfig.EmailOfDeliver = this.TxtEmailOfDeliver.Text;
info.ShopConfig.EmailOfInvoice = this.TxtEmailOfInvoice.Text;
info.ShopConfig.EmailOfOrderConfirm = this.TxtEmailOfOrderConfirm.Text;
info.ShopConfig.EmailOfReceiptMoney = this.TxtEmailOfReceiptMoney.Text;
info.ShopConfig.EmailOfRefund = this.TxtEmailOfRefund.Text;
info.ShopConfig.EmailOfSendCard = this.TxtEmailOfSendCard.Text;
info.ShopConfig.AgainBuyUrl = this.TxtAgainBuy.Text;
info.ShopConfig.ContinueBuy = this.TxtContinueBuy.Text;
info.ShopConfig.MoneyPresentPoint = DataConverter.CDecimal(this.TxtMoneyPresentPoint.Text);
info.ShopConfig.EnableCoupon = DataConverter.CBool(this.RadlEnableCoupon.SelectedValue);
info.ShopConfig.IsThumb = DataConverter.CBool(this.RadlThumb.SelectedValue);
info.ShopConfig.IsWatermark = DataConverter.CBool(this.RadlWatermark.SelectedValue);
info.ShopConfig.IsSetFunctionary = DataConverter.CBool(this.RadlSetFunctionary.SelectedValue);
try
{
config.Update(info);
AdminPage.WriteSuccessMsg("商店参数配置成功!", "ShopConfig.aspx");
}
catch (SecurityException exception)
{
AdminPage.WriteErrMsg(exception.Message);
}
catch (UnauthorizedAccessException exception2)
{
AdminPage.WriteErrMsg(exception2.Message);
}
}
}
private void ModifyConfig()
{
ShopConfig shopConfig = SiteConfig.ShopConfig;
this.RadlEnableGuestBuy.Items[shopConfig.EnableGuestBuy ? 0 : 1].Selected = true;
if (shopConfig.EnablePartPay)
{
this.RadlEnablePartPay1.Checked = true;
this.RadlEnablePartPay0.Checked = false;
this.txtAge.Text = shopConfig.PartPayAge.ToString();
}
else
{
this.RadlEnablePartPay1.Checked = false;
this.RadlEnablePartPay0.Checked = true;
}
this.txtOrderProductNumber.Text = shopConfig.OrderProductNumber.ToString();
this.TxtTaxRate.Text = shopConfig.TaxRate.ToString();
this.TaxRateTypeSet.TaxRate = (TaxRateType) shopConfig.TaxRateType;
this.TxtPrefixOrderFormNum.Text = shopConfig.PrefixOrderFormNum;
this.TxtPrefixPaymentNum.Text = shopConfig.PrefixPaymentNum;
this.Region1.Country = shopConfig.Country;
this.Region1.Province = shopConfig.Province;
this.Region1.City = shopConfig.City;
this.Region1.Action = "Modify";
this.TxtPostCode.Text = shopConfig.PostCode;
this.TxtEmailOfDeliver.Text = shopConfig.EmailOfDeliver;
this.TxtEmailOfInvoice.Text = shopConfig.EmailOfInvoice;
this.TxtEmailOfOrderConfirm.Text = shopConfig.EmailOfOrderConfirm;
this.TxtEmailOfReceiptMoney.Text = shopConfig.EmailOfReceiptMoney;
this.TxtEmailOfRefund.Text = shopConfig.EmailOfRefund;
this.TxtEmailOfSendCard.Text = shopConfig.EmailOfSendCard;
this.TxtAgainBuy.Text = shopConfig.AgainBuyUrl;
this.TxtContinueBuy.Text = shopConfig.ContinueBuy;
this.TxtMoneyPresentPoint.Text = shopConfig.MoneyPresentPoint.ToString("0.00");
this.RadlEnableCoupon.Items[shopConfig.EnableCoupon ? 0 : 1].Selected = true;
this.RadlThumb.Items[shopConfig.IsThumb ? 0 : 1].Selected = true;
this.RadlWatermark.Items[shopConfig.IsWatermark ? 0 : 1].Selected = true;
this.RadlSetFunctionary.Items[shopConfig.IsSetFunctionary ? 0 : 1].Selected = true;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!base.IsPostBack)
{
this.RadlEnablePartPay0.Attributes.Add("onclick", "javascript:partAgeTR.style.display='none';");
this.RadlEnablePartPay1.Attributes.Add("onclick", "javascript:partAgeTR.style.display='';");
this.ModifyConfig();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -