示例#1
0
        public static int CreateVote(VoteInfo vote)
        {
            int     num  = 0;
            VoteDao dao  = new VoteDao();
            long    num2 = dao.CreateVote(vote);

            if (num2 > 0L)
            {
                ReplyInfo reply = new TextReplyInfo {
                    Keys       = vote.Keys,
                    MatchType  = MatchType.Equal,
                    ReplyType  = ReplyType.Vote,
                    ActivityId = Convert.ToInt32(num2)
                };
                new ReplyDao().SaveReply(reply);
                num = 1;
                if (vote.VoteItems == null)
                {
                    return(num);
                }
                foreach (VoteItemInfo info2 in vote.VoteItems)
                {
                    info2.VoteId    = num2;
                    info2.ItemCount = 0;
                    num            += dao.CreateVoteItem(info2, null);
                }
            }
            return(num);
        }
        public Hidistro.Entities.VShop.ReplyInfo ReaderBind(IDataReader dataReader)
        {
            Hidistro.Entities.VShop.ReplyInfo info = null;
            object obj2 = dataReader["MessageType"];

            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                if (((MessageType)obj2) == MessageType.Text)
                {
                    info = new TextReplyInfo();
                }
                else
                {
                    info = new NewsReplyInfo();
                }
            }
            obj2 = dataReader["ReplyId"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.Id = (int)obj2;
            }
            info.Keys = dataReader["Keys"].ToString();
            obj2      = dataReader["MatchType"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.MatchType = (MatchType)obj2;
            }
            obj2 = dataReader["ReplyType"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.ReplyType = (ReplyType)obj2;
            }
            obj2 = dataReader["MessageType"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.MessageType = (MessageType)obj2;
            }
            obj2 = dataReader["IsDisable"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.IsDisable = (bool)obj2;
            }
            obj2 = dataReader["LastEditDate"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.LastEditDate = (DateTime)obj2;
            }
            info.LastEditor = dataReader["LastEditor"].ToString();
            obj2            = dataReader["ActivityId"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.ActivityId = (int)obj2;
            }
            obj2 = dataReader["ArticleID"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.ArticleID = (int)obj2;
            }
            return(info);
        }
示例#3
0
        public AbstractResponse GetResponse(ReplyInfo reply, string openId)
        {
            if (reply.MessageType == MessageType.Text)
            {
                TextReplyInfo textReplyInfo = reply as TextReplyInfo;
                TextResponse  textResponse  = new TextResponse();
                textResponse.CreateTime = System.DateTime.Now;
                textResponse.Content    = textReplyInfo.Text;
                if (reply.Keys == "登录")
                {
                    string arg = string.Format("http://{0}/Vshop/Login.aspx?SessionId={1}", System.Web.HttpContext.Current.Request.Url.Host, openId);
                    textResponse.Content = textResponse.Content.Replace("$login$", string.Format("<a href=\"{0}\">一键登录</a>", arg));
                }
                return(textResponse);
            }
            NewsResponse newsResponse = new NewsResponse();

            newsResponse.CreateTime = System.DateTime.Now;
            newsResponse.Articles   = new System.Collections.Generic.List <Article>();
            foreach (NewsMsgInfo current in (reply as NewsReplyInfo).NewsMsg)
            {
                Article item = new Article
                {
                    Description = current.Description,
                    PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, current.PicUrl),
                    Title       = current.Title,
                    Url         = string.IsNullOrEmpty(current.Url) ? string.Format("http://{0}/Vshop/ImageTextDetails.aspx?messageId={1}", System.Web.HttpContext.Current.Request.Url.Host, current.Id) : current.Url
                };
                newsResponse.Articles.Add(item);
            }
            return(newsResponse);
        }
示例#4
0
        private bool UpdateTextReply(TextReplyInfo reply)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update vshop_Reply set ");
            builder.Append("Keys=@Keys,");
            builder.Append("MatchType=@MatchType,");
            builder.Append("ReplyType=@ReplyType,");
            builder.Append("MessageType=@MessageType,");
            builder.Append("IsDisable=@IsDisable,");
            builder.Append("LastEditDate=@LastEditDate,");
            builder.Append("LastEditor=@LastEditor,");
            builder.Append("Content=@Content,");
            builder.Append("Type=@Type,");
            builder.Append("ActivityId=@ActivityId,");
            builder.Append("ArticleID=@ArticleID ");
            builder.Append(" where ReplyId=@ReplyId");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "Keys", DbType.String, reply.Keys);
            this.database.AddInParameter(sqlStringCommand, "MatchType", DbType.Int32, (int)reply.MatchType);
            this.database.AddInParameter(sqlStringCommand, "ReplyType", DbType.Int32, (int)reply.ReplyType);
            this.database.AddInParameter(sqlStringCommand, "MessageType", DbType.Int32, (int)reply.MessageType);
            this.database.AddInParameter(sqlStringCommand, "IsDisable", DbType.Boolean, reply.IsDisable);
            this.database.AddInParameter(sqlStringCommand, "LastEditDate", DbType.DateTime, reply.LastEditDate);
            this.database.AddInParameter(sqlStringCommand, "LastEditor", DbType.String, reply.LastEditor);
            this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, reply.Text);
            this.database.AddInParameter(sqlStringCommand, "Type", DbType.Int32, 2);
            this.database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, reply.ActivityId);
            this.database.AddInParameter(sqlStringCommand, "ArticleID", DbType.Int32, reply.ArticleID);
            this.database.AddInParameter(sqlStringCommand, "ReplyId", DbType.Int32, reply.Id);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
示例#5
0
        public ActionResult AddSingleTextReply(TextReplyInfo model)
        {
            if (ModelState.IsValid)
            {
                var isOK = RunWithCatch(r =>
                {
                    var key = model.Keys.Trim();
                    if (!string.IsNullOrEmpty(model.Keys) && _wxReplyRepository.Query().Any(x => x.Keys == key))
                    {
                        r.AddModelError("Keys", "关键字重复!");
                    }
                    else
                    {
                        WxReply info;
                        info             = new WxReply();
                        info.MessageType = MessageType.Text;
                        info.IsDisabled  = model.IsDisable;
                        if (model.ReplyType == ReplyType.Keys && !string.IsNullOrWhiteSpace(model.Keys))
                        {
                            info.Keys = model.Keys.Trim();
                        }
                        info.Content   = model.Text.Trim();
                        info.MatchType = model.MatchType;
                        if (model.ReplyType == ReplyType.Keys)
                        {
                            info.ReplyType |= ReplyType.Keys;
                        }
                        if (model.ReplyType == ReplyType.Subscribe)
                        {
                            info.ReplyType |= ReplyType.Subscribe;
                        }
                        if (model.ReplyType == ReplyType.NoMatch)
                        {
                            info.ReplyType |= ReplyType.NoMatch;
                        }
                        if (info.ReplyType == ReplyType.None)
                        {
                            r.AddModelError("ReplyType", "请选择回复类型");
                        }
                        else if (_wxReplyRepository.Insert(info))
                        {
                            return(true);
                        }
                        else
                        {
                            r.AddModelError("", new Exception("添加失败"));
                        }
                    }
                    return(false);
                });

                if (isOK)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(model));
        }
示例#6
0
        public IList <Hidistro.Entities.VShop.ReplyInfo> GetAllReply()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select ReplyId,Keys,MatchType,ReplyType,MessageType,IsDisable,LastEditDate,LastEditor,Content,Type,ActivityId,ArticleID");
            stringBuilder.Append(" FROM vshop_AliFuwuReply order by Replyid desc ");
            System.Data.Common.DbCommand             sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());
            List <Hidistro.Entities.VShop.ReplyInfo> list             = new List <Hidistro.Entities.VShop.ReplyInfo>();

            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (dataReader.Read())
                {
                    Hidistro.Entities.VShop.ReplyInfo replyInfo = this.ReaderBind(dataReader);
                    object obj;
                    switch (replyInfo.MessageType)
                    {
                    case MessageType.Text:
                    {
                        TextReplyInfo textReplyInfo = replyInfo as TextReplyInfo;
                        obj = dataReader["Content"];
                        if (obj != null && obj != DBNull.Value)
                        {
                            textReplyInfo.Text = obj.ToString();
                        }
                        list.Add(textReplyInfo);
                        break;
                    }

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo newsReplyInfo = replyInfo as NewsReplyInfo;
                        newsReplyInfo.NewsMsg = this.GetNewsReplyInfo(newsReplyInfo.Id);
                        list.Add(newsReplyInfo);
                        break;
                    }

                    case (MessageType)3:
                        goto IL_ED;

                    default:
                        goto IL_ED;
                    }
                    continue;
IL_ED:
                    TextReplyInfo textReplyInfo2 = replyInfo as TextReplyInfo;
                    obj = dataReader["Content"];
                    if (obj != null && obj != DBNull.Value)
                    {
                        textReplyInfo2.Text = obj.ToString();
                    }
                    list.Add(textReplyInfo2);
                }
            }
            return(list);
        }
示例#7
0
        public IList <ReplyInfo> GetReplies(ReplyType type)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select ReplyId,Keys,MatchType,ReplyType,MessageType,IsDisable,LastEditDate,LastEditor,Content,Type,ActivityId ");
            stringBuilder.Append(" FROM vshop_Reply ");
            stringBuilder.Append(" where ReplyType & @ReplyType = @ReplyType and IsDisable=0");
            stringBuilder.Append(" order by replyid desc");
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString());

            base.database.AddInParameter(sqlStringCommand, "ReplyType", DbType.Int32, (int)type);
            List <ReplyInfo> list = new List <ReplyInfo>();

            using (IDataReader dataReader = base.database.ExecuteReader(sqlStringCommand))
            {
                while (dataReader.Read())
                {
                    ReplyInfo replyInfo = this.ReaderBind(dataReader);
                    switch (replyInfo.MessageType)
                    {
                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo newsReplyInfo = replyInfo as NewsReplyInfo;
                        newsReplyInfo.NewsMsg = this.GetNewsReplyInfo(newsReplyInfo.ReplyId);
                        list.Add(newsReplyInfo);
                        break;
                    }

                    case MessageType.Text:
                    {
                        TextReplyInfo textReplyInfo = replyInfo as TextReplyInfo;
                        object        obj           = ((IDataRecord)dataReader)["Content"];
                        if (obj != null && obj != DBNull.Value)
                        {
                            textReplyInfo.Text = obj.ToString();
                        }
                        list.Add(textReplyInfo);
                        break;
                    }

                    default:
                    {
                        TextReplyInfo textReplyInfo = replyInfo as TextReplyInfo;
                        object        obj           = ((IDataRecord)dataReader)["Content"];
                        if (obj != null && obj != DBNull.Value)
                        {
                            textReplyInfo.Text = obj.ToString();
                        }
                        list.Add(textReplyInfo);
                        break;
                    }
                    }
                }
            }
            return(list);
        }
示例#8
0
        public ActionResult EditSingleTextReply(TextReplyInfo model)
        {
            if (ModelState.IsValid)
            {
                var isOK = RunWithCatch(ms =>
                {
                    var reply = _wxReplyRepository.Get(x => x.Id == model.Id);
                    if ((!string.IsNullOrEmpty(model.Keys) && (reply.Keys != model.Keys.Trim())) && _svc.HasReplyKey(model.Keys.Trim()))
                    {
                        ms.AddModelError("Keys", "关键字重复!");
                    }
                    else
                    {
                        reply.IsDisabled = model.IsDisable;
                        if (model.ReplyType == ReplyType.Keys && !string.IsNullOrWhiteSpace(model.Keys))
                        {
                            reply.Keys = model.Keys.Trim();
                        }
                        else
                        {
                            reply.Keys = string.Empty;
                        }
                        reply.Content   = model.Text;
                        reply.MatchType = model.MatchType;
                        reply.ReplyType = ReplyType.None;
                        if (model.ReplyType == ReplyType.Keys)
                        {
                            reply.ReplyType |= ReplyType.Keys;
                        }
                        if (model.ReplyType == ReplyType.Subscribe)
                        {
                            reply.ReplyType |= ReplyType.Subscribe;
                        }
                        if (model.ReplyType == ReplyType.NoMatch)
                        {
                            reply.ReplyType |= ReplyType.NoMatch;
                        }
                        if (model.ReplyType == ReplyType.None)
                        {
                            ms.AddModelError("ReplyType", "请选择回复类型");
                        }
                        else if (_wxReplyRepository.Update(reply, p => new object[] { reply.Id }))
                        {
                            return(true);
                        }
                    }

                    return(false);
                });

                if (isOK)
                {
                    return(RedirectToAction("Index"));
                }
            }
            return(View(model));
        }
示例#9
0
        public AbstractResponse GetResponse(ReplyInfo reply, string openId, AbstractRequest bstractRequest = null)
        {
            if (reply.MessageType == MessageType.Text)
            {
                TextReplyInfo textReplyInfo = reply as TextReplyInfo;
                TextResponse  textResponse  = new TextResponse();
                textResponse.CreateTime = DateTime.Now;
                if (textReplyInfo != null && !string.IsNullOrEmpty(textReplyInfo.Text))
                {
                    textResponse.Content = textReplyInfo.Text;
                }
                if (reply.Keys == "登录")
                {
                    string arg = $"http://{HttpContext.Current.Request.Url.Host}/Vshop/MemberCenter.aspx?SessionId={openId}";
                    textResponse.Content = textResponse.Content.Replace("$login$", $"<a href=\"{arg}\">一键登录</a>");
                }
                if (reply.Keys == "红包")
                {
                    string value = ((SubscribeEventRequest)bstractRequest).EventKey.Split('_')[1];
                    RedEnvelopeSendRecord redEnvelopeSendRecordById = WeiXinRedEnvelopeProcessor.GetRedEnvelopeSendRecordById(Convert.ToInt32(value));
                    if (redEnvelopeSendRecordById != null)
                    {
                        string arg2 = $"http://{HttpContext.Current.Request.Url.Host}/Vshop/GetRedEnvelope?SendCode={redEnvelopeSendRecordById.SendCode}&OrderId={redEnvelopeSendRecordById.OrderId}";
                        textResponse.Content += $"<a href=\"{arg2}\">立即领取红包</a>";
                    }
                }
                if (reply.Keys == "今日已领红包")
                {
                    string arg3 = $"http://{HttpContext.Current.Request.Url.Host}/Vshop/Default.aspx";
                    textResponse.Content += $"<a href=\"{arg3}\">你今日已领取过了,立即购物</a>";
                }
                if (reply.Keys == "分销注册")
                {
                    string arg4 = $"http://{HttpContext.Current.Request.Url.Host}/Vshop/ReferralRegister.aspx?again=1";
                    textResponse.Content += $"感谢您的关注。点击<a href=\"{arg4}\">注册</a>成为本商城分销员,赚取丰厚奖励!";
                }
                return(textResponse);
            }
            HttpContext  current      = HttpContext.Current;
            NewsResponse newsResponse = new NewsResponse();

            newsResponse.CreateTime = DateTime.Now;
            newsResponse.Articles   = new List <Article>();
            foreach (NewsMsgInfo item2 in (reply as NewsReplyInfo).NewsMsg)
            {
                Article item = new Article
                {
                    Description = item2.Description,
                    PicUrl      = $"{Globals.GetProtocal(current)}://{HttpContext.Current.Request.Url.Host}{item2.PicUrl}",
                    Title       = item2.Title,
                    Url         = (string.IsNullOrEmpty(item2.Url) ? $"{Globals.GetProtocal(current)}://{HttpContext.Current.Request.Url.Host}/Vshop/ImageTextDetails.aspx?messageId={item2.Id}" : item2.Url)
                };
                newsResponse.Articles.Add(item);
            }
            return(newsResponse);
        }
示例#10
0
        public ReplyInfo ReaderBind(IDataReader dataReader)
        {
            ReplyInfo replyInfo = null;
            object    obj       = dataReader["MessageType"];

            if (obj != null && obj != DBNull.Value)
            {
                if ((MessageType)obj == MessageType.Text)
                {
                    replyInfo = new TextReplyInfo();
                }
                else
                {
                    replyInfo = new NewsReplyInfo();
                }
            }
            obj = dataReader["ReplyId"];
            if (obj != null && obj != DBNull.Value)
            {
                replyInfo.Id = (int)obj;
            }
            replyInfo.Keys = dataReader["Keys"].ToString();
            obj            = dataReader["MatchType"];
            if (obj != null && obj != DBNull.Value)
            {
                replyInfo.MatchType = (MatchType)obj;
            }
            obj = dataReader["ReplyType"];
            if (obj != null && obj != DBNull.Value)
            {
                replyInfo.ReplyType = (ReplyType)obj;
            }
            obj = dataReader["MessageType"];
            if (obj != null && obj != DBNull.Value)
            {
                replyInfo.MessageType = (MessageType)obj;
            }
            obj = dataReader["IsDisable"];
            if (obj != null && obj != DBNull.Value)
            {
                replyInfo.IsDisable = (bool)obj;
            }
            obj = dataReader["LastEditDate"];
            if (obj != null && obj != DBNull.Value)
            {
                replyInfo.LastEditDate = (DateTime)obj;
            }
            replyInfo.LastEditor = dataReader["LastEditor"].ToString();
            obj = dataReader["ActivityId"];
            if (obj != null && obj != DBNull.Value)
            {
                replyInfo.ActivityId = (int)obj;
            }
            return(replyInfo);
        }
示例#11
0
        public IList <ReplyInfo> GetReplies(ReplyType type)
        {
            var replies = _replyRepo.Query().Where(x => x.ReplyType == type).ToList();

            List <ReplyInfo> list = new List <ReplyInfo>();

            foreach (var p in replies)
            {
                TextReplyInfo info3;
                WxReply       info = p;
                switch (info.MessageType)
                {
                default:
                case MessageType.Text:
                    info3 = new TextReplyInfo()
                    {
                        ActivityId   = p.ActivityId,
                        Id           = p.Id,
                        Text         = p.Content,
                        IsDisable    = p.IsDisabled,
                        Keys         = p.Keys,
                        LastEditDate = p.LastModified,
                        LastEditor   = p.LastModifier,
                        MatchType    = p.MatchType,
                        MessageType  = p.MessageType,
                        ReplyType    = p.ReplyType,
                    };
                    list.Add(info3);
                    break;

                case MessageType.News:
                case MessageType.List:
                {
                    NewsReplyInfo item = new Models.NewsReplyInfo()
                    {
                        ActivityId   = p.ActivityId,
                        Id           = p.Id,
                        IsDisable    = p.IsDisabled,
                        Keys         = p.Keys,
                        LastEditDate = p.LastModified,
                        LastEditor   = p.LastModifier,
                        MatchType    = p.MatchType,
                        MessageType  = p.MessageType,
                        ReplyType    = p.ReplyType,
                    };

                    item.NewsMsg = this.GetNewsReplyInfo(item.Id);
                    list.Add(item);
                    break;
                }
                }
            }

            return(list);
        }
示例#12
0
        public static bool SaveActivity1(ActivityInfo activity)
        {
            int       activityId = new ActivityDao().SaveActivity(activity);
            ReplyInfo replyInfo  = new TextReplyInfo();

            replyInfo.Keys        = activity.Keys;
            replyInfo.MatchType   = MatchType.Equal;
            replyInfo.MessageType = MessageType.Text;
            replyInfo.ReplyType   = ReplyType.SignUp;
            replyInfo.ActivityId  = activityId;
            return(new ReplyDao().SaveReply(replyInfo));
        }
示例#13
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;
         }
     }
 }
示例#14
0
        public static bool SaveActivity(ActivityInfo activity)
        {
            int       num   = new ActivityDao().SaveActivity(activity);
            ReplyInfo reply = new TextReplyInfo {
                Keys        = activity.Keys,
                MatchType   = MatchType.Equal,
                MessageType = MessageType.Text,
                ReplyType   = ReplyType.SignUp,
                ActivityId  = num
            };

            return(new ReplyDao().SaveReply(reply));
        }
示例#15
0
 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 = "";
             }
         }
     }
 }
示例#16
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);
                    }
                }
            }
        }
示例#17
0
        public IList <Hidistro.Entities.VShop.ReplyInfo> GetAllReply(string wid)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select ReplyId,Keys,MatchType,ReplyType,MessageType,IsDisable,LastEditDate,LastEditor,Content,Type,ActivityId,ArticleID,wid");
            builder.Append(" FROM vshop_Reply where wid =@wid order by Replyid desc ");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());
            List <Hidistro.Entities.VShop.ReplyInfo> list = new List <Hidistro.Entities.VShop.ReplyInfo>();

            this.database.AddInParameter(sqlStringCommand, "wid", DbType.String, wid);
            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (reader.Read())
                {
                    object obj2;
                    Hidistro.Entities.VShop.ReplyInfo info = this.ReaderBind(reader);
                    switch (info.MessageType)
                    {
                    case MessageType.Text:
                    {
                        TextReplyInfo info3 = info as TextReplyInfo;
                        obj2 = reader["Content"];
                        if ((obj2 != null) && (obj2 != DBNull.Value))
                        {
                            info3.Text = obj2.ToString();
                        }
                        list.Add(info3);
                        continue;
                    }

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo info2 = info as NewsReplyInfo;
                        info2.NewsMsg = this.GetNewsReplyInfo(info2.Id);
                        list.Add(info2);
                        continue;
                    }
                    }
                    TextReplyInfo item = info as TextReplyInfo;
                    obj2 = reader["Content"];
                    if ((obj2 != null) && (obj2 != DBNull.Value))
                    {
                        item.Text = obj2.ToString();
                    }
                    list.Add(item);
                }
            }
            return(list);
        }
示例#18
0
        public ActionResult EditSingleTextReply(string id)
        {
            var entity = _wxReplyRepository.Get(x => x.Id == id);
            var model  = new TextReplyInfo();

            model.ReplyType      = entity.ReplyType;
            model.MatchType      = entity.MatchType;
            model.IsDisable      = entity.IsDisabled;
            model.Id             = entity.Id;
            model.CreateDateTime = entity.CreateDateTime;
            model.Keys           = entity.Keys;
            model.Text           = entity.Content;

            return(View(model));
        }
示例#19
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
            {
                this.ShowMsg("关键字重复!", false);
            }
            else
            {
                TextReplyInfo info = new TextReplyInfo();
                info.IsDisable = !this.radDisable.SelectedValue;
                if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text))
                {
                    info.Keys = this.txtKeys.Text.Trim();
                }
                info.Text      = this.fcContent.Text.Trim();
                info.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal);
                if (this.chkKeys.Checked)
                {
                    info.ReplyType |= ReplyType.Keys;
                }
                if (this.chkSub.Checked)
                {
                    info.ReplyType |= ReplyType.Subscribe;
                }
                if (this.chkNo.Checked)
                {
                    info.ReplyType |= ReplyType.NoMatch;
                }
                if (info.ReplyType == ReplyType.None)
                {
                    this.ShowMsg("请选择回复类型", false);
                }
                else
                {
                    if (ReplyHelper.SaveReply(info))
                    {
                        Hishop.Weixin.MP.Domain.TemplateMessage msg = new Hishop.Weixin.MP.Domain.TemplateMessage();


                        this.ShowMsg("添加成功", true);
                    }
                    else
                    {
                        this.ShowMsg("添加失败", false);
                    }
                }
            }
        }
示例#20
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
            {
                this.ShowMsg("关键字重复!", false);
                return;
            }
            TextReplyInfo textReplyInfo = new TextReplyInfo();

            textReplyInfo.IsDisable = !this.radDisable.SelectedValue;
            if ((this.chkKeys.Checked || this.chkKefu.Checked) && !string.IsNullOrWhiteSpace(this.txtKeys.Text))
            {
                textReplyInfo.Keys = this.txtKeys.Text.Trim();
            }
            textReplyInfo.Text      = this.fcContent.Text.Trim();
            textReplyInfo.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal);
            if (this.chkKeys.Checked)
            {
                textReplyInfo.ReplyType |= ReplyType.Keys;
            }
            if (this.chkSub.Checked)
            {
                textReplyInfo.ReplyType |= ReplyType.Subscribe;
            }
            if (this.chkNo.Checked)
            {
                textReplyInfo.ReplyType |= ReplyType.NoMatch;
            }
            if (this.chkKefu.Checked)
            {
                textReplyInfo.ReplyType |= ReplyType.Kefu;
            }
            if (textReplyInfo.ReplyType == ReplyType.None)
            {
                this.ShowMsg("请选择回复类型", false);
                return;
            }
            if (ReplyHelper.SaveReply(textReplyInfo))
            {
                this.ShowMsg("添加成功", true);
                return;
            }
            this.ShowMsg("添加失败", false);
        }
示例#21
0
        public static bool Createtopic(TopicInfo topic, out int id)
        {
            id = 0;
            if (topic == null)
            {
                return(false);
            }
            Globals.EntityCoding(topic, true);
            id = new TopicDao().AddTopic(topic);
            ReplyInfo reply = new TextReplyInfo {
                Keys        = topic.Keys,
                MatchType   = MatchType.Equal,
                MessageType = MessageType.Text,
                ReplyType   = ReplyType.Topic,
                ActivityId  = id
            };

            return(new ReplyDao().SaveReply(reply));
        }
示例#22
0
        public ReplyInfo GetReply(int id)
        {
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand("SELECT * FROM vshop_Reply WHERE ReplyId = @ReplyId");

            base.database.AddInParameter(sqlStringCommand, "ReplyId", DbType.Int32, id);
            ReplyInfo replyInfo = null;

            using (IDataReader dataReader = base.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    replyInfo = this.ReaderBind(dataReader);
                    switch (replyInfo.MessageType)
                    {
                    case (MessageType)3:
                        break;

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo newsReplyInfo = replyInfo as NewsReplyInfo;
                        newsReplyInfo.NewsMsg = this.GetNewsReplyInfo(newsReplyInfo.ReplyId);
                        replyInfo             = newsReplyInfo;
                        break;
                    }

                    case MessageType.Text:
                    {
                        TextReplyInfo textReplyInfo = replyInfo as TextReplyInfo;
                        object        obj           = ((IDataRecord)dataReader)["Content"];
                        if (obj != null && obj != DBNull.Value)
                        {
                            textReplyInfo.Text = obj.ToString();
                        }
                        replyInfo = textReplyInfo;
                        break;
                    }
                    }
                }
            }
            return(replyInfo);
        }
示例#23
0
        public AbstractResponse GetResponse(ReplyInfo reply, string openId)
        {
            AbstractResponse result;

            if (reply.MessageType == MessageType.Text)
            {
                TextReplyInfo info     = reply as TextReplyInfo;
                TextResponse  response = new TextResponse
                {
                    CreateTime = System.DateTime.Now,
                    Content    = info.Text
                };
                if (reply.Keys == "登录")
                {
                    string str = string.Format("http://{0}/Vshop/Login.aspx?SessionId={1}", System.Web.HttpContext.Current.Request.Url.Host, openId);
                    response.Content = response.Content.Replace("$login$", string.Format("<a href=\"{0}\">一键登录</a>", str));
                }
                result = response;
            }
            else
            {
                NewsResponse response2 = new NewsResponse
                {
                    CreateTime = System.DateTime.Now,
                    Articles   = new System.Collections.Generic.List <Article>()
                };
                foreach (NewsMsgInfo info2 in (reply as NewsReplyInfo).NewsMsg)
                {
                    Article item = new Article
                    {
                        Description = info2.Description,
                        PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, info2.PicUrl),
                        Title       = info2.Title,
                        Url         = string.IsNullOrEmpty(info2.Url) ? string.Format("http://{0}/Vshop/ImageTextDetails.aspx?messageId={1}", System.Web.HttpContext.Current.Request.Url.Host, info2.Id) : info2.Url
                    };
                    response2.Articles.Add(item);
                }
                result = response2;
            }
            return(result);
        }
示例#24
0
        private bool SaveTextReply(TextReplyInfo model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into vshop_Reply(");
            builder.Append("Keys,MatchType,ReplyType,MessageType,IsDisable,LastEditDate,LastEditor,Content,Type,ActivityId)");
            builder.Append(" values (");
            builder.Append("@Keys,@MatchType,@ReplyType,@MessageType,@IsDisable,@LastEditDate,@LastEditor,@Content,@Type,@ActivityId)");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "Keys", DbType.String, model.Keys);
            this.database.AddInParameter(sqlStringCommand, "MatchType", DbType.Int32, (int)model.MatchType);
            this.database.AddInParameter(sqlStringCommand, "ReplyType", DbType.Int32, (int)model.ReplyType);
            this.database.AddInParameter(sqlStringCommand, "MessageType", DbType.Int32, (int)model.MessageType);
            this.database.AddInParameter(sqlStringCommand, "IsDisable", DbType.Boolean, model.IsDisable);
            this.database.AddInParameter(sqlStringCommand, "LastEditDate", DbType.DateTime, model.LastEditDate);
            this.database.AddInParameter(sqlStringCommand, "LastEditor", DbType.String, model.LastEditor);
            this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, model.Text);
            this.database.AddInParameter(sqlStringCommand, "Type", DbType.Int32, 1);
            this.database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, model.ActivityId);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
示例#25
0
        public static bool Createtopic(TopicInfo topic, out int id)
        {
            id = 0;
            bool result;

            if (null == topic)
            {
                result = false;
            }
            else
            {
                Globals.EntityCoding(topic, true);
                id = new TopicDao().AddTopic(topic);
                ReplyInfo replyInfo = new TextReplyInfo();
                replyInfo.Keys        = topic.Keys;
                replyInfo.MatchType   = MatchType.Equal;
                replyInfo.MessageType = MessageType.Text;
                replyInfo.ReplyType   = ReplyType.Topic;
                replyInfo.ActivityId  = id;
                result = new ReplyDao().SaveReply(replyInfo);
            }
            return(result);
        }
示例#26
0
        public Hidistro.Entities.VShop.ReplyInfo GetReply(int id)
        {
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM vshop_AliFuwuReply WHERE ReplyId = @ReplyId");
            this.database.AddInParameter(sqlStringCommand, "ReplyId", System.Data.DbType.Int32, id);
            Hidistro.Entities.VShop.ReplyInfo replyInfo = null;
            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    replyInfo = this.ReaderBind(dataReader);
                    switch (replyInfo.MessageType)
                    {
                    case MessageType.Text:
                    {
                        TextReplyInfo textReplyInfo = replyInfo as TextReplyInfo;
                        object        obj           = dataReader["Content"];
                        if (obj != null && obj != DBNull.Value)
                        {
                            textReplyInfo.Text = obj.ToString();
                        }
                        replyInfo = textReplyInfo;
                        break;
                    }

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo newsReplyInfo = replyInfo as NewsReplyInfo;
                        newsReplyInfo.NewsMsg = this.GetNewsReplyInfo(newsReplyInfo.Id);
                        replyInfo             = newsReplyInfo;
                        break;
                    }
                    }
                }
            }
            return(replyInfo);
        }
示例#27
0
        public ReplyInfo GetReply(int id)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM vshop_Reply WHERE ReplyId = @ReplyId");

            this.database.AddInParameter(sqlStringCommand, "ReplyId", DbType.Int32, id);
            ReplyInfo info = null;

            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (reader.Read())
                {
                    info = this.ReaderBind(reader);
                    switch (info.MessageType)
                    {
                    case MessageType.Text:
                    {
                        TextReplyInfo info3 = info as TextReplyInfo;
                        object        obj2  = reader["Content"];
                        if ((obj2 != null) && (obj2 != DBNull.Value))
                        {
                            info3.Text = obj2.ToString();
                        }
                        return(info3);
                    }

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo info2 = info as NewsReplyInfo;
                        info2.NewsMsg = this.GetNewsReplyInfo(info2.Id);
                        return(info2);
                    }
                    }
                }
                return(info);
            }
        }
示例#28
0
 protected void btnAddActivity_Click(object sender, EventArgs e)
 {
     if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim()))
     {
         this.ShowMsg("关键字重复!", false);
     }
     else
     {
         string str = string.Empty;
         if (this.fileUpload.HasFile)
         {
             try
             {
                 str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
                 if (!this.calendarStartDate.SelectedDate.HasValue)
                 {
                     this.ShowMsg("请选择活动开始时间", false);
                 }
                 else if (!this.calendarEndDate.SelectedDate.HasValue)
                 {
                     this.ShowMsg("请选择活动结束时间", false);
                 }
                 else
                 {
                     int num;
                     if (!int.TryParse(this.txtMaxNum.Text, out num) || (num.ToString() != this.txtMaxNum.Text))
                     {
                         this.ShowMsg("可抽奖次数必须是整数", false);
                     }
                     else
                     {
                         int num2;
                         LotteryActivityInfo info = new LotteryActivityInfo {
                             ActivityName = this.txtActiveName.Text,
                             ActivityKey  = this.txtKeyword.Text,
                             ActivityDesc = this.txtdesc.Text,
                             ActivityPic  = str,
                             ActivityType = this.type,
                             StartTime    = this.calendarStartDate.SelectedDate.Value,
                             EndTime      = this.calendarEndDate.SelectedDate.Value,
                             MaxNum       = Convert.ToInt32(this.txtMaxNum.Text)
                         };
                         List <PrizeSetting> list = new List <PrizeSetting>();
                         if ((int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2)) && int.TryParse(this.txtPrize3Num.Text, out num2))
                         {
                             decimal             num3       = Convert.ToDecimal(this.txtProbability1.Text);
                             decimal             num4       = Convert.ToDecimal(this.txtProbability2.Text);
                             decimal             num5       = Convert.ToDecimal(this.txtProbability3.Text);
                             List <PrizeSetting> collection = new List <PrizeSetting>();
                             PrizeSetting        item       = new PrizeSetting {
                                 PrizeName   = this.txtPrize1.Text,
                                 PrizeNum    = Convert.ToInt32(this.txtPrize1Num.Text),
                                 PrizeLevel  = "一等奖",
                                 Probability = num3
                             };
                             collection.Add(item);
                             PrizeSetting setting2 = new PrizeSetting {
                                 PrizeName   = this.txtPrize2.Text,
                                 PrizeNum    = Convert.ToInt32(this.txtPrize2Num.Text),
                                 PrizeLevel  = "二等奖",
                                 Probability = num4
                             };
                             collection.Add(setting2);
                             PrizeSetting setting3 = new PrizeSetting {
                                 PrizeName   = this.txtPrize3.Text,
                                 PrizeNum    = Convert.ToInt32(this.txtPrize3Num.Text),
                                 PrizeLevel  = "三等奖",
                                 Probability = num5
                             };
                             collection.Add(setting3);
                             list.AddRange(collection);
                         }
                         else
                         {
                             this.ShowMsg("奖品数量必须为数字!", false);
                             return;
                         }
                         if (this.ChkOpen.Checked)
                         {
                             if ((string.IsNullOrEmpty(this.txtPrize4.Text) || string.IsNullOrEmpty(this.txtPrize5.Text)) || string.IsNullOrEmpty(this.txtPrize6.Text))
                             {
                                 this.ShowMsg("开启四五六名必须填写", false);
                                 return;
                             }
                             if ((int.TryParse(this.txtPrize4Num.Text, out num2) && int.TryParse(this.txtPrize5Num.Text, out num2)) && int.TryParse(this.txtPrize6Num.Text, out num2))
                             {
                                 decimal             num6     = Convert.ToDecimal(this.txtProbability4.Text);
                                 decimal             num7     = Convert.ToDecimal(this.txtProbability5.Text);
                                 decimal             num8     = Convert.ToDecimal(this.txtProbability6.Text);
                                 List <PrizeSetting> list3    = new List <PrizeSetting>();
                                 PrizeSetting        setting4 = new PrizeSetting {
                                     PrizeName   = this.txtPrize4.Text,
                                     PrizeNum    = Convert.ToInt32(this.txtPrize4Num.Text),
                                     PrizeLevel  = "四等奖",
                                     Probability = num6
                                 };
                                 list3.Add(setting4);
                                 PrizeSetting setting5 = new PrizeSetting {
                                     PrizeName   = this.txtPrize5.Text,
                                     PrizeNum    = Convert.ToInt32(this.txtPrize5Num.Text),
                                     PrizeLevel  = "五等奖",
                                     Probability = num7
                                 };
                                 list3.Add(setting5);
                                 PrizeSetting setting6 = new PrizeSetting {
                                     PrizeName   = this.txtPrize6.Text,
                                     PrizeNum    = Convert.ToInt32(this.txtPrize6Num.Text),
                                     PrizeLevel  = "六等奖",
                                     Probability = num8
                                 };
                                 list3.Add(setting6);
                                 list.AddRange(list3);
                             }
                             else
                             {
                                 this.ShowMsg("奖品数量必须为数字!", false);
                                 return;
                             }
                         }
                         info.PrizeSettingList = list;
                         int num9 = VShopHelper.InsertLotteryActivity(info);
                         if (num9 > 0)
                         {
                             ReplyInfo reply = new TextReplyInfo {
                                 Keys       = info.ActivityKey,
                                 MatchType  = MatchType.Equal,
                                 ActivityId = num9
                             };
                             string str2 = ((LotteryActivityType)info.ActivityType).ToString();
                             object obj2 = Enum.Parse(typeof(ReplyType), str2);
                             reply.ReplyType = (ReplyType)obj2;
                             ReplyHelper.SaveReply(reply);
                             base.Response.Redirect("ManageLotteryActivity.aspx?type=" + this.type, true);
                             this.ShowMsg("添加成功!", true);
                         }
                     }
                 }
                 return;
             }
             catch
             {
                 this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                 return;
             }
         }
         this.ShowMsg("您没有选择上传的图片文件!", false);
     }
 }
示例#29
0
        private void replyAction(string FromUserId, string eventType, string textContent, string ActionParam)
        {
            Articles articles = new Articles
            {
                toUserId = FromUserId,
                msgType  = "text",
                text     = new MessageText
                {
                    content = "系统未找到相关信息!"
                }
            };

            if (eventType != "")
            {
                if ("follow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.AddFuwuFollowUser(FromUserId);
                    }
                    string aliOHFollowRelayTitle = this.siteSettings.AliOHFollowRelayTitle;
                    Hidistro.Entities.VShop.ReplyInfo subscribeReply = AliFuwuReplyHelper.GetSubscribeReply();
                    if (subscribeReply != null)
                    {
                        if (subscribeReply.MessageType == MessageType.Text)
                        {
                            TextReplyInfo textReplyInfo = subscribeReply as TextReplyInfo;
                            articles.text.content = textReplyInfo.Text;
                        }
                        else if (subscribeReply.ArticleID > 0)
                        {
                            ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(subscribeReply.ArticleID);
                            if (articleInfo != null)
                            {
                                articles = this.GetAlipayArticlesFromArticleInfo(articleInfo, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                            }
                            else
                            {
                                articles.text.content = aliOHFollowRelayTitle;
                            }
                        }
                    }
                    else
                    {
                        articles.text.content = aliOHFollowRelayTitle;
                    }
                }
                else if ("unfollow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.DelFuwuFollowUser(FromUserId);
                    }
                }
                else if ("click".Equals(eventType))
                {
                    int num = 0;
                    if (ActionParam != "" && int.TryParse(ActionParam, out num) && num > 0)
                    {
                        Hidistro.Entities.VShop.MenuInfo fuwuMenu = VShopHelper.GetFuwuMenu(num);
                        if (fuwuMenu != null)
                        {
                            Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(fuwuMenu.ReplyId);
                            if (reply != null)
                            {
                                ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(reply.ArticleID);
                                if (articleInfo2 != null)
                                {
                                    articles = this.GetAlipayArticlesFromArticleInfo(articleInfo2, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                }
                            }
                        }
                    }
                }
                else if ("enter".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(this.UserInfo))
                    {
                        MemberInfo openIdMember = MemberProcessor.GetOpenIdMember(FromUserId, "fuwu");
                        if (openIdMember != null && openIdMember.AlipayLoginId.StartsWith("FW*"))
                        {
                            JObject jObject       = JsonConvert.DeserializeObject(this.UserInfo) as JObject;
                            string  alipayLoginId = "";
                            string  text          = "";
                            if (jObject["logon_id"] != null)
                            {
                                alipayLoginId = jObject["logon_id"].ToString();
                            }
                            if (jObject["user_name"] != null)
                            {
                                text = jObject["user_name"].ToString();
                            }
                            if (text != "" && text != "")
                            {
                                openIdMember.AlipayLoginId  = alipayLoginId;
                                openIdMember.AlipayUsername = text;
                                MemberProcessor.SetAlipayInfos(openIdMember);
                            }
                        }
                    }
                    if (!ActionParam.Contains("sceneId"))
                    {
                        return;
                    }
                    JObject jObject2 = JsonConvert.DeserializeObject(ActionParam) as JObject;
                    if (jObject2["scene"]["sceneId"] != null)
                    {
                        string text2 = jObject2["scene"]["sceneId"].ToString();
                        if (text2.StartsWith("bind"))
                        {
                            if (AlipayFuwuConfig.BindAdmin.Count > 10)
                            {
                                AlipayFuwuConfig.BindAdmin.Clear();
                            }
                            if (AlipayFuwuConfig.BindAdmin.ContainsKey(text2))
                            {
                                AlipayFuwuConfig.BindAdmin[text2] = FromUserId;
                            }
                            else
                            {
                                AlipayFuwuConfig.BindAdmin.Add(text2, FromUserId);
                            }
                            articles.text.content = "您正在尝试绑定服务窗管理员身份!";
                        }
                    }
                }
            }
            else if (textContent != "")
            {
                articles = null;
                System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies = AliFuwuReplyHelper.GetReplies(ReplyType.Keys);
                if (replies != null && replies.Count > 0)
                {
                    foreach (Hidistro.Entities.VShop.ReplyInfo current in replies)
                    {
                        if (current != null)
                        {
                            if (current.MatchType == MatchType.Equal && current.Keys == textContent)
                            {
                                if (current.MessageType == MessageType.Text)
                                {
                                    articles = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text",
                                        text     = new MessageText
                                        {
                                            content = ""
                                        }
                                    };
                                    TextReplyInfo textReplyInfo2 = current as TextReplyInfo;
                                    articles.text.content = textReplyInfo2.Text;
                                    break;
                                }
                                if (current.ArticleID > 0)
                                {
                                    ArticleInfo articleInfo3 = ArticleHelper.GetArticleInfo(current.ArticleID);
                                    if (articleInfo3 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(articleInfo3, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                            if (current.MatchType == MatchType.Like && current.Keys.Contains(textContent))
                            {
                                if (current.MessageType == MessageType.Text)
                                {
                                    articles = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text",
                                        text     = new MessageText
                                        {
                                            content = ""
                                        }
                                    };
                                    TextReplyInfo textReplyInfo3 = current as TextReplyInfo;
                                    articles.text.content = textReplyInfo3.Text;
                                    break;
                                }
                                if (current.ArticleID > 0)
                                {
                                    ArticleInfo articleInfo4 = ArticleHelper.GetArticleInfo(current.ArticleID);
                                    if (articleInfo4 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(articleInfo4, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (articles == null)
            {
                System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies2 = AliFuwuReplyHelper.GetReplies(ReplyType.NoMatch);
                if (replies2 != null && replies2.Count > 0)
                {
                    using (System.Collections.Generic.IEnumerator <Hidistro.Entities.VShop.ReplyInfo> enumerator2 = replies2.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            Hidistro.Entities.VShop.ReplyInfo current2 = enumerator2.Current;
                            if (current2.MessageType == MessageType.Text)
                            {
                                articles = new Articles
                                {
                                    toUserId = FromUserId,
                                    msgType  = "text",
                                    text     = new MessageText
                                    {
                                        content = ""
                                    }
                                };
                                TextReplyInfo textReplyInfo4 = current2 as TextReplyInfo;
                                articles.text.content = textReplyInfo4.Text;
                                break;
                            }
                            if (current2.ArticleID > 0)
                            {
                                ArticleInfo articleInfo5 = ArticleHelper.GetArticleInfo(current2.ArticleID);
                                if (articleInfo5 != null)
                                {
                                    articles = this.GetAlipayArticlesFromArticleInfo(articleInfo5, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                    if (articles != null)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        goto IL_674;
                    }
                }
                articles = new Articles
                {
                    toUserId = FromUserId,
                    msgType  = "text",
                    text     = new MessageText
                    {
                        content = "系统未找到相关信息!"
                    }
                };
            }
IL_674:
            AliOHHelper.log(AliOHHelper.CustomSend(articles).Body);
        }
示例#30
0
        protected string GetTitleShow(object messagetypename, object articleid, object responseid)
        {
            string text = string.Empty;
            int    num  = Globals.ToNum(articleid);
            int    id   = Globals.ToNum(responseid);
            string a;

            if ((a = messagetypename.ToString()) != null)
            {
                if (!(a == "多图文"))
                {
                    if (!(a == "单图文"))
                    {
                        if (a == "文本")
                        {
                            TextReplyInfo textReplyInfo = AliFuwuReplyHelper.GetReply(id) as TextReplyInfo;
                            if (textReplyInfo != null)
                            {
                                text = textReplyInfo.Text;
                                text = System.Text.RegularExpressions.Regex.Replace(text, "<[^>]+>", "");
                                text = System.Text.RegularExpressions.Regex.Replace(text, "&[^;]+;", "");
                                text = Globals.SubStr(text, 100, "...");
                                if (string.IsNullOrEmpty(text) && textReplyInfo.Text.Contains("<img "))
                                {
                                    text = "<span style='color:green;'>图文内容</span>";
                                }
                            }
                        }
                    }
                    else if (num > 0)
                    {
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo != null)
                        {
                            int num2 = 1;
                            text = string.Concat(new object[]
                            {
                                "<p>[<span style='color:green;'>图文",
                                num2,
                                "</span>] ",
                                Globals.SubStr(articleInfo.Title, 40, "..."),
                                "</p>"
                            });
                        }
                    }
                    else
                    {
                        NewsReplyInfo newsReplyInfo = AliFuwuReplyHelper.GetReply(id) as NewsReplyInfo;
                        if (newsReplyInfo != null)
                        {
                            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                            if (newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count > 0)
                            {
                                int num3 = 0;
                                foreach (NewsMsgInfo current in newsReplyInfo.NewsMsg)
                                {
                                    num3++;
                                    stringBuilder.Append(string.Concat(new object[]
                                    {
                                        "<p>[<span style='color:green;'>图文",
                                        num3,
                                        "</span>] ",
                                        Globals.SubStr(current.Title, 40, "..."),
                                        "</p>"
                                    }));
                                }
                            }
                            text = stringBuilder.ToString();
                        }
                    }
                }
                else
                {
                    if (num > 0)
                    {
                        ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo2 == null)
                        {
                            return(text);
                        }
                        int num4 = 1;
                        text = string.Concat(new object[]
                        {
                            "<p>[<span style='color:green;'>图文",
                            num4,
                            "</span>] ",
                            Globals.SubStr(articleInfo2.Title, 40, "..."),
                            "</p>"
                        });
                        if (articleInfo2.ItemsInfo == null)
                        {
                            return(text);
                        }
                        using (System.Collections.Generic.IEnumerator <ArticleItemsInfo> enumerator2 = articleInfo2.ItemsInfo.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                ArticleItemsInfo current2 = enumerator2.Current;
                                num4++;
                                object obj = text;
                                text = string.Concat(new object[]
                                {
                                    obj,
                                    "<p>[<span style='color:green;'>图文",
                                    num4,
                                    "</span>] ",
                                    Globals.SubStr(current2.Title, 40, "..."),
                                    "</p>"
                                });
                            }
                            return(text);
                        }
                    }
                    NewsReplyInfo newsReplyInfo2 = AliFuwuReplyHelper.GetReply(id) as NewsReplyInfo;
                    if (newsReplyInfo2 != null)
                    {
                        System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                        if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0)
                        {
                            int num5 = 0;
                            foreach (NewsMsgInfo current3 in newsReplyInfo2.NewsMsg)
                            {
                                num5++;
                                stringBuilder2.Append(string.Concat(new object[]
                                {
                                    "<p>[<span style='color:green;'>图文",
                                    num5,
                                    "</span>] ",
                                    Globals.SubStr(current3.Title, 40, "..."),
                                    "</p>"
                                }));
                            }
                        }
                        text = stringBuilder2.ToString();
                    }
                }
            }
            return(text);
        }