⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 insidelink.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 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 InsideLink : AdminPage
    {
        protected AlternateLiteral AltrTitle;
        protected Button EBtnSubmit;
        protected HiddenField HdnSource;
        protected RadioButtonList RadioIsEnabled;
        protected RadioButtonList RadlOpenType;
        protected ExtendedSiteMapPath SmpNavigator;
        protected TextBox TxtPriority;
        protected TextBox TxtReplaceTimes;
        protected TextBox TxtSourceWord;
        protected TextBox TxtTargetWord;
        protected TextBox TxtTitle;
        protected NumberValidator ValrNumberValidator;
        protected PowerEasy.Controls.RequiredFieldValidator ValrPriority;
        protected PowerEasy.Controls.RequiredFieldValidator ValrReplaceTimes;
        protected PowerEasy.Controls.RequiredFieldValidator ValrSourceWord;
        protected PowerEasy.Controls.RequiredFieldValidator ValrTargetWord;

        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            string text = this.TxtSourceWord.Text;
            string str2 = "";
            if (string.IsNullOrEmpty(this.TxtSourceWord.Text))
            {
                str2 = "<li>站内链接目标不能为空!</li>";
            }
            if (!DataValidator.IsUrl(this.TxtTargetWord.Text))
            {
                str2 = str2 + "<li>链接地址不是有效的url地址!</li>";
            }
            if (string.IsNullOrEmpty(this.TxtPriority.Text))
            {
                str2 = str2 + "<li>站内链接优先级别不能为空!</li>";
            }
            if (string.IsNullOrEmpty(this.TxtReplaceTimes.Text))
            {
                str2 = str2 + "<li>站内链接替换次数不能为空!</li>";
            }
            if (!string.IsNullOrEmpty(str2))
            {
                AdminPage.WriteErrMsg(str2);
            }
            WordReplaceInfo wordReplaceInfo = new WordReplaceInfo();
            if (this.ViewState["action"].ToString() == "Add")
            {
                if (!WordReplace.Exists(text, 1))
                {
                    wordReplaceInfo.SourceWord = this.TxtSourceWord.Text;
                    wordReplaceInfo.TargetWord = this.TxtTargetWord.Text;
                    wordReplaceInfo.Title = this.TxtTitle.Text;
                    wordReplaceInfo.ReplaceTimes = DataConverter.CLng(this.TxtReplaceTimes.Text);
                    wordReplaceInfo.Priority = DataConverter.CLng(this.TxtPriority.Text);
                    wordReplaceInfo.OpenType = Convert.ToBoolean(this.RadlOpenType.SelectedValue);
                    wordReplaceInfo.IsEnabled = Convert.ToBoolean(this.RadioIsEnabled.SelectedValue);
                    wordReplaceInfo.ReplaceType = 1;
                    wordReplaceInfo.ScopesType = 0;
                    if (WordReplace.Add(wordReplaceInfo))
                    {
                        AdminPage.WriteSuccessMsg("<li>添加站内链接成功!</li>", "InsideLinkManage.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, 1);
                }
                if (!flag)
                {
                    wordReplaceInfo.ItemId = BasePage.RequestInt32("ItemID");
                    wordReplaceInfo.SourceWord = this.TxtSourceWord.Text;
                    wordReplaceInfo.TargetWord = this.TxtTargetWord.Text;
                    wordReplaceInfo.Title = this.TxtTitle.Text;
                    wordReplaceInfo.ReplaceTimes = DataConverter.CLng(this.TxtReplaceTimes.Text);
                    wordReplaceInfo.Priority = DataConverter.CLng(this.TxtPriority.Text);
                    wordReplaceInfo.OpenType = Convert.ToBoolean(this.RadlOpenType.SelectedValue);
                    wordReplaceInfo.IsEnabled = Convert.ToBoolean(this.RadioIsEnabled.SelectedValue);
                    wordReplaceInfo.ReplaceType = 1;
                    wordReplaceInfo.ScopesType = 0;
                    if (WordReplace.Update(wordReplaceInfo))
                    {
                        AdminPage.WriteSuccessMsg("<li>修改站内链接成功!</li>", "InsideLinkManage.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.TxtTitle.Text = DataSecurity.HtmlDecode(infoById.Title);
                    this.TxtReplaceTimes.Text = infoById.ReplaceTimes.ToString();
                    this.TxtPriority.Text = infoById.Priority.ToString();
                    this.RadlOpenType.SelectedValue = infoById.OpenType.ToString();
                    this.RadioIsEnabled.SelectedValue = infoById.IsEnabled.ToString();
                    this.HdnSource.Value = infoById.SourceWord.ToString();
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -