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 (BasePage.RequestString("Action", "Add") == "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 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>"); } } }