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, 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 = ""; } } } }