Esempio n. 1
0
        private bool CreateVshopKeyReply(long voteId, string picUrl)
        {
            NewsReplyInfo newsReplyInfo = new NewsReplyInfo();

            newsReplyInfo.IsDisable = false;
            if (!string.IsNullOrWhiteSpace(this.txtKeys.Text))
            {
                newsReplyInfo.Keys = this.txtKeys.Text.Trim();
            }
            newsReplyInfo.MatchType   = MatchType.Like;
            newsReplyInfo.MessageType = MessageType.News;
            newsReplyInfo.ReplyType   = ReplyType.Keys;
            NewsMsgInfo item = new NewsMsgInfo
            {
                Reply       = newsReplyInfo,
                Content     = this.txtAddVoteName.Text,
                Description = this.txtAddVoteName.Text,
                Title       = this.txtAddVoteName.Text,
                Url         = base.Request.Url.Authority + "/vshop/Vote.aspx?voteId=" + voteId,
                PicUrl      = picUrl
            };

            newsReplyInfo.NewsMsg = new List <NewsMsgInfo>();
            newsReplyInfo.NewsMsg.Add(item);
            return(ReplyHelper.SaveReply(newsReplyInfo));
        }
Esempio n. 2
0
        public ActionResult EditSingleTextImageReply(string id)
        {
            var reply     = _svc.GetReply(id);
            var firstNews = _svc.GetNewsReplyInfo(reply.Id).FirstOrDefault();

            if (firstNews == null)
            {
                firstNews = new NewsMsgInfo();
            }

            AddNewsMsgInfo model = new AddNewsMsgInfo();

            model.Reply = _mapper.Map <NewsReplyInfo>(reply);

            model.Content     = firstNews.Content;
            model.Description = firstNews.Description;
            model.Id          = firstNews.Id;
            model.Title       = firstNews.Title;
            model.Url         = firstNews.Url;
            model.PicUrl      = firstNews.PicUrl;

            // allow login reply
            model.AllowSubscribeReply = getCanChangeSubscribeReply();
            model.AllowNoMatchReply   = getCanChangeNoMatchReply();

            model.Setup();

            return(View(model));
        }
Esempio n. 3
0
        private NewsMsgInfo ReaderBindNewsRelpy(IDataReader dataReader)
        {
            NewsMsgInfo info = new NewsMsgInfo();
            object      obj2 = dataReader["MsgID"];

            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.Id = (int)obj2;
            }
            obj2 = dataReader["Title"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.Title = dataReader["Title"].ToString();
            }
            obj2 = dataReader["ImageUrl"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.PicUrl = dataReader["ImageUrl"].ToString();
            }
            obj2 = dataReader["Url"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.Url = dataReader["Url"].ToString();
            }
            obj2 = dataReader["Description"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.Description = dataReader["Description"].ToString();
            }
            obj2 = dataReader["Content"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.Content = dataReader["Content"].ToString();
            }
            info.wid = dataReader["wid"].ToString();
            return(info);
        }
Esempio n. 4
0
        private NewsMsgInfo ReaderBindNewsRelpy(System.Data.IDataReader dataReader)
        {
            NewsMsgInfo newsMsgInfo = new NewsMsgInfo();
            object      obj         = dataReader["MsgID"];

            if (obj != null && obj != DBNull.Value)
            {
                newsMsgInfo.Id = (int)obj;
            }
            obj = dataReader["Title"];
            if (obj != null && obj != DBNull.Value)
            {
                newsMsgInfo.Title = dataReader["Title"].ToString();
            }
            obj = dataReader["ImageUrl"];
            if (obj != null && obj != DBNull.Value)
            {
                newsMsgInfo.PicUrl = dataReader["ImageUrl"].ToString();
            }
            obj = dataReader["Url"];
            if (obj != null && obj != DBNull.Value)
            {
                newsMsgInfo.Url = dataReader["Url"].ToString();
            }
            obj = dataReader["Description"];
            if (obj != null && obj != DBNull.Value)
            {
                newsMsgInfo.Description = dataReader["Description"].ToString();
            }
            obj = dataReader["Content"];
            if (obj != null && obj != DBNull.Value)
            {
                newsMsgInfo.Content = dataReader["Content"].ToString();
            }
            return(newsMsgInfo);
        }
Esempio n. 5
0
 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))
     {
         if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
         {
             this.ShowMsg("关键字重复!", false);
         }
         else
         {
             NewsReplyInfo reply = new NewsReplyInfo
             {
                 IsDisable = !this.radDisable.SelectedValue
             };
             if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text))
             {
                 reply.Keys = this.txtKeys.Text.Trim();
             }
             if (this.chkKeys.Checked && string.IsNullOrWhiteSpace(this.txtKeys.Text))
             {
                 this.ShowMsg("你选择了关键字回复,必须填写关键字!", false);
             }
             else
             {
                 reply.MatchType   = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal);
                 reply.MessageType = MessageType.News;
                 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
                                 {
                                     NewsMsgInfo item = new NewsMsgInfo
                                     {
                                         Reply       = reply,
                                         Content     = this.fkContent.Text,
                                         Description = System.Web.HttpUtility.HtmlEncode(this.Tbdescription.Text),
                                         PicUrl      = this.hdpic.Value,
                                         Title       = System.Web.HttpUtility.HtmlEncode(this.Tbtitle.Text),
                                         Url         = this.TbUrl.Text.Trim()
                                     };
                                     reply.NewsMsg = new System.Collections.Generic.List <NewsMsgInfo>();
                                     reply.NewsMsg.Add(item);
                                     if (ReplyHelper.SaveReply(reply))
                                     {
                                         this.ShowMsg("添加成功", true);
                                     }
                                     else
                                     {
                                         this.ShowMsg("添加失败", false);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     else
     {
         this.ShowMsg("您填写的信息不完整!", false);
     }
 }
Esempio n. 6
0
 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 = "";
             }
         }
     }
 }
Esempio n. 7
0
 protected void btnCreate_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.Tbtitle.Text) && !string.IsNullOrEmpty(this.Tbdescription.Text) && !string.IsNullOrEmpty(this.hdpic.Value))
     {
         if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
         {
             this.ShowMsg("关键字重复!", false);
         }
         else
         {
             NewsReplyInfo newsReplyInfo = new NewsReplyInfo();
             string        text          = "";
             newsReplyInfo.IsDisable = !this.radDisable.SelectedValue;
             if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text))
             {
                 newsReplyInfo.Keys = this.txtKeys.Text.Trim();
             }
             if (this.chkKeys.Checked && string.IsNullOrWhiteSpace(this.txtKeys.Text))
             {
                 this.ShowMsg("你选择了关键字回复,必须填写关键字!", false);
             }
             else
             {
                 newsReplyInfo.MatchType   = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal);
                 newsReplyInfo.MessageType = MessageType.News;
                 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 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, "");
                     NewsMsgInfo item   = new NewsMsgInfo
                     {
                         Reply       = newsReplyInfo,
                         Content     = this.fkContent.Text,
                         Description = HttpUtility.HtmlEncode(this.Tbdescription.Text),
                         PicUrl      = picUrl,
                         Title       = HttpUtility.HtmlEncode(this.Tbtitle.Text),
                         Url         = text.Trim()
                     };
                     newsReplyInfo.NewsMsg = new List <NewsMsgInfo>();
                     newsReplyInfo.NewsMsg.Add(item);
                     if (ReplyHelper.SaveReply(newsReplyInfo))
                     {
                         this.ShowMsg("添加成功", true, "ReplyOnKey.aspx");
                     }
                     else
                     {
                         this.ShowMsg("添加失败", false);
                     }
                 }
             }
         }
     }
     else
     {
         this.ShowMsg("您填写的信息不完整!", false);
     }
 }
Esempio n. 8
0
 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 = "";
             }
         }
     }
 }
Esempio n. 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     wid = GetCurWebId();
     if (string.IsNullOrEmpty(wid))
     {
         return;
     }
     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(this.wid) == null;
     this.chkSub.Enabled           = ReplyHelper.GetSubscribeReply(this.wid) == null;
     if (!this.chkNo.Enabled)
     {
         this.chkNo.ToolTip = "该类型已被使用";
     }
     if (!this.chkSub.Enabled)
     {
         this.chkSub.ToolTip = "该类型已被使用";
     }
     if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"]) && !string.IsNullOrEmpty(base.Request.Form["MultiArticle"]))
     {
         string             str  = base.Request.Form["MultiArticle"];
         List <ArticleList> list = JsonConvert.DeserializeObject <List <ArticleList> >(str);
         if ((list != null) && (list.Count > 0))
         {
             NewsReplyInfo reply = new NewsReplyInfo {
                 MessageType = MessageType.List,
                 IsDisable   = base.Request.Form["radDisable"] != "true"
             };
             if (base.Request.Form["chkKeys"] == "true")
             {
                 reply.Keys = base.Request.Form.Get("Keys");
             }
             if (!string.IsNullOrWhiteSpace(reply.Keys) && ReplyHelper.HasReplyKey(reply.Keys, this.wid))
             {
                 base.Response.Write("key");
                 base.Response.End();
             }
             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;
             }
             List <NewsMsgInfo> list2 = new 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.SaveReply(reply))
             {
                 base.Response.Write("true");
                 base.Response.End();
             }
         }
     }
 }
Esempio n. 10
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            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"]))
            {
                return;
            }
            if (string.IsNullOrEmpty(base.Request.Form["MultiArticle"]))
            {
                return;
            }
            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 = new NewsReplyInfo();
                newsReplyInfo.MessageType = MessageType.List;
                newsReplyInfo.IsDisable   = (base.Request.Form["radDisable"] != "true");
                if (base.Request.Form["chkKeys"] == "true")
                {
                    newsReplyInfo.Keys = base.Request.Form.Get("Keys");
                }
                if (!string.IsNullOrWhiteSpace(newsReplyInfo.Keys) && ReplyHelper.HasReplyKey(newsReplyInfo.Keys))
                {
                    base.Response.Write("key");
                    base.Response.End();
                }
                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;
                }
                System.Collections.Generic.List <NewsMsgInfo> list2 = new System.Collections.Generic.List <NewsMsgInfo>();
                foreach (ArticleList current in list)
                {
                    if (current.Status != "del")
                    {
                        NewsMsgInfo newsMsgInfo = current;
                        if (newsMsgInfo != null)
                        {
                            newsMsgInfo.Reply = newsReplyInfo;
                            list2.Add(newsMsgInfo);
                        }
                    }
                }
                newsReplyInfo.NewsMsg = list2;
                if (ReplyHelper.SaveReply(newsReplyInfo))
                {
                    base.Response.Write("true");
                    base.Response.End();
                }
            }
        }
Esempio n. 11
0
 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 = "";
             }
         }
     }
 }
Esempio n. 12
0
		protected void Page_Load(object sender, EventArgs e)
		{
			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"]) && !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 = new NewsReplyInfo();
					newsReplyInfo.MessageType = MessageType.List;
					newsReplyInfo.IsDisable = (base.Request.Form["radDisable"] != "true");
					if (base.Request.Form["chkKeys"] == "true")
					{
						newsReplyInfo.Keys = base.Request.Form.Get("Keys");
					}
					if (!string.IsNullOrWhiteSpace(newsReplyInfo.Keys) && ReplyHelper.HasReplyKey(newsReplyInfo.Keys))
					{
						base.Response.Write("key");
						base.Response.End();
					}
					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;
					}
					List<NewsMsgInfo> list2 = new List<NewsMsgInfo>();
					foreach (ArticleList item in list)
					{
						if (item.Status != "del")
						{
							NewsMsgInfo newsMsgInfo = item;
							if (newsMsgInfo != null)
							{
								newsMsgInfo.Reply = newsReplyInfo;
								list2.Add(newsMsgInfo);
							}
						}
					}
					newsReplyInfo.NewsMsg = list2;
					foreach (NewsMsgInfo item2 in newsReplyInfo.NewsMsg)
					{
						item2.PicUrl = Globals.SaveFile("article", item2.PicUrl, "/Storage/master/", true, false, "");
					}
					if (ReplyHelper.SaveReply(newsReplyInfo))
					{
						base.Response.Write("true");
						base.Response.End();
					}
				}
			}
		}