private void btnSubmit_Click(object sender, System.EventArgs e) { TextReplyInfo reply = ReplyHelper.GetReply(base.GetUrlIntParam("id")) as TextReplyInfo; if (!string.IsNullOrEmpty(this.txtKeys.Text) && reply.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { reply.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { reply.Keys = this.txtKeys.Text.Trim(); } else { reply.Keys = string.Empty; } reply.Text = this.fcContent.Text.Trim(); reply.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal); reply.ReplyType = ReplyType.None; if (this.chkKeys.Checked) { reply.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { reply.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { reply.ReplyType |= ReplyType.NoMatch; } if (reply.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); } else { if (ReplyHelper.UpdateReply(reply)) { this.ShowMsg("修改成功", true); } else { this.ShowMsg("修改失败", false); } } } }
protected void btnSave_Click(object sender, EventArgs e) { NewsReplyInfo info; int num = Globals.ToNum(this.hdfMessageType.Value); int articleIDByOldArticle = Globals.ToNum(this.hdfArticleID.Value); MessageType msgtype = (MessageType)num; int num3 = Globals.ToNum(this.rbtlMatchType.SelectedValue); if (string.IsNullOrEmpty(this.txtKeys.Text.Trim()) && (this.type != "subscribe")) { this.ShowMsg("请输入关键词!", false); return; } if (this.txtKeys.Text.Trim().Length > 50) { this.ShowMsg("关键词必须少于50个字!", false); return; } if (num3 == 0) { this.ShowMsg("请选择匹配类型!", false); return; } if ((articleIDByOldArticle < 1) && (msgtype != MessageType.Text)) { if (this.hdfIsOldArticle.Value == "0") { this.ShowMsg("请先选择图文!", false); return; } if (this.replyID > 0) { articleIDByOldArticle = ReplyHelper.GetArticleIDByOldArticle(this.replyID, msgtype); } } switch (msgtype) { case MessageType.Text: if (this.fkContent.Text.Length <= 0x3e8) { TextReplyInfo reply = new TextReplyInfo { Keys = this.txtKeys.Text.Trim(), MatchType = (num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch) }; if (reply.Keys == "*") { reply.ReplyType = ReplyType.NoMatch; if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0) { this.ShowMsg("无关键字回复回复内容已存在!", false); return; } } else if (this.type == "subscribe") { if (ReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复内容已存在!", false); return; } reply.ReplyType = ReplyType.Subscribe; reply.Keys = ""; } else { reply.ReplyType = ReplyType.Keys; if (ReplyHelper.HasReplyKey(reply.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } reply.MessageType = msgtype; reply.IsDisable = false; reply.ArticleID = articleIDByOldArticle; string str = Regex.Replace(Regex.Replace(Regex.Replace(this.fkContent.Text, "</?([^>^a^p]*)>", ""), "<img([^>]*)>", ""), "<ul([^>]*)>", ""); reply.Text = str; reply.Id = this.replyID; if (string.IsNullOrEmpty(reply.Text)) { this.ShowMsg("请填写文本内容!", false); return; } if (this.replyID > 0) { ReplyHelper.UpdateReply(reply); } else { ReplyHelper.SaveReply(reply); } goto Label_03D5; } this.ShowMsg("回复内容必须1000字以内!", false); return; case MessageType.News: case MessageType.List: info = new NewsReplyInfo { Keys = this.txtKeys.Text.Trim(), MatchType = (num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch) }; if (!(info.Keys == "*")) { if (this.type == "subscribe") { info.ReplyType = ReplyType.Subscribe; info.Keys = ""; if (ReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复已存在!", false); return; } } else { info.ReplyType = ReplyType.Keys; if (ReplyHelper.HasReplyKey(info.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } break; } info.ReplyType = ReplyType.NoMatch; if (ReplyHelper.GetNoMatchReplyID(this.replyID) <= 0) { break; } this.ShowMsg("无关键词回复已存在!", false); return; default: goto Label_03D5; } info.MessageType = msgtype; info.IsDisable = false; info.ArticleID = articleIDByOldArticle; info.Id = this.replyID; if (num3 < 1) { this.ShowMsg("请选择类型!", false); return; } if (this.replyID > 0) { ReplyHelper.UpdateReply(info); } else { ReplyHelper.SaveReply(info); } Label_03D5: if (this.replyID > 0) { this.ShowMsgAndReUrl("自动回复修改成功!", true, "replyonkey.aspx"); } else { this.ShowMsgAndReUrl("自动回复添加成功!", true, "replyonkey.aspx"); } }
protected void btnSave_Click(object sender, System.EventArgs e) { int num = Globals.ToNum(this.hdfMessageType.Value); int num2 = Globals.ToNum(this.hdfArticleID.Value); MessageType messageType = (MessageType)num; int num3 = Globals.ToNum(this.rbtlMatchType.SelectedValue); if (string.IsNullOrEmpty(this.txtKeys.Text.Trim()) && this.type != "subscribe") { this.ShowMsg("请输入关键词!", false); return; } if (this.txtKeys.Text.Trim().Length > 50) { this.ShowMsg("关键词必须少于50个字!", false); return; } if (num3 == 0) { this.ShowMsg("请选择匹配类型!", false); return; } if (num2 < 1 && messageType != MessageType.Text) { if (this.hdfIsOldArticle.Value == "0") { this.ShowMsg("请先选择图文!", false); return; } if (this.replyID > 0) { num2 = ReplyHelper.GetArticleIDByOldArticle(this.replyID, messageType); } } switch (messageType) { case MessageType.Text: { if (this.fkContent.Text.Length > 1000) { this.ShowMsg("回复内容必须1000字以内!", false); return; } TextReplyInfo textReplyInfo = new TextReplyInfo(); textReplyInfo.Keys = this.txtKeys.Text.Trim(); textReplyInfo.MatchType = ((num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch)); if (textReplyInfo.Keys == "*") { textReplyInfo.ReplyType = ReplyType.NoMatch; if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0) { this.ShowMsg("无关键字回复回复内容已存在!", false); return; } } else if (this.type == "subscribe") { if (ReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复内容已存在!", false); return; } textReplyInfo.ReplyType = ReplyType.Subscribe; textReplyInfo.Keys = ""; } else { textReplyInfo.ReplyType = ReplyType.Keys; if (ReplyHelper.HasReplyKey(textReplyInfo.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } textReplyInfo.MessageType = messageType; textReplyInfo.IsDisable = false; textReplyInfo.ArticleID = num2; string text = this.fkContent.Text; text = System.Text.RegularExpressions.Regex.Replace(text, "</?([^>^a^p]*)>", ""); text = System.Text.RegularExpressions.Regex.Replace(text, "<img([^>]*)>", ""); text = text.Replace("<p>", ""); text = text.Replace("</p>", "\r"); text = text.Trim(new char[] { '\r' }); text = text.Replace("\r", "\r\n"); textReplyInfo.Text = text; textReplyInfo.Id = this.replyID; if (string.IsNullOrEmpty(textReplyInfo.Text)) { this.ShowMsg("请填写文本内容!", false); return; } if (this.replyID > 0) { ReplyHelper.UpdateReply(textReplyInfo); } else { ReplyHelper.SaveReply(textReplyInfo); } break; } case MessageType.News: case MessageType.List: { NewsReplyInfo newsReplyInfo = new NewsReplyInfo(); newsReplyInfo.Keys = this.txtKeys.Text.Trim(); newsReplyInfo.MatchType = ((num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch)); if (newsReplyInfo.Keys == "*") { newsReplyInfo.ReplyType = ReplyType.NoMatch; if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0) { this.ShowMsg("无关键词回复已存在!", false); return; } } else if (this.type == "subscribe") { newsReplyInfo.ReplyType = ReplyType.Subscribe; newsReplyInfo.Keys = ""; if (ReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复已存在!", false); return; } } else { newsReplyInfo.ReplyType = ReplyType.Keys; if (ReplyHelper.HasReplyKey(newsReplyInfo.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } newsReplyInfo.MessageType = messageType; newsReplyInfo.IsDisable = false; newsReplyInfo.ArticleID = num2; newsReplyInfo.Id = this.replyID; if (num3 < 1) { this.ShowMsg("请选择类型!", false); return; } if (this.replyID > 0) { ReplyHelper.UpdateReply(newsReplyInfo); } else { ReplyHelper.SaveReply(newsReplyInfo); } break; } } if (this.replyID > 0) { this.ShowMsgAndReUrl("自动回复修改成功!", true, "replyonkey.aspx"); return; } this.ShowMsgAndReUrl("自动回复添加成功!", true, "replyonkey.aspx"); }
protected void Page_Load(object sender, System.EventArgs e) { if (!int.TryParse(base.Request.QueryString["id"], out this.MaterialID)) { base.Response.Redirect("ReplyOnKey.aspx"); } this.radMatch.Items[0].Text = "模糊匹配"; this.radMatch.Items[1].Text = "精确匹配"; this.radDisable.Items[0].Text = "启用"; this.radDisable.Items[1].Text = "禁用"; this.chkNo.Enabled = (ReplyHelper.GetMismatchReply() == null); this.chkSub.Enabled = (ReplyHelper.GetSubscribeReply() == null); if (!this.chkNo.Enabled) { this.chkNo.ToolTip = "该类型已被使用"; } if (!this.chkSub.Enabled) { this.chkSub.ToolTip = "该类型已被使用"; } if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"])) { if (!string.IsNullOrEmpty(base.Request.Form["MultiArticle"])) { string str = base.Request.Form["MultiArticle"]; System.Collections.Generic.List <ArticleList> list = JsonConvert.DeserializeObject <System.Collections.Generic.List <ArticleList> >(str); if (list != null && list.Count > 0) { NewsReplyInfo reply = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; reply.IsDisable = (base.Request.Form["radDisable"] != "true"); string str2 = base.Request.Form.Get("Keys"); if (base.Request.Form["chkKeys"] == "true") { if (!string.IsNullOrEmpty(str2) && reply.Keys != str2 && ReplyHelper.HasReplyKey(str2)) { base.Response.Write("key"); base.Response.End(); } reply.Keys = str2; } else { reply.Keys = string.Empty; } reply.MatchType = ((base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal); reply.ReplyType = ReplyType.None; if (base.Request.Form["chkKeys"] == "true") { reply.ReplyType |= ReplyType.Keys; } if (base.Request.Form["chkSub"] == "true") { reply.ReplyType |= ReplyType.Subscribe; } if (base.Request.Form["chkNo"] == "true") { reply.ReplyType |= ReplyType.NoMatch; } foreach (NewsMsgInfo info2 in reply.NewsMsg) { ReplyHelper.DeleteNewsMsg(info2.Id); } System.Collections.Generic.List <NewsMsgInfo> list2 = new System.Collections.Generic.List <NewsMsgInfo>(); foreach (ArticleList list3 in list) { if (list3.Status != "del") { NewsMsgInfo item = list3; if (item != null) { item.Reply = reply; list2.Add(item); } } } reply.NewsMsg = list2; if (ReplyHelper.UpdateReply(reply)) { base.Response.Write("true"); base.Response.End(); } } } } else { NewsReplyInfo info3 = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; if (info3 != null) { System.Collections.Generic.List <ArticleList> list4 = new System.Collections.Generic.List <ArticleList>(); if (info3.NewsMsg != null && info3.NewsMsg.Count > 0) { int num = 1; foreach (NewsMsgInfo info4 in info3.NewsMsg) { ArticleList list5 = new ArticleList { PicUrl = info4.PicUrl, Title = info4.Title, Url = info4.Url, Description = info4.Description, Content = info4.Content }; list5.BoxId = num++.ToString(); list5.Status = ""; list4.Add(list5); } this.articleJson = JsonConvert.SerializeObject(list4); } this.fkContent.Text = info3.NewsMsg[0].Content; this.txtKeys.Text = info3.Keys; this.radMatch.SelectedValue = (info3.MatchType == MatchType.Like); this.radDisable.SelectedValue = !info3.IsDisable; this.chkKeys.Checked = (ReplyType.Keys == (info3.ReplyType & ReplyType.Keys)); this.chkSub.Checked = (ReplyType.Subscribe == (info3.ReplyType & ReplyType.Subscribe)); this.chkNo.Checked = (ReplyType.NoMatch == (info3.ReplyType & ReplyType.NoMatch)); if (this.chkNo.Checked) { this.chkNo.Enabled = true; this.chkNo.ToolTip = ""; } if (this.chkSub.Checked) { this.chkSub.Enabled = true; this.chkSub.ToolTip = ""; } } } }
protected void Page_Load(object sender, System.EventArgs e) { if (!int.TryParse(base.Request.QueryString["id"], out this.MaterialID)) { base.Response.Redirect("ReplyOnKey.aspx"); } this.radMatch.Items[0].Text = "模糊匹配"; this.radMatch.Items[1].Text = "精确匹配"; this.radDisable.Items[0].Text = "启用"; this.radDisable.Items[1].Text = "禁用"; this.chkNo.Enabled = (ReplyHelper.GetMismatchReply() == null); this.chkSub.Enabled = (ReplyHelper.GetSubscribeReply() == null); if (!this.chkNo.Enabled) { this.chkNo.ToolTip = "该类型已被使用"; } if (!this.chkSub.Enabled) { this.chkSub.ToolTip = "该类型已被使用"; } if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"])) { if (!string.IsNullOrEmpty(base.Request.Form["MultiArticle"])) { string value = base.Request.Form["MultiArticle"]; System.Collections.Generic.List <ArticleList> list = JsonConvert.DeserializeObject(value, typeof(System.Collections.Generic.List <ArticleList>)) as System.Collections.Generic.List <ArticleList>; if (list != null && list.Count > 0) { NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; newsReplyInfo.IsDisable = (base.Request.Form["radDisable"] != "true"); string text = base.Request.Form.Get("Keys"); if (base.Request.Form["chkKeys"] == "true") { if (!string.IsNullOrEmpty(text) && newsReplyInfo.Keys != text && ReplyHelper.HasReplyKey(text)) { base.Response.Write("key"); base.Response.End(); } newsReplyInfo.Keys = text; } else { newsReplyInfo.Keys = string.Empty; } newsReplyInfo.MatchType = ((base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal); newsReplyInfo.ReplyType = ReplyType.None; if (base.Request.Form["chkKeys"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (base.Request.Form["chkSub"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (base.Request.Form["chkNo"] == "true") { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } foreach (NewsMsgInfo current in newsReplyInfo.NewsMsg) { ReplyHelper.DeleteNewsMsg(current.Id); } System.Collections.Generic.List <NewsMsgInfo> list2 = new System.Collections.Generic.List <NewsMsgInfo>(); foreach (ArticleList current2 in list) { if (current2.Status != "del") { NewsMsgInfo newsMsgInfo = current2; if (newsMsgInfo != null) { newsMsgInfo.Reply = newsReplyInfo; list2.Add(newsMsgInfo); } } } newsReplyInfo.NewsMsg = list2; if (ReplyHelper.UpdateReply(newsReplyInfo)) { base.Response.Write("true"); base.Response.End(); return; } } } } else { NewsReplyInfo newsReplyInfo2 = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; if (newsReplyInfo2 != null) { System.Collections.Generic.List <ArticleList> list3 = new System.Collections.Generic.List <ArticleList>(); if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0) { int num = 1; foreach (NewsMsgInfo current3 in newsReplyInfo2.NewsMsg) { list3.Add(new ArticleList { PicUrl = current3.PicUrl, Title = current3.Title, Url = current3.Url, Description = current3.Description, Content = current3.Content, BoxId = num++.ToString(), Status = "" }); } this.articleJson = JsonConvert.SerializeObject(list3); } this.fkContent.Text = newsReplyInfo2.NewsMsg[0].Content; this.txtKeys.Text = newsReplyInfo2.Keys; this.radMatch.SelectedValue = (newsReplyInfo2.MatchType == MatchType.Like); this.radDisable.SelectedValue = !newsReplyInfo2.IsDisable; this.chkKeys.Checked = (ReplyType.Keys == (newsReplyInfo2.ReplyType & ReplyType.Keys)); this.chkSub.Checked = (ReplyType.Subscribe == (newsReplyInfo2.ReplyType & ReplyType.Subscribe)); this.chkNo.Checked = (ReplyType.NoMatch == (newsReplyInfo2.ReplyType & ReplyType.NoMatch)); if (this.chkNo.Checked) { this.chkNo.Enabled = true; this.chkNo.ToolTip = ""; } if (this.chkSub.Checked) { this.chkSub.Enabled = true; this.chkSub.ToolTip = ""; } } } }
protected void btnCreate_Click(object sender, EventArgs e) { if ((string.IsNullOrEmpty(this.Tbtitle.Text) || string.IsNullOrEmpty(this.Tbdescription.Text)) || string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("您填写的信息不完整!", false); } else { NewsReplyInfo reply = ReplyHelper.GetReply(base.GetUrlIntParam("id")) as NewsReplyInfo; if (((reply == null) || (reply.NewsMsg == null)) || (reply.NewsMsg.Count == 0)) { base.GotoResourceNotFound(); } else if ((!string.IsNullOrEmpty(this.txtKeys.Text) && (reply.Keys != this.txtKeys.Text.Trim())) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim(), this.wid)) { this.ShowMsg("关键字重复!", false); } else { reply.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { reply.Keys = this.txtKeys.Text.Trim(); } else { reply.Keys = string.Empty; } reply.MatchType = this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal; reply.ReplyType = ReplyType.None; if (this.chkKeys.Checked) { reply.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { reply.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { reply.ReplyType |= ReplyType.NoMatch; } if (reply.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); } else if (string.IsNullOrEmpty(this.Tbtitle.Text)) { this.ShowMsg("请输入标题", false); } else if (string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("请上传封面图", false); } else if (string.IsNullOrEmpty(this.Tbdescription.Text)) { this.ShowMsg("请输入摘要", false); } else if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text)) { this.ShowMsg("请输入内容或自定义链接", false); } else { reply.NewsMsg[0].Content = this.fkContent.Text; reply.NewsMsg[0].Description = this.Tbdescription.Text; reply.NewsMsg[0].PicUrl = this.hdpic.Value; reply.NewsMsg[0].Title = this.Tbtitle.Text; reply.NewsMsg[0].Url = this.TbUrl.Text; if (ReplyHelper.UpdateReply(reply)) { this.ShowMsg("修改成功", true); } else { this.ShowMsg("修改失败", false); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(base.Request.QueryString["id"], out this.MaterialID)) { base.Response.Redirect("ReplyOnKey.aspx"); } this.radMatch.Items[0].Text = "模糊匹配"; this.radMatch.Items[1].Text = "精确匹配"; this.radDisable.Items[0].Text = "启用"; this.radDisable.Items[1].Text = "禁用"; this.chkNo.Enabled = (ReplyHelper.GetMismatchReply() == null); this.chkSub.Enabled = (ReplyHelper.GetSubscribeReply() == null); if (!this.chkNo.Enabled) { this.chkNo.ToolTip = "该类型已被使用"; } if (!this.chkSub.Enabled) { this.chkSub.ToolTip = "该类型已被使用"; } if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"])) { if (!string.IsNullOrEmpty(base.Request.Form["MultiArticle"])) { string value = base.Request.Form["MultiArticle"]; List <ArticleList> list = JsonConvert.DeserializeObject(value, typeof(List <ArticleList>)) as List <ArticleList>; if (list != null && list.Count > 0) { NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; newsReplyInfo.IsDisable = (base.Request.Form["radDisable"] != "true"); string text = base.Request.Form.Get("Keys"); if (base.Request.Form["chkKeys"] == "true") { if (!string.IsNullOrEmpty(text) && newsReplyInfo.Keys != text && ReplyHelper.HasReplyKey(text)) { base.Response.Write("key"); base.Response.End(); } newsReplyInfo.Keys = text; } else { newsReplyInfo.Keys = string.Empty; } newsReplyInfo.MatchType = ((base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal); newsReplyInfo.ReplyType = ReplyType.None; if (base.Request.Form["chkKeys"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (base.Request.Form["chkSub"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (base.Request.Form["chkNo"] == "true") { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } foreach (NewsMsgInfo item in newsReplyInfo.NewsMsg) { ReplyHelper.DeleteNewsMsg(item.Id); } List <NewsMsgInfo> list2 = new List <NewsMsgInfo>(); foreach (ArticleList item2 in list) { if (item2.Status != "del") { NewsMsgInfo newsMsgInfo = item2; if (newsMsgInfo != null) { newsMsgInfo.Reply = newsReplyInfo; list2.Add(newsMsgInfo); } } } newsReplyInfo.NewsMsg = list2; foreach (NewsMsgInfo item3 in newsReplyInfo.NewsMsg) { item3.PicUrl = Globals.SaveFile("article", item3.PicUrl, "/Storage/master/", true, false, ""); } if (ReplyHelper.UpdateReply(newsReplyInfo)) { base.Response.Write("true"); base.Response.End(); } } } } else { NewsReplyInfo newsReplyInfo2 = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; if (newsReplyInfo2 != null) { List <ArticleList> list3 = new List <ArticleList>(); if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0) { int num = 1; foreach (NewsMsgInfo item4 in newsReplyInfo2.NewsMsg) { ArticleList articleList = new ArticleList(); articleList.PicUrl = item4.PicUrl; articleList.Title = item4.Title; articleList.Url = item4.Url; articleList.Description = item4.Description; articleList.Content = item4.Content; ArticleList articleList2 = articleList; int num2 = num; num = num2 + 1; articleList2.BoxId = num2.ToString(); articleList.Status = ""; list3.Add(articleList); } this.articleJson = JsonConvert.SerializeObject(list3); } this.fkContent.Text = newsReplyInfo2.NewsMsg[0].Content; this.txtKeys.Text = newsReplyInfo2.Keys; this.radMatch.SelectedValue = (newsReplyInfo2.MatchType == MatchType.Like); this.radDisable.SelectedValue = !newsReplyInfo2.IsDisable; this.chkKeys.Checked = (ReplyType.Keys == (newsReplyInfo2.ReplyType & ReplyType.Keys)); this.chkSub.Checked = (ReplyType.Subscribe == (newsReplyInfo2.ReplyType & ReplyType.Subscribe)); this.chkNo.Checked = (ReplyType.NoMatch == (newsReplyInfo2.ReplyType & ReplyType.NoMatch)); if (this.chkNo.Checked) { this.chkNo.Enabled = true; this.chkNo.ToolTip = ""; } if (this.chkSub.Checked) { this.chkSub.Enabled = true; this.chkSub.ToolTip = ""; } } } }
protected void btnCreate_Click(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(this.Tbtitle.Text) || string.IsNullOrEmpty(this.Tbdescription.Text) || string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("您填写的信息不完整!", false); return; } int urlIntParam = base.GetUrlIntParam("id"); NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(urlIntParam) as NewsReplyInfo; if (newsReplyInfo == null || newsReplyInfo.NewsMsg == null || newsReplyInfo.NewsMsg.Count == 0) { base.GotoResourceNotFound(); return; } if (!string.IsNullOrEmpty(this.txtKeys.Text) && newsReplyInfo.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); return; } newsReplyInfo.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { newsReplyInfo.Keys = this.txtKeys.Text.Trim(); } else { newsReplyInfo.Keys = string.Empty; } newsReplyInfo.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal); newsReplyInfo.ReplyType = ReplyType.None; if (this.chkKeys.Checked) { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } if (newsReplyInfo.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); return; } if (string.IsNullOrEmpty(this.Tbtitle.Text)) { this.ShowMsg("请输入标题", false); return; } if (string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("请上传封面图", false); return; } if (string.IsNullOrEmpty(this.Tbdescription.Text)) { this.ShowMsg("请输入摘要", false); return; } if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text)) { this.ShowMsg("请输入内容或自定义链接", false); return; } newsReplyInfo.NewsMsg[0].Content = this.fkContent.Text; newsReplyInfo.NewsMsg[0].Description = this.Tbdescription.Text; newsReplyInfo.NewsMsg[0].PicUrl = this.hdpic.Value; newsReplyInfo.NewsMsg[0].Title = this.Tbtitle.Text; newsReplyInfo.NewsMsg[0].Url = this.TbUrl.Text; if (ReplyHelper.UpdateReply(newsReplyInfo)) { this.ShowMsg("修改成功", true); return; } this.ShowMsg("修改失败", false); }
protected void btnCreate_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Tbtitle.Text) || string.IsNullOrEmpty(this.Tbdescription.Text) || string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("您填写的信息不完整!", false); } else { int urlIntParam = base.GetUrlIntParam("id"); NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(urlIntParam) as NewsReplyInfo; if (newsReplyInfo == null || newsReplyInfo.NewsMsg == null || newsReplyInfo.NewsMsg.Count == 0) { base.GotoResourceNotFound(); } else if (!string.IsNullOrEmpty(this.txtKeys.Text) && newsReplyInfo.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { newsReplyInfo.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { newsReplyInfo.Keys = this.txtKeys.Text.Trim(); } else { newsReplyInfo.Keys = string.Empty; } newsReplyInfo.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal); newsReplyInfo.ReplyType = ReplyType.None; if (this.chkKeys.Checked) { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } if (newsReplyInfo.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); } else { string text = ""; if (string.IsNullOrEmpty(this.Tbtitle.Text)) { this.ShowMsg("请输入标题", false); } else if (string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("请上传封面图", false); } else if (string.IsNullOrEmpty(this.Tbdescription.Text)) { this.ShowMsg("请输入摘要", false); } else { if (this.chkSub.Checked) { if (this.ddlsubType.SelectedValue == "0") { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrltoSub.Text)) { this.ShowMsg("请输入内容或自定义链接", false); return; } text = this.TbUrltoSub.Text; } else { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.ddlCoupon.SelectedValue)) { this.ShowMsg("请输入内容或选择优惠券", false); return; } text = "http://" + HttpContext.Current.Request.Url.Host + "/Vshop/ShakeCouponsForAttention.aspx?cid=" + this.ddlCoupon.SelectedValue; } } else { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text)) { this.ShowMsg("请输入内容或自定义链接", false); return; } text = this.TbUrl.Text; } string picUrl = Globals.SaveFile("reply", this.hdpic.Value, "/Storage/master/", true, false, ""); newsReplyInfo.NewsMsg[0].Content = this.fkContent.Text; newsReplyInfo.NewsMsg[0].Description = this.Tbdescription.Text; newsReplyInfo.NewsMsg[0].PicUrl = picUrl; newsReplyInfo.NewsMsg[0].Title = this.Tbtitle.Text; newsReplyInfo.NewsMsg[0].Url = text; if (ReplyHelper.UpdateReply(newsReplyInfo)) { this.ShowMsg("修改成功", true, "ReplyOnKey.aspx"); } else { this.ShowMsg("修改失败", false); } } } } } }