📄 wordfilter.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Accessories
{
using PowerEasy.Accessories;
using PowerEasy.Common;
using PowerEasy.Controls;
using PowerEasy.Model.Accessories;
using PowerEasy.Web.UI;
using System;
using System.Web.UI.WebControls;
public class WordFilter : AdminPage
{
protected AlternateLiteral AltrTitle;
protected Button EBtnSubmit;
protected HiddenField HdnSource;
protected RadioButtonList RadioIsEnabled;
protected ExtendedSiteMapPath SmpNavigator;
protected TextBox TxtPriority;
protected TextBox TxtSourceWord;
protected TextBox TxtTargetWord;
protected NumberValidator ValrNumberValidator;
protected PowerEasy.Controls.RequiredFieldValidator ValrPriority;
protected PowerEasy.Controls.RequiredFieldValidator ValrSourceWord;
protected PowerEasy.Controls.RequiredFieldValidator ValrTargetWord;
protected void EBtnSubmit_Click(object sender, EventArgs e)
{
string text = this.TxtSourceWord.Text;
WordReplaceInfo wordReplaceInfo = new WordReplaceInfo();
if (this.ViewState["action"].ToString() == "Add")
{
if (!WordReplace.Exists(text, 0))
{
wordReplaceInfo.ItemId = WordReplace.GetMaxId() + 1;
wordReplaceInfo.SourceWord = this.TxtSourceWord.Text;
wordReplaceInfo.TargetWord = this.TxtTargetWord.Text;
wordReplaceInfo.Priority = DataConverter.CLng(this.TxtPriority.Text);
wordReplaceInfo.IsEnabled = Convert.ToBoolean(this.RadioIsEnabled.SelectedValue);
wordReplaceInfo.ReplaceType = 0;
if (WordReplace.Add(wordReplaceInfo))
{
AdminPage.WriteSuccessMsg("<li>添加字符过滤成功!</li>", "WordFilterManage.aspx");
}
else
{
AdminPage.WriteErrMsg("<li>添加字符过滤操作失败!</li>");
}
}
else
{
AdminPage.WriteErrMsg("<li>数据库中已经存在此字符过滤!</li>");
}
}
else
{
bool flag;
if (text == this.HdnSource.Value)
{
flag = false;
}
else
{
flag = WordReplace.Exists(text, 0);
}
if (!flag)
{
wordReplaceInfo.ItemId = BasePage.RequestInt32("ItemID");
wordReplaceInfo.SourceWord = this.TxtSourceWord.Text;
wordReplaceInfo.TargetWord = this.TxtTargetWord.Text;
wordReplaceInfo.Priority = DataConverter.CLng(this.TxtPriority.Text);
wordReplaceInfo.IsEnabled = Convert.ToBoolean(this.RadioIsEnabled.SelectedValue);
wordReplaceInfo.ReplaceType = 0;
if (WordReplace.Update(wordReplaceInfo))
{
AdminPage.WriteSuccessMsg("<li>修改字符过滤成功!</li>", "WordFilterManage.aspx");
}
else
{
AdminPage.WriteErrMsg("<li>修改字符过滤操作失败!</li>");
}
}
else
{
AdminPage.WriteErrMsg("<li>数据库中已经存在此字符过滤!</li>");
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!base.IsPostBack)
{
string str = BasePage.RequestString("Action", "Add");
this.ViewState["action"] = str;
if (str == "Modify")
{
WordReplaceInfo infoById = new WordReplaceInfo();
infoById = WordReplace.GetInfoById(BasePage.RequestInt32("ItemID"));
this.TxtSourceWord.Text = DataSecurity.HtmlDecode(infoById.SourceWord);
this.TxtTargetWord.Text = DataSecurity.HtmlDecode(infoById.TargetWord);
this.TxtPriority.Text = infoById.Priority.ToString();
this.RadioIsEnabled.SelectedValue = infoById.IsEnabled.ToString();
this.HdnSource.Value = infoById.SourceWord.ToString();
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -