📄 userconfig.cs
字号:
namespace PowerEasy.WebSite.Admin.User
{
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.UserManage;
using PowerEasy.Web.UI;
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class UserConfig : AdminPage
{
protected Button BtnSubmit;
protected CompareValidator CValTxtUserNameLimit;
protected CompareValidator CValTxtUserNameMax;
protected DropDownList DropPresentValidUnit;
protected HiddenField HdnRegFields_MustFill;
protected HiddenField HdnRegFields_SelectFill;
protected ListBox LitRegFields;
protected ListBox LitRegFields_MustFill;
protected ListBox LitRegFields_SelectFill;
private Dictionary<string, ListItem> m_RegFields;
protected HtmlTableRow MoneyExchangePoint;
protected HtmlTableRow MoneyExchangeValidDay;
protected HtmlTableRow PointName;
protected HtmlTableRow PointUnit;
protected HtmlTableRow PresentExp;
protected HtmlTableRow PresentExpPerLogin;
protected HtmlTableRow PresentMoney;
protected HtmlTableRow PresentPoint;
protected HtmlTableRow PresentValidNum;
protected RadioButtonList RadlAdminCheckReg;
protected RadioButtonList RadlEmailCheckReg;
protected RadioButtonList RadlEnableCheckCodeOfLogin;
protected RadioButtonList RadlEnableCheckCodeOfReg;
protected RadioButtonList RadlEnableMultiLogin;
protected RadioButtonList RadlEnableMultiRegPerEmail;
protected RadioButtonList RadlEnableQAofReg;
protected RadioButtonList RadlEnableRegCompany;
protected RadioButtonList RadlEnableUserReg;
protected RadioButtonList RadlGetPasswordType;
protected DropDownList RadlUserGroup;
protected PowerEasy.Controls.RequiredFieldValidator ReqTxtUserNameLimit;
protected PowerEasy.Controls.RequiredFieldValidator ReqTxtUserNameMax;
protected ExtendedSiteMapPath SmpNavigator;
protected TextBox TxtCMoneyExchangePoint;
protected TextBox TxtCMoneyExchangeValidDay;
protected TextBox TxtCUserExpExchangePoint;
protected TextBox TxtCUserExpExchangeValidDay;
protected TextBox TxtEmailOfRegCheck;
protected TextBox TxtMoneyExchangePoint;
protected TextBox TxtMoneyExchangeValidDay;
protected TextBox TxtPointName;
protected TextBox TxtPointUnit;
protected TextBox TxtPresentExp;
protected TextBox TxtPresentExpPerLogin;
protected TextBox TxtPresentMoney;
protected TextBox TxtPresentPoint;
protected TextBox TxtPresentValidNum;
protected TextBox TxtRegAnswer1;
protected TextBox TxtRegAnswer2;
protected TextBox TxtRegAnswer3;
protected TextBox TxtRegQuestion1;
protected TextBox TxtRegQuestion2;
protected TextBox TxtRegQuestion3;
protected TextBox TxtUserExpExchangePoint;
protected TextBox TxtUserExpExchangeValidDay;
protected TextBox TxtUserName_RegDisabled;
protected TextBox TxtUserNameLimit;
protected TextBox TxtUserNameMax;
protected HtmlTableRow UserExpExchangePoint;
protected HtmlTableRow UserExpExchangeValidDay;
protected RegularExpressionValidator ValeCMoneyExchangePoint;
protected RegularExpressionValidator ValeCMoneyExchangeValidDay;
protected RegularExpressionValidator ValeMoneyExchangePoint;
protected RegularExpressionValidator ValeMoneyExchangeValidDay;
protected RegularExpressionValidator ValgCUserExpExchangePoint;
protected RegularExpressionValidator ValgCUserExpExchangeValidDay;
protected RegularExpressionValidator ValgPresentExp;
protected RegularExpressionValidator ValgPresentPoint;
protected RegularExpressionValidator ValgTxtPresentMoney;
protected RegularExpressionValidator ValgUserExpExchangePoint;
protected RegularExpressionValidator ValgUserExpExchangeValidDay;
protected void BtnSubmit_Click(object sender, EventArgs e)
{
SiteConfigInfo info = SiteConfig.ConfigReadFromFile();
info.UserConfig.EnableUserReg = DataConverter.CBool(this.RadlEnableUserReg.SelectedValue);
info.UserConfig.GroupId = DataConverter.CLng(this.RadlUserGroup.SelectedValue);
info.UserConfig.EmailCheckReg = DataConverter.CBool(this.RadlEmailCheckReg.SelectedValue);
info.UserConfig.AdminCheckReg = DataConverter.CBool(this.RadlAdminCheckReg.SelectedValue);
info.UserConfig.EnableMultiRegPerEmail = DataConverter.CBool(this.RadlEnableMultiRegPerEmail.SelectedValue);
info.UserConfig.EnableCheckCodeOfReg = DataConverter.CBool(this.RadlEnableCheckCodeOfReg.SelectedValue);
info.UserConfig.EnableQAofReg = DataConverter.CBool(this.RadlEnableQAofReg.SelectedValue);
info.UserConfig.RegQuestion1 = this.TxtRegQuestion1.Text.Trim();
info.UserConfig.RegAnswer1 = this.TxtRegAnswer1.Text.Trim();
info.UserConfig.RegQuestion2 = this.TxtRegQuestion2.Text.Trim();
info.UserConfig.RegAnswer2 = this.TxtRegAnswer2.Text.Trim();
info.UserConfig.RegQuestion3 = this.TxtRegQuestion3.Text.Trim();
info.UserConfig.RegAnswer3 = this.TxtRegAnswer3.Text.Trim();
info.UserConfig.UserNameLimit = DataConverter.CLng(this.TxtUserNameLimit.Text);
info.UserConfig.UserNameMax = DataConverter.CLng(this.TxtUserNameMax.Text);
info.UserConfig.UserNameRegDisabled = this.TxtUserName_RegDisabled.Text.Trim();
info.UserConfig.RegFieldsMustFill = this.HdnRegFields_MustFill.Value;
info.UserConfig.RegFieldsSelectFill = this.HdnRegFields_SelectFill.Value;
info.UserConfig.PresentExp = DataConverter.CDouble(this.TxtPresentExp.Text);
info.UserConfig.PresentMoney = DataConverter.CDouble(this.TxtPresentMoney.Text);
info.UserConfig.PresentPoint = DataConverter.CLng(this.TxtPresentPoint.Text);
info.UserConfig.PresentValidNum = DataConverter.CLng(this.TxtPresentValidNum.Text);
info.UserConfig.PresentValidUnit = DataConverter.CLng(this.DropPresentValidUnit.SelectedValue);
info.UserConfig.EnableCheckCodeOfLogin = DataConverter.CBool(this.RadlEnableCheckCodeOfLogin.SelectedValue);
info.UserConfig.EnableMultiLogin = DataConverter.CBool(this.RadlEnableMultiLogin.SelectedValue);
info.UserConfig.PresentExpPerLogin = DataConverter.CDouble(this.TxtPresentExpPerLogin.Text);
info.UserConfig.UserGetPasswordType = DataConverter.CLng(this.RadlGetPasswordType.SelectedValue);
info.UserConfig.MoneyExchangePointByMoney = DataConverter.CDouble(this.TxtMoneyExchangePoint.Text);
info.UserConfig.MoneyExchangeValidDayByMoney = DataConverter.CDouble(this.TxtMoneyExchangeValidDay.Text);
info.UserConfig.UserExpExchangePointByExp = DataConverter.CDouble(this.TxtUserExpExchangePoint.Text);
info.UserConfig.UserExpExchangeValidDayByExp = DataConverter.CDouble(this.TxtUserExpExchangeValidDay.Text);
info.UserConfig.MoneyExchangePointByPoint = DataConverter.CDouble(this.TxtCMoneyExchangePoint.Text);
info.UserConfig.MoneyExchangeValidDayByValidDay = DataConverter.CDouble(this.TxtCMoneyExchangeValidDay.Text);
info.UserConfig.UserExpExchangePointByPoint = DataConverter.CDouble(this.TxtCUserExpExchangePoint.Text);
info.UserConfig.UserExpExchangeValidDayByValidDay = DataConverter.CDouble(this.TxtCUserExpExchangeValidDay.Text);
info.UserConfig.PointName = this.TxtPointName.Text.Trim();
info.UserConfig.PointUnit = this.TxtPointUnit.Text.Trim();
info.UserConfig.EmailOfRegCheck = this.TxtEmailOfRegCheck.Text.Trim();
info.UserConfig.EnableRegCompany = DataConverter.CBool(this.RadlEnableRegCompany.SelectedValue);
SiteConfig config = new SiteConfig();
try
{
config.Update(info);
AdminPage.WriteSuccessMsg("<li>网站信息配置保存成功!</li>", "UserConfig.aspx");
}
catch (FileNotFoundException)
{
AdminPage.WriteErrMsg("<li>文件未找到!</li>", "UserConfig.aspx");
}
catch (UnauthorizedAccessException)
{
AdminPage.WriteErrMsg("<li>检查您的服务器是否给配置文件或文件夹写入权限。</li>", "UserConfig.aspx");
}
}
private void ModifyConfig()
{
this.RadlUserGroup.DataSource = UserGroups.GetGroupTable(GroupType.Register);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -