Beispiel #1
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            int      menuId = System.Convert.ToInt32(clickEventRequest.EventKey);
            MenuInfo menu   = VShopHelper.GetMenu(menuId);

            if (menu == null)
            {
                return(null);
            }
            ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId);

            if (reply == null)
            {
                return(null);
            }
            //if (reply.ReplyType == ReplyType.Kefu)不合法
            //{
            //    this.GotoManyCustomerService(clickEventRequest);
            //}
            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(clickEventRequest);
            }
            response.ToUserName   = clickEventRequest.FromUserName;
            response.FromUserName = clickEventRequest.ToUserName;
            return(response);
        }
Beispiel #2
0
        protected void BindSingleArticle(int id)
        {
            NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(id) as NewsReplyInfo;

            if (newsReplyInfo == null || newsReplyInfo.NewsMsg == null || newsReplyInfo.NewsMsg.Count == 0)
            {
                base.GotoResourceNotFound();
                return;
            }
            this.ViewState["MsgId"]       = newsReplyInfo.Id;
            this.txtKeys.Text             = newsReplyInfo.Keys;
            this.radMatch.SelectedValue   = (newsReplyInfo.MatchType == MatchType.Like);
            this.radDisable.SelectedValue = !newsReplyInfo.IsDisable;
            this.chkKeys.Checked          = (ReplyType.Keys == (newsReplyInfo.ReplyType & ReplyType.Keys));
            this.chkSub.Checked           = (ReplyType.Subscribe == (newsReplyInfo.ReplyType & ReplyType.Subscribe));
            this.chkNo.Checked            = (ReplyType.NoMatch == (newsReplyInfo.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 = "";
            }
            this.Tbtitle.Text       = newsReplyInfo.NewsMsg[0].Title;
            this.LbimgTitle.Text    = newsReplyInfo.NewsMsg[0].Title;
            this.Tbdescription.Text = System.Web.HttpUtility.HtmlDecode(newsReplyInfo.NewsMsg[0].Description);
            this.fkContent.Text     = newsReplyInfo.NewsMsg[0].Content;
            this.Lbmsgdesc.Text     = newsReplyInfo.NewsMsg[0].Description;
            this.TbUrl.Text         = newsReplyInfo.NewsMsg[0].Url;
            this.uploadpic.Src      = newsReplyInfo.NewsMsg[0].PicUrl;
            this.hdpic.Value        = newsReplyInfo.NewsMsg[0].PicUrl;
        }
Beispiel #3
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            WeiXinHelper.UpdateRencentOpenID(clickEventRequest.FromUserName);
            Hidistro.Entities.VShop.MenuInfo menu = VShopHelper.GetMenu(Convert.ToInt32(clickEventRequest.EventKey));
            if (menu == null)
            {
                return(null);
            }
            Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId);
            if (reply == null)
            {
                return(null);
            }
            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(clickEventRequest);
            }
            response.ToUserName   = clickEventRequest.FromUserName;
            response.FromUserName = clickEventRequest.ToUserName;
            return(response);
        }
Beispiel #4
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            int      num      = clickEventRequest.EventKey.ToInt(0);
            MenuInfo menuInfo = null;

            if (num > 0)
            {
                menuInfo = VShopHelper.GetMenu(num);
            }
            if (menuInfo == null)
            {
                return(null);
            }
            ReplyInfo reply = ReplyHelper.GetReply(menuInfo.ReplyId);

            if (reply == null)
            {
                return(null);
            }
            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName, null);

            if (response == null)
            {
                return(this.GotoManyCustomerService(clickEventRequest));
            }
            response.ToUserName   = clickEventRequest.FromUserName;
            response.FromUserName = clickEventRequest.ToUserName;
            return(response);
        }
        protected void BindSingleArticle(int id)
        {
            NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(id) as NewsReplyInfo;

            if (newsReplyInfo == null || newsReplyInfo.NewsMsg == null || newsReplyInfo.NewsMsg.Count == 0)
            {
                base.GotoResourceNotFound();
            }
            else
            {
                this.ViewState["MsgId"]       = newsReplyInfo.ReplyId;
                this.txtKeys.Text             = newsReplyInfo.Keys;
                this.radMatch.SelectedValue   = (newsReplyInfo.MatchType == MatchType.Like);
                this.radDisable.SelectedValue = !newsReplyInfo.IsDisable;
                this.chkKeys.Checked          = (ReplyType.Keys == (newsReplyInfo.ReplyType & ReplyType.Keys));
                this.chkSub.Checked           = (ReplyType.Subscribe == (newsReplyInfo.ReplyType & ReplyType.Subscribe));
                this.chkNo.Checked            = (ReplyType.NoMatch == (newsReplyInfo.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 = "";
                }
                this.Tbtitle.Text       = newsReplyInfo.NewsMsg[0].Title;
                this.LbimgTitle.Text    = newsReplyInfo.NewsMsg[0].Title;
                this.Tbdescription.Text = HttpUtility.HtmlDecode(newsReplyInfo.NewsMsg[0].Description);
                this.fkContent.Text     = newsReplyInfo.NewsMsg[0].Content;
                this.Lbmsgdesc.Text     = newsReplyInfo.NewsMsg[0].Description;
                this.uploadpic.Src      = newsReplyInfo.NewsMsg[0].PicUrl;
                this.hdpic.Value        = newsReplyInfo.NewsMsg[0].PicUrl;
                string url = newsReplyInfo.NewsMsg[0].Url;
                if (this.chkSub.Checked)
                {
                    if (url.ToNullString().ToLower().Contains("http://" + HttpContext.Current.Request.Url.Host + "/vshop/shakecouponsforattention.aspx?cid="))
                    {
                        this.ddlsubType.SelectedValue = "1";
                        this.ddlCoupon.SelectedValue  = url.ToNullString().ToLower().Replace("http://" + HttpContext.Current.Request.Url.Host + "/vshop/shakecouponsforattention.aspx?cid=", "");
                    }
                    else
                    {
                        this.ddlsubType.SelectedValue = "0";
                        this.TbUrltoSub.Text          = url;
                    }
                }
                else
                {
                    this.TbUrl.Text = url;
                }
            }
        }
Beispiel #6
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.btnAdd.Click            += new System.EventHandler(this.btnSubmit_Click);
     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 (!base.IsPostBack)
     {
         int           urlIntParam   = base.GetUrlIntParam("id");
         TextReplyInfo textReplyInfo = ReplyHelper.GetReply(urlIntParam) as TextReplyInfo;
         if (textReplyInfo == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         this.fcContent.Text           = textReplyInfo.Text;
         this.txtKeys.Text             = textReplyInfo.Keys;
         this.radMatch.SelectedValue   = (textReplyInfo.MatchType == MatchType.Like);
         this.radDisable.SelectedValue = !textReplyInfo.IsDisable;
         this.chkKeys.Checked          = (ReplyType.Keys == (textReplyInfo.ReplyType & ReplyType.Keys));
         this.chkSub.Checked           = (ReplyType.Subscribe == (textReplyInfo.ReplyType & ReplyType.Subscribe));
         this.chkNo.Checked            = (ReplyType.NoMatch == (textReplyInfo.ReplyType & ReplyType.NoMatch));
         this.chkKefu.Checked          = (ReplyType.Kefu == textReplyInfo.ReplyType);
         if (this.chkNo.Checked)
         {
             this.chkNo.Enabled = true;
             this.chkNo.ToolTip = "";
         }
         if (this.chkSub.Checked)
         {
             this.chkSub.Enabled = true;
             this.chkSub.ToolTip = "";
         }
         if (this.chkKefu.Checked)
         {
             this.chkKeys.Checked = false;
             this.chkSub.Checked  = false;
             this.chkNo.Checked   = false;
         }
     }
 }
Beispiel #7
0
        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 Page_Load(object sender, EventArgs e)
 {
     wid = GetCurWebId();
     if (string.IsNullOrEmpty(wid))
     {
         return;
     }
     this.btnAdd.Click            += new EventHandler(this.btnSubmit_Click);
     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 (!base.IsPostBack)
     {
         TextReplyInfo reply = ReplyHelper.GetReply(base.GetUrlIntParam("id")) as TextReplyInfo;
         if (reply == null)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             this.fcContent.Text           = reply.Text;
             this.txtKeys.Text             = reply.Keys;
             this.radMatch.SelectedValue   = reply.MatchType == MatchType.Like;
             this.radDisable.SelectedValue = !reply.IsDisable;
             this.chkKeys.Checked          = ReplyType.Keys == (reply.ReplyType & ReplyType.Keys);
             this.chkSub.Checked           = ReplyType.Subscribe == (reply.ReplyType & ReplyType.Subscribe);
             this.chkNo.Checked            = ReplyType.NoMatch == (reply.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 = "";
             }
         }
     }
 }
Beispiel #9
0
        protected string RenderInfo(object menuIdObj)
        {
            ReplyInfo reply = ReplyHelper.GetReply((int)menuIdObj);
            string    result;

            if (reply != null)
            {
                result = reply.Keys;
            }
            else
            {
                result = string.Empty;
            }
            return(result);
        }
Beispiel #10
0
        private void grdArticleCategories_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            int rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex;
            int num      = (int)this.grdArticleCategories.DataKeys[rowIndex].Value;

            if (e.CommandName == "Delete")
            {
                ReplyHelper.DeleteReply(num);
                base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
                return;
            }
            if (e.CommandName == "Release")
            {
                ReplyHelper.UpdateReplyRelease(num);
                base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
                return;
            }
            if (e.CommandName == "Edit")
            {
                ReplyInfo reply = ReplyHelper.GetReply(num);
                if (reply != null)
                {
                    switch (reply.MessageType)
                    {
                    case MessageType.Text:
                        base.Response.Redirect(string.Format("EditReplyOnKey.aspx?id={0}", num));
                        break;

                    case MessageType.News:
                        base.Response.Redirect(string.Format("EditSingleArticle.aspx?id={0}", num));
                        return;

                    case (MessageType)3:
                        break;

                    case MessageType.List:
                        base.Response.Redirect(string.Format("EditMultiArticle.aspx?id={0}", num));
                        return;

                    default:
                        return;
                    }
                }
            }
        }
Beispiel #11
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            MenuInfo menu = VShopHelper.GetMenu(Convert.ToInt32(clickEventRequest.EventKey));

            if (menu == null)
            {
                return(null);
            }
            //Utils.LogWriter.SaveLog("menu bind:" + menu.Bind);
            //我的二维码
            if (menu.Bind == 9)
            {
                AbstractResponse codeResponse = this.GetQRCodeResponse(clickEventRequest.FromUserName);
                codeResponse.ToUserName   = clickEventRequest.FromUserName;
                codeResponse.FromUserName = clickEventRequest.ToUserName;

                //Utils.LogWriter.SaveLog("返回二维码图片");
                return(codeResponse);
            }

            ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId);

            if (reply == null)
            {
                return(null);
            }
            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(clickEventRequest);
            }
            response.ToUserName   = clickEventRequest.FromUserName;
            response.FromUserName = clickEventRequest.ToUserName;
            return(response);
        }
Beispiel #12
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Globals.ToNum(e.CommandArgument.ToString());

            if (e.CommandName == "Delete")
            {
                ReplyHelper.DeleteReply(id);
                base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
            else if (e.CommandName == "Release")
            {
                ReplyHelper.UpdateReplyRelease(id);
                base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
            else if (e.CommandName == "Edit")
            {
                Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(id);
                if (reply != null)
                {
                    switch (reply.MessageType)
                    {
                    case MessageType.Text:
                        base.Response.Redirect(string.Format("replyedit.aspx?id={0}", id));
                        return;

                    case MessageType.News:
                        base.Response.Redirect(string.Format("replyedit.aspx?id={0}", id));
                        return;

                    case (MessageType.News | MessageType.Text):
                        return;

                    case MessageType.List:
                        base.Response.Redirect(string.Format("replyedit.aspx?id={0}", id));
                        return;
                    }
                }
            }
        }
Beispiel #13
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            MenuInfo         menu = VShopHelper.GetMenu(System.Convert.ToInt32(clickEventRequest.EventKey));
            AbstractResponse result;

            if (menu == null)
            {
                result = null;
            }
            else
            {
                ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId);
                if (reply == null)
                {
                    result = null;
                }
                else
                {
                    AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);
                    if (keyResponse != null)
                    {
                        result = keyResponse;
                    }
                    else
                    {
                        AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName);
                        if (response == null)
                        {
                            this.GotoManyCustomerService(clickEventRequest);
                        }
                        response.ToUserName   = clickEventRequest.FromUserName;
                        response.FromUserName = clickEventRequest.ToUserName;
                        result = response;
                    }
                }
            }
            return(result);
        }
        protected void BindSingleArticle(int id)
        {
            NewsReplyInfo reply = ReplyHelper.GetReply(id) as NewsReplyInfo;

            if (((reply == null) || (reply.NewsMsg == null)) || (reply.NewsMsg.Count == 0))
            {
                base.GotoResourceNotFound();
            }
            else
            {
                this.ViewState["MsgId"]       = reply.Id;
                this.txtKeys.Text             = reply.Keys;
                this.radMatch.SelectedValue   = reply.MatchType == MatchType.Like;
                this.radDisable.SelectedValue = !reply.IsDisable;
                this.chkKeys.Checked          = ReplyType.Keys == (reply.ReplyType & ReplyType.Keys);
                this.chkSub.Checked           = ReplyType.Subscribe == (reply.ReplyType & ReplyType.Subscribe);
                this.chkNo.Checked            = ReplyType.NoMatch == (reply.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 = "";
                }
                this.Tbtitle.Text       = reply.NewsMsg[0].Title;
                this.LbimgTitle.Text    = reply.NewsMsg[0].Title;
                this.Tbdescription.Text = HttpUtility.HtmlDecode(reply.NewsMsg[0].Description);
                this.fkContent.Text     = reply.NewsMsg[0].Content;
                this.Lbmsgdesc.Text     = reply.NewsMsg[0].Description;
                this.TbUrl.Text         = reply.NewsMsg[0].Url;
                this.uploadpic.Src      = reply.NewsMsg[0].PicUrl;
                this.hdpic.Value        = reply.NewsMsg[0].PicUrl;
            }
        }
 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 (this.IsPostBack)
            {
                return;
            }
            if (this.type == "getarticleinfo")
            {
                this.Response.ContentType = "application/json";
                string s         = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                int    articleid = Globals.RequestFormNum("articleid");
                if (articleid > 0)
                {
                    ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(articleid);
                    if (articleInfo != null)
                    {
                        StringBuilder stringBuilder = new StringBuilder();
                        switch (articleInfo.ArticleType)
                        {
                        case ArticleType.News:
                            s = "{\"type\":\"1\",\"articletype\":" + (object)articleInfo.ArticleType + ",\"title\":\"" + this.String2Json(articleInfo.Title) + "\",\"date\":\"" + this.String2Json(articleInfo.PubTime.ToString("M月d日")) + "\",\"imgurl\":\"" + this.String2Json(articleInfo.ImageUrl) + "\",\"memo\":\"" + this.String2Json(articleInfo.Memo) + "\"}";
                            break;

                        case ArticleType.List:
                            foreach (ArticleItemsInfo articleItemsInfo in (IEnumerable <ArticleItemsInfo>)articleInfo.ItemsInfo)
                            {
                                stringBuilder.Append("{\"title\":\"" + this.String2Json(articleItemsInfo.Title) + "\",\"imgurl\":\"" + this.String2Json(articleItemsInfo.ImageUrl) + "\"},");
                            }
                            s = "{\"type\":\"1\",\"articletype\":" + (object)articleInfo.ArticleType + ",\"title\":\"" + this.String2Json(articleInfo.Title) + "\",\"date\":\"" + this.String2Json(articleInfo.PubTime.ToString("M月d日")) + "\",\"imgurl\":\"" + this.String2Json(articleInfo.ImageUrl) + "\",\"items\":[" + ((object)stringBuilder).ToString().Trim(',') + "]}";
                            break;

                        default:
                            s = "{\"type\":\"1\",\"articletype\":" + (object)articleInfo.ArticleType + ",\"title\":\"" + this.String2Json(articleInfo.Title) + "\",\"date\":\"" + this.String2Json(articleInfo.PubTime.ToString("M月d日")) + "\",\"imgurl\":\"" + this.String2Json(articleInfo.ImageUrl) + "\",\"memo\":\"" + this.String2Json(articleInfo.Content) + "\"}";
                            break;
                        }
                    }
                }
                this.Response.Write(s);
                this.Response.End();
            }
            else if (this.type == "postdata")
            {
                this.Response.ContentType = "application/json";
                this.sendID = Globals.RequestFormNum("sendid");
                int    num          = Globals.RequestFormNum("sendtype");
                int    msgType      = Globals.RequestFormNum("msgtype");
                int    articleid    = Globals.RequestFormNum("articleid");
                string title        = Globals.RequestFormStr("title");
                string content      = Globals.RequestFormStr("content");
                int    isoldarticle = Globals.RequestFormNum("isoldarticle");
                string str1         = this.SavePostData(msgType, articleid, title, content, isoldarticle, this.sendID, true);
                string s;
                if (string.IsNullOrEmpty(str1))
                {
                    MessageType messageType = (MessageType)msgType;
                    string      str2        = string.Empty;
                    Articles    Articles    = new Articles();
                    Articles.msgType = "text";
                    string storeUrl = Globals.HostPath(HttpContext.Current.Request.Url);
                    if (messageType == MessageType.List || messageType == MessageType.News)
                    {
                        this.sendID = Globals.ToNum((object)this.SavePostData(msgType, articleid, title, content, isoldarticle, this.sendID, false));
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(articleid);
                        if (articleInfo == null)
                        {
                            this.Response.Write("{\"type\":\"0\",\"tips\":\"素材不存在了\"}");
                            this.Response.End();
                        }
                        Articles = this.GetAlipayArticlesFromArticleInfo(articleInfo, storeUrl);
                    }
                    else
                    {
                        this.sendID   = Globals.ToNum((object)this.SavePostData(msgType, articleid, title, content, isoldarticle, this.sendID, false));
                        Articles.text = new MessageText()
                        {
                            content = Globals.StripHtmlXmlTags(content)
                        };
                    }
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                    if (AlipayFuwuConfig.appId.Length < 15)
                    {
                        AlipayFuwuConfig.CommSetConfig(masterSettings.AlipayAppid, this.Server.MapPath("~/"), "GBK");
                    }
                    if (num == 1)
                    {
                        AlipayMobilePublicMessageTotalSendResponse totalSendResponse = AliOHHelper.TotalSend(Articles);
                        if (!totalSendResponse.IsError && totalSendResponse.Code == "200")
                        {
                            s = "{\"type\":\"1\",\"tips\":\"服务窗群发成功,请于一天后到服务窗后台查询送达结果!\"}";
                            string msgid = "";
                            if (!string.IsNullOrEmpty(totalSendResponse.Data) && totalSendResponse.Data.Length > 50)
                            {
                                msgid = totalSendResponse.Data.Substring(0, 49);
                            }
                            int alypayUserNum = WeiXinHelper.getAlypayUserNum();
                            WeiXinHelper.UpdateMsgId(this.sendID, msgid, 1, alypayUserNum, alypayUserNum, "");
                        }
                        else
                        {
                            s = "{\"type\":\"0\",\"tips\":\"" + totalSendResponse.Msg + "\"}";
                            WeiXinHelper.UpdateMsgId(this.sendID, "", 2, 0, 0, totalSendResponse.Body);
                        }
                    }
                    else
                    {
                        List <string> sendList         = new List <string>();
                        DataTable     rencentAliOpenId = WeiXinHelper.GetRencentAliOpenID();
                        if (rencentAliOpenId != null)
                        {
                            for (int index = 0; index < rencentAliOpenId.Rows.Count; ++index)
                            {
                                sendList.Add(rencentAliOpenId.Rows[index][0].ToString());
                            }
                        }
                        if (sendList.Count > 0)
                        {
                            WeiXinHelper.UpdateMsgId(this.sendID, "", 0, 0, sendList.Count, "");
                            new Thread((ThreadStart)(() =>
                            {
                                try
                                {
                                    bool flag = false;
                                    foreach (string str in sendList)
                                    {
                                        if (str.Length > 16)
                                        {
                                            Articles.toUserId = str;
                                            AlipayMobilePublicMessageCustomSendResponse customSendResponse = AliOHHelper.CustomSend(Articles);
                                            if (customSendResponse != null && customSendResponse.IsError)
                                            {
                                                AliOHHelper.log(customSendResponse.Body);
                                            }
                                            else
                                            {
                                                flag = true;
                                                WeiXinHelper.UpdateAddSendCount(this.sendID, 1, -1);
                                            }
                                            Thread.Sleep(10);
                                        }
                                    }
                                    if (flag)
                                    {
                                        WeiXinHelper.UpdateAddSendCount(this.sendID, 0, 1);
                                    }
                                    else
                                    {
                                        WeiXinHelper.UpdateAddSendCount(this.sendID, 0, 2);
                                    }
                                    Thread.Sleep(10);
                                }
                                catch (Exception ex)
                                {
                                    AliOHHelper.log(((object)ex.Message).ToString());
                                }
                            })).Start();
                            s = "{\"type\":\"1\",\"tips\":\"信息正在后台推送中,请稍后刷新群发列表查看结果\"}";
                        }
                        else
                        {
                            s = "{\"type\":\"0\",\"tips\":\"暂时没有关注的用户可以发送信息\"}";
                        }
                    }
                }
                else
                {
                    s = "{\"type\":\"0\",\"tips\":\"" + str1 + "\"}";
                }
                this.Response.Write(s);
                this.Response.End();
            }
            else
            {
                if (this.sendID > 0)
                {
                    this.hdfSendID.Value = this.sendID.ToString();
                    SendAllInfo sendAllInfo = WeiXinHelper.GetSendAllInfo(this.sendID);
                    if (sendAllInfo != null)
                    {
                        MessageType messageType = sendAllInfo.MessageType;
                        this.hdfMessageType.Value = ((int)sendAllInfo.MessageType).ToString();
                        int articleId = sendAllInfo.ArticleID;
                        this.hdfArticleID.Value = articleId.ToString();
                        this.txtTitle.Text      = sendAllInfo.Title;
                        switch (messageType)
                        {
                        case MessageType.Text:
                            this.fkContent.Text = sendAllInfo.Content;
                            break;

                        case MessageType.News:
                            if (articleId <= 0)
                            {
                                this.hdfIsOldArticle.Value = "1";
                                NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                if (newsReplyInfo != null && newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count != 0)
                                {
                                    this.htmlInfo = "<div class=\"mate-inner\"><h3 id=\"singelTitle\">" + newsReplyInfo.NewsMsg[0].Title + "</h3><span>" + newsReplyInfo.LastEditDate.ToString("M月d日") + "</span><div class=\"mate-img\"><img id=\"img1\" src=\"" + newsReplyInfo.NewsMsg[0].PicUrl + "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">" + newsReplyInfo.NewsMsg[0].Description + "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">&gt;</em></div></div>";
                                    break;
                                }
                                else
                                {
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }

                        case MessageType.List:
                            if (articleId <= 0)
                            {
                                this.hdfIsOldArticle.Value = "1";
                                NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                if (newsReplyInfo != null)
                                {
                                    StringBuilder stringBuilder = new StringBuilder();
                                    if (newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count > 0)
                                    {
                                        int num = 0;
                                        foreach (NewsMsgInfo newsMsgInfo in (IEnumerable <NewsMsgInfo>)newsReplyInfo.NewsMsg)
                                        {
                                            ++num;
                                            if (num == 1)
                                            {
                                                stringBuilder.Append("<div class=\"mate-inner top\">                 <div class=\"mate-img\" >                     <img id=\"img1\" src=\"" + newsMsgInfo.PicUrl + "\" class=\"img-responsive\">                     <div class=\"title\" id=\"title1\">" + newsMsgInfo.Title + "</div>                 </div>             </div>");
                                            }
                                            else
                                            {
                                                stringBuilder.Append("             <div class=\"mate-inner\">                 <div class=\"child-mate\">                     <div class=\"child-mate-title clearfix\">                         <div class=\"title\">" + newsMsgInfo.Title + "</div>                         <div class=\"img\">                             <img src=\"" + newsMsgInfo.PicUrl + "\" class=\"img-responsive\">                         </div>                     </div>                 </div>             </div>");
                                            }
                                        }
                                        this.htmlInfo = ((object)stringBuilder).ToString();
                                        break;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                                else
                                {
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        this.Response.Redirect("sendalllist.aspx");
                        this.Response.End();
                    }
                }
                else if (this.LocalArticleID > 0)
                {
                    ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.LocalArticleID);
                    if (articleInfo != null)
                    {
                        this.hdfArticleID.Value   = this.LocalArticleID.ToString();
                        this.hdfMessageType.Value = ((int)articleInfo.ArticleType).ToString();
                    }
                }
                if (string.IsNullOrEmpty(this.htmlInfo))
                {
                    this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                }
                this.litInfo.Text = this.htmlInfo;
            }
        }
Beispiel #17
0
        protected string GetTitleShow(object messagetypename, object articleid, object responseid)
        {
            string str  = string.Empty;
            int    num  = Globals.ToNum(articleid);
            int    id   = Globals.ToNum(responseid);
            string str2 = messagetypename.ToString();

            if (str2 == null)
            {
                return(str);
            }
            if (!(str2 == "多图文"))
            {
                if (str2 == "单图文")
                {
                    if (num > 0)
                    {
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo != null)
                        {
                            int num5 = 1;
                            str = string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num5, "</span>] ", Globals.SubStr(articleInfo.Title, 40, "..."), "</p>" });
                        }
                        return(str);
                    }
                    NewsReplyInfo info6 = ReplyHelper.GetReply(id) as NewsReplyInfo;
                    if (info6 == null)
                    {
                        return(str);
                    }
                    StringBuilder builder2 = new StringBuilder();
                    if ((info6.NewsMsg != null) && (info6.NewsMsg.Count > 0))
                    {
                        int num6 = 0;
                        foreach (NewsMsgInfo info7 in info6.NewsMsg)
                        {
                            num6++;
                            builder2.Append(string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num6, "</span>] ", Globals.SubStr(info7.Title, 40, "..."), "</p>" }));
                        }
                    }
                    return(builder2.ToString());
                }
                if (str2 == "文本")
                {
                    TextReplyInfo info8 = ReplyHelper.GetReply(id) as TextReplyInfo;
                    if (info8 != null)
                    {
                        str = Globals.SubStr(Regex.Replace(Regex.Replace(info8.Text, "<[^>]+>", ""), "&[^;]+;", ""), 100, "...");
                        if (string.IsNullOrEmpty(str) && info8.Text.Contains("<img "))
                        {
                            str = "<span style='color:green;'>图文内容</span>";
                        }
                    }
                }
                return(str);
            }
            if (num > 0)
            {
                ArticleInfo info = ArticleHelper.GetArticleInfo(num);
                if (info != null)
                {
                    int num3 = 1;
                    str = string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num3, "</span>] ", Globals.SubStr(info.Title, 40, "..."), "</p>" });
                    if (info.ItemsInfo == null)
                    {
                        return(str);
                    }
                    foreach (ArticleItemsInfo info2 in info.ItemsInfo)
                    {
                        num3++;
                        object obj2 = str;
                        str = string.Concat(new object[] { obj2, "<p>[<span style='color:green;'>图文", num3, "</span>] ", Globals.SubStr(info2.Title, 40, "..."), "</p>" });
                    }
                }
                return(str);
            }
            NewsReplyInfo reply = ReplyHelper.GetReply(id) as NewsReplyInfo;

            if (reply == null)
            {
                return(str);
            }
            StringBuilder builder = new StringBuilder();

            if ((reply.NewsMsg != null) && (reply.NewsMsg.Count > 0))
            {
                int num4 = 0;
                foreach (NewsMsgInfo info4 in reply.NewsMsg)
                {
                    num4++;
                    builder.Append(string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num4, "</span>] ", Globals.SubStr(info4.Title, 40, "..."), "</p>" }));
                }
            }
            return(builder.ToString());
        }
Beispiel #18
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 = "";
             }
         }
     }
 }
Beispiel #19
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 = "";
             }
         }
     }
 }
Beispiel #20
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))
            {
                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);
        }
Beispiel #21
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 = "";
             }
         }
     }
 }