Exemple #1
0
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            IList <Hidistro.Entities.VShop.ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Vote);

            if ((replies != null) && (replies.Count > 0))
            {
                foreach (Hidistro.Entities.VShop.ReplyInfo info in replies)
                {
                    if (info.Keys == key)
                    {
                        VoteInfo voteById = StoreHelper.GetVoteById((long)info.ActivityId);
                        if ((voteById != null) && voteById.IsBackup)
                        {
                            NewsResponse response = new NewsResponse
                            {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article item = new Article
                            {
                                Description = voteById.VoteName,
                                PicUrl      = this.FormatImgUrl(voteById.ImageUrl),
                                Title       = voteById.VoteName,
                                Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", HttpContext.Current.Request.Url.Host, voteById.VoteId)
                            };
                            response.Articles.Add(item);
                            return(response);
                        }
                    }
                }
            }
            return(null);
        }
Exemple #2
0
        public override AbstractResponse OnTextRequest(TextRequest textRequest)
        {
            AbstractResponse keyResponse = this.GetKeyResponse(textRequest.Content, textRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Keys);

            if (replies == null || (replies.Count == 0 && this.IsOpenManyService()))
            {
                return(this.GotoManyCustomerService(textRequest));
            }
            foreach (ReplyInfo item in replies)
            {
                if (item.MatchType == MatchType.Equal && item.Keys == textRequest.Content)
                {
                    AbstractResponse response = this.GetResponse(item, textRequest.FromUserName, null);
                    response.ToUserName   = textRequest.FromUserName;
                    response.FromUserName = textRequest.ToUserName;
                    return(response);
                }
                if (item.MatchType == MatchType.Like && item.Keys.Contains(textRequest.Content))
                {
                    AbstractResponse response2 = this.GetResponse(item, textRequest.FromUserName, null);
                    response2.ToUserName   = textRequest.FromUserName;
                    response2.FromUserName = textRequest.ToUserName;
                    return(response2);
                }
            }
            return(this.DefaultResponse(textRequest));
        }
Exemple #3
0
        public override AbstractResponse OnTextRequest(TextRequest textRequest)
        {
            WeiXinHelper.UpdateRencentOpenID(textRequest.FromUserName);
            AbstractResponse keyResponse = this.GetKeyResponse(textRequest.Content, textRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            IList <Hidistro.Entities.VShop.ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Keys);

            if ((replies == null) || ((replies.Count == 0) && this.IsOpenManyService()))
            {
                this.GotoManyCustomerService(textRequest);
            }
            foreach (Hidistro.Entities.VShop.ReplyInfo info in replies)
            {
                if ((info.MatchType == MatchType.Equal) && (info.Keys == textRequest.Content))
                {
                    AbstractResponse response = this.GetResponse(info, textRequest.FromUserName);
                    response.ToUserName   = textRequest.FromUserName;
                    response.FromUserName = textRequest.ToUserName;
                    return(response);
                }
                if ((info.MatchType == MatchType.Like) && info.Keys.Contains(textRequest.Content))
                {
                    AbstractResponse response3 = this.GetResponse(info, textRequest.FromUserName);
                    response3.ToUserName   = textRequest.FromUserName;
                    response3.FromUserName = textRequest.ToUserName;
                    return(response3);
                }
            }
            return(this.DefaultResponse(textRequest));
        }
Exemple #4
0
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            AbstractResponse abstractResponse;
            IList <Hidistro.Entities.VShop.ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Vote);

            if (replies != null && replies.Count > 0)
            {
                using (IEnumerator <Hidistro.Entities.VShop.ReplyInfo> enumerator = replies.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Hidistro.Entities.VShop.ReplyInfo current = enumerator.Current;
                        if (current.Keys != key)
                        {
                            continue;
                        }
                        VoteInfo voteById = StoreHelper.GetVoteById((long)current.ActivityId);
                        if (voteById == null || !voteById.IsBackup)
                        {
                            continue;
                        }
                        NewsResponse newsResponse = new NewsResponse()
                        {
                            CreateTime   = DateTime.Now,
                            FromUserName = request.ToUserName,
                            ToUserName   = request.FromUserName,
                            Articles     = new List <Article>()
                        };
                        IList <Article> articles = newsResponse.Articles;
                        Article         article  = new Article()
                        {
                            Description = voteById.VoteName,
                            PicUrl      = this.FormatImgUrl(voteById.ImageUrl),
                            Title       = voteById.VoteName,
                            Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", HttpContext.Current.Request.Url.Host, voteById.VoteId)
                        };
                        articles.Add(article);
                        abstractResponse = newsResponse;
                        return(abstractResponse);
                    }
                    return(null);
                }
                return(abstractResponse);
            }
            return(null);
        }
Exemple #5
0
        public override AbstractResponse OnTextRequest(TextRequest textRequest)
        {
            AbstractResponse keyResponse = this.GetKeyResponse(textRequest.Content, textRequest);
            AbstractResponse result;

            if (keyResponse != null)
            {
                result = keyResponse;
            }
            else
            {
                System.Collections.Generic.IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Keys);
                if (replies == null || (replies.Count == 0 && this.IsOpenManyService()))
                {
                    this.GotoManyCustomerService(textRequest);
                }
                foreach (ReplyInfo info in replies)
                {
                    if (info.MatchType == MatchType.Equal && info.Keys == textRequest.Content)
                    {
                        AbstractResponse response = this.GetResponse(info, textRequest.FromUserName);
                        response.ToUserName   = textRequest.FromUserName;
                        response.FromUserName = textRequest.ToUserName;
                        result = response;
                        return(result);
                    }
                    if (info.MatchType == MatchType.Like && info.Keys.Contains(textRequest.Content))
                    {
                        AbstractResponse response2 = this.GetResponse(info, textRequest.FromUserName);
                        response2.ToUserName   = textRequest.FromUserName;
                        response2.FromUserName = textRequest.ToUserName;
                        result = response2;
                        return(result);
                    }
                }
                result = this.DefaultResponse(textRequest);
            }
            return(result);
        }
Exemple #6
0
        public override AbstractResponse OnTextRequest(TextRequest textRequest)
        {
            WeiXinHelper.UpdateRencentOpenID(textRequest.FromUserName);
            AbstractResponse keyResponse = this.GetKeyResponse(textRequest.Content, textRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Keys);
            if (replies == null || (replies.Count == 0 && this.IsOpenManyService()))
            {
                this.GotoManyCustomerService(textRequest);
            }
            foreach (Hidistro.Entities.VShop.ReplyInfo current in replies)
            {
                if (current.MatchType == MatchType.Equal && current.Keys == textRequest.Content)
                {
                    AbstractResponse response = this.GetResponse(current, textRequest.FromUserName);
                    response.ToUserName   = textRequest.FromUserName;
                    response.FromUserName = textRequest.ToUserName;
                    AbstractResponse result = response;
                    return(result);
                }
                if (current.MatchType == MatchType.Like && current.Keys.Contains(textRequest.Content))
                {
                    AbstractResponse response2 = this.GetResponse(current, textRequest.FromUserName);
                    response2.ToUserName   = textRequest.FromUserName;
                    response2.FromUserName = textRequest.ToUserName;
                    AbstractResponse result = response2;
                    return(result);
                }
            }
            return(this.DefaultResponse(textRequest));
        }
Exemple #7
0
        public override AbstractResponse OnTextRequest(TextRequest textRequest)
        {
            System.Collections.Generic.IList <ReplyInfo> kefuReplies = ReplyHelper.GetReplies(ReplyType.Kefu);
            if (!string.IsNullOrEmpty(textRequest.Content) && this.IsOpenManyService() && kefuReplies != null && kefuReplies.Count > 0)
            {
                List <string> kefuKeys = new List <string>();
                foreach (ReplyInfo item in kefuReplies)
                {
                    if (item.MatchType == MatchType.Equal)
                    {
                        if (item.Keys == textRequest.Content)
                        {
                            return(this.GotoManyCustomerService(textRequest));
                        }
                    }
                    else if (item.MatchType == MatchType.Like)
                    {
                        string[] keys = item.Keys.Split(',');
                        kefuKeys.AddRange(keys);
                    }
                }
                foreach (var key in kefuKeys)
                {
                    if (textRequest.Content.Contains(key))
                    {
                        return(this.GotoManyCustomerService(textRequest));
                    }
                }
            }
            AbstractResponse keyResponse = this.GetKeyResponse(textRequest.Content, textRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            System.Collections.Generic.IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Keys);
            //if (replies == null || (replies.Count == 0 && this.IsOpenManyService()))
            //{
            //    this.GotoManyCustomerService(textRequest);
            //}
            if (replies != null && replies.Count > 0)
            {
                foreach (ReplyInfo current in replies)
                {
                    if (current.MatchType == MatchType.Equal && current.Keys == textRequest.Content)
                    {
                        AbstractResponse response = this.GetResponse(current, textRequest.FromUserName);
                        response.ToUserName   = textRequest.FromUserName;
                        response.FromUserName = textRequest.ToUserName;
                        AbstractResponse result = response;
                        return(result);
                    }
                    if (current.MatchType == MatchType.Like && current.Keys.Contains(textRequest.Content))
                    {
                        AbstractResponse response2 = this.GetResponse(current, textRequest.FromUserName);
                        response2.ToUserName   = textRequest.FromUserName;
                        response2.FromUserName = textRequest.ToUserName;
                        AbstractResponse result = response2;
                        return(result);
                    }
                }
            }
            return(this.DefaultResponse(textRequest));
        }
Exemple #8
0
 private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
 {
     System.Collections.Generic.IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Topic);
     if (replies != null && replies.Count > 0)
     {
         foreach (ReplyInfo current in replies)
         {
             if (current.Keys == key)
             {
                 TopicInfo topicInfo = VShopHelper.Gettopic(current.ActivityId);
                 if (topicInfo != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = topicInfo.Title,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, topicInfo.IconUrl),
                                 Title       = topicInfo.Title,
                                 Url         = string.Format("http://{0}/vshop/Topics.aspx?TopicId={1}", System.Web.HttpContext.Current.Request.Url.Host, topicInfo.TopicId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies2 = ReplyHelper.GetReplies(ReplyType.Vote);
     if (replies2 != null && replies2.Count > 0)
     {
         foreach (ReplyInfo current2 in replies2)
         {
             if (current2.Keys == key)
             {
                 VoteInfo voteById = StoreHelper.GetVoteById((long)current2.ActivityId);
                 if (voteById != null && voteById.IsBackup)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = voteById.VoteName,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, voteById.ImageUrl),
                                 Title       = voteById.VoteName,
                                 Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", System.Web.HttpContext.Current.Request.Url.Host, voteById.VoteId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies3 = ReplyHelper.GetReplies(ReplyType.Wheel);
     if (replies3 != null && replies3.Count > 0)
     {
         foreach (ReplyInfo current3 in replies3)
         {
             if (current3.Keys == key)
             {
                 LotteryActivityInfo lotteryActivityInfo = VShopHelper.GetLotteryActivityInfo(current3.ActivityId);
                 if (lotteryActivityInfo != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = lotteryActivityInfo.ActivityDesc,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityPic),
                                 Title       = lotteryActivityInfo.ActivityName,
                                 Url         = string.Format("http://{0}/vshop/BigWheel.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies4 = ReplyHelper.GetReplies(ReplyType.Scratch);
     if (replies4 != null && replies4.Count > 0)
     {
         foreach (ReplyInfo current4 in replies4)
         {
             if (current4.Keys == key)
             {
                 LotteryActivityInfo lotteryActivityInfo2 = VShopHelper.GetLotteryActivityInfo(current4.ActivityId);
                 if (lotteryActivityInfo2 != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = lotteryActivityInfo2.ActivityDesc,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo2.ActivityPic),
                                 Title       = lotteryActivityInfo2.ActivityName,
                                 Url         = string.Format("http://{0}/vshop/Scratch.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo2.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies5 = ReplyHelper.GetReplies(ReplyType.SmashEgg);
     if (replies5 != null && replies5.Count > 0)
     {
         foreach (ReplyInfo current5 in replies5)
         {
             if (current5.Keys == key)
             {
                 LotteryActivityInfo lotteryActivityInfo3 = VShopHelper.GetLotteryActivityInfo(current5.ActivityId);
                 if (lotteryActivityInfo3 != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = lotteryActivityInfo3.ActivityDesc,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo3.ActivityPic),
                                 Title       = lotteryActivityInfo3.ActivityName,
                                 Url         = string.Format("http://{0}/vshop/SmashEgg.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo3.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies6 = ReplyHelper.GetReplies(ReplyType.SignUp);
     if (replies6 != null && replies6.Count > 0)
     {
         foreach (ReplyInfo current6 in replies6)
         {
             if (current6.Keys == key)
             {
                 ActivityInfo activity = VShopHelper.GetActivity(current6.ActivityId);
                 if (activity != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = activity.Description,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, activity.PicUrl),
                                 Title       = activity.Name,
                                 Url         = string.Format("http://{0}/vshop/Activity.aspx?id={1}", System.Web.HttpContext.Current.Request.Url.Host, activity.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies7 = ReplyHelper.GetReplies(ReplyType.Ticket);
     if (replies7 != null && replies7.Count > 0)
     {
         foreach (ReplyInfo current7 in replies7)
         {
             if (current7.Keys == key)
             {
                 LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(current7.ActivityId);
                 if (lotteryTicket != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = lotteryTicket.ActivityDesc,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityPic),
                                 Title       = lotteryTicket.ActivityName,
                                 Url         = string.Format("http://{0}/vshop/SignUp.aspx?id={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     return(null);
 }
Exemple #9
0
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            System.Collections.Generic.IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Topic);
            AbstractResponse result;

            if (replies != null && replies.Count > 0)
            {
                foreach (ReplyInfo info in replies)
                {
                    if (info.Keys == key)
                    {
                        TopicInfo topic = VShopHelper.Gettopic(info.ActivityId);
                        if (topic != null)
                        {
                            NewsResponse response = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article item = new Article
                            {
                                Description = topic.Title,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, topic.IconUrl),
                                Title       = topic.Title,
                                Url         = string.Format("http://{0}/vshop/Topics.aspx?TopicId={1}", System.Web.HttpContext.Current.Request.Url.Host, topic.TopicId)
                            };
                            response.Articles.Add(item);
                            result = response;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list2 = ReplyHelper.GetReplies(ReplyType.Vote);
            if (list2 != null && list2.Count > 0)
            {
                foreach (ReplyInfo info2 in list2)
                {
                    if (info2.Keys == key)
                    {
                        VoteInfo voteById = StoreHelper.GetVoteById((long)info2.ActivityId);
                        if (voteById != null && voteById.IsBackup)
                        {
                            NewsResponse response2 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article2 = new Article
                            {
                                Description = voteById.VoteName,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, voteById.ImageUrl),
                                Title       = voteById.VoteName,
                                Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", System.Web.HttpContext.Current.Request.Url.Host, voteById.VoteId)
                            };
                            response2.Articles.Add(article2);
                            result = response2;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list3 = ReplyHelper.GetReplies(ReplyType.Wheel);
            if (list3 != null && list3.Count > 0)
            {
                foreach (ReplyInfo info3 in list3)
                {
                    if (info3.Keys == key)
                    {
                        LotteryActivityInfo lotteryActivityInfo = VShopHelper.GetLotteryActivityInfo(info3.ActivityId);
                        if (lotteryActivityInfo != null)
                        {
                            NewsResponse response3 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article3 = new Article
                            {
                                Description = lotteryActivityInfo.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityPic),
                                Title       = lotteryActivityInfo.ActivityName,
                                Url         = string.Format("http://{0}/vshop/BigWheel.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityId)
                            };
                            response3.Articles.Add(article3);
                            result = response3;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list4 = ReplyHelper.GetReplies(ReplyType.Scratch);
            if (list4 != null && list4.Count > 0)
            {
                foreach (ReplyInfo info4 in list4)
                {
                    if (info4.Keys == key)
                    {
                        LotteryActivityInfo info5 = VShopHelper.GetLotteryActivityInfo(info4.ActivityId);
                        if (info5 != null)
                        {
                            NewsResponse response4 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article4 = new Article
                            {
                                Description = info5.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, info5.ActivityPic),
                                Title       = info5.ActivityName,
                                Url         = string.Format("http://{0}/vshop/Scratch.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, info5.ActivityId)
                            };
                            response4.Articles.Add(article4);
                            result = response4;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list5 = ReplyHelper.GetReplies(ReplyType.SmashEgg);
            if (list5 != null && list5.Count > 0)
            {
                foreach (ReplyInfo info6 in list5)
                {
                    if (info6.Keys == key)
                    {
                        LotteryActivityInfo info7 = VShopHelper.GetLotteryActivityInfo(info6.ActivityId);
                        if (info7 != null)
                        {
                            NewsResponse response5 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article5 = new Article
                            {
                                Description = info7.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, info7.ActivityPic),
                                Title       = info7.ActivityName,
                                Url         = string.Format("http://{0}/vshop/SmashEgg.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, info7.ActivityId)
                            };
                            response5.Articles.Add(article5);
                            result = response5;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list6 = ReplyHelper.GetReplies(ReplyType.SignUp);
            if (list6 != null && list6.Count > 0)
            {
                foreach (ReplyInfo info8 in list6)
                {
                    if (info8.Keys == key)
                    {
                        ActivityInfo activity = VShopHelper.GetActivity(info8.ActivityId);
                        if (activity != null)
                        {
                            NewsResponse response6 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article6 = new Article
                            {
                                Description = activity.Description,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, activity.PicUrl),
                                Title       = activity.Name,
                                Url         = string.Format("http://{0}/vshop/Activity.aspx?id={1}", System.Web.HttpContext.Current.Request.Url.Host, activity.ActivityId)
                            };
                            response6.Articles.Add(article6);
                            result = response6;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list7 = ReplyHelper.GetReplies(ReplyType.Ticket);
            if (list7 != null && list7.Count > 0)
            {
                foreach (ReplyInfo info9 in list7)
                {
                    if (info9.Keys == key)
                    {
                        LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(info9.ActivityId);
                        if (lotteryTicket != null)
                        {
                            NewsResponse response7 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article7 = new Article
                            {
                                Description = lotteryTicket.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityPic),
                                Title       = lotteryTicket.ActivityName,
                                Url         = string.Format("http://{0}/vshop/SignUp.aspx?id={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityId)
                            };
                            response7.Articles.Add(article7);
                            result = response7;
                            return(result);
                        }
                    }
                }
            }
            result = null;
            return(result);
        }
Exemple #10
0
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Vote);

            if (replies != null && replies.Count > 0)
            {
                foreach (ReplyInfo item in replies)
                {
                    if (item.Keys == key)
                    {
                        VoteInfo voteById = StoreHelper.GetVoteById(item.ActivityId);
                        if (voteById != null && voteById.IsBackup)
                        {
                            NewsResponse newsResponse = new NewsResponse();
                            newsResponse.CreateTime   = DateTime.Now;
                            newsResponse.FromUserName = request.ToUserName;
                            newsResponse.ToUserName   = request.FromUserName;
                            newsResponse.Articles     = new List <Article>();
                            newsResponse.Articles.Add(new Article
                            {
                                Description = voteById.VoteName,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{voteById.ImageUrl}",
                                Title       = voteById.VoteName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/Vote.aspx?voteId={voteById.VoteId}"
                            });
                            return(newsResponse);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies2 = ReplyHelper.GetReplies(ReplyType.Wheel);

            if (replies2 != null && replies2.Count > 0)
            {
                foreach (ReplyInfo item2 in replies2)
                {
                    if (item2.Keys == key)
                    {
                        LotteryActivityInfo lotteryActivityInfo = VShopHelper.GetLotteryActivityInfo(item2.ActivityId);
                        if (lotteryActivityInfo != null)
                        {
                            NewsResponse newsResponse2 = new NewsResponse();
                            newsResponse2.CreateTime   = DateTime.Now;
                            newsResponse2.FromUserName = request.ToUserName;
                            newsResponse2.ToUserName   = request.FromUserName;
                            newsResponse2.Articles     = new List <Article>();
                            newsResponse2.Articles.Add(new Article
                            {
                                Description = lotteryActivityInfo.ActivityDesc,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{lotteryActivityInfo.ActivityPic}",
                                Title       = lotteryActivityInfo.ActivityName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/BigWheel.aspx?activityId={lotteryActivityInfo.ActivityId}"
                            });
                            return(newsResponse2);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies3 = ReplyHelper.GetReplies(ReplyType.Scratch);

            if (replies3 != null && replies3.Count > 0)
            {
                foreach (ReplyInfo item3 in replies3)
                {
                    if (item3.Keys == key)
                    {
                        LotteryActivityInfo lotteryActivityInfo2 = VShopHelper.GetLotteryActivityInfo(item3.ActivityId);
                        if (lotteryActivityInfo2 != null)
                        {
                            NewsResponse newsResponse3 = new NewsResponse();
                            newsResponse3.CreateTime   = DateTime.Now;
                            newsResponse3.FromUserName = request.ToUserName;
                            newsResponse3.ToUserName   = request.FromUserName;
                            newsResponse3.Articles     = new List <Article>();
                            newsResponse3.Articles.Add(new Article
                            {
                                Description = lotteryActivityInfo2.ActivityDesc,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{lotteryActivityInfo2.ActivityPic}",
                                Title       = lotteryActivityInfo2.ActivityName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/Scratch.aspx?activityId={lotteryActivityInfo2.ActivityId}"
                            });
                            return(newsResponse3);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies4 = ReplyHelper.GetReplies(ReplyType.SmashEgg);

            if (replies4 != null && replies4.Count > 0)
            {
                foreach (ReplyInfo item4 in replies4)
                {
                    if (item4.Keys == key)
                    {
                        LotteryActivityInfo lotteryActivityInfo3 = VShopHelper.GetLotteryActivityInfo(item4.ActivityId);
                        if (lotteryActivityInfo3 != null)
                        {
                            NewsResponse newsResponse4 = new NewsResponse();
                            newsResponse4.CreateTime   = DateTime.Now;
                            newsResponse4.FromUserName = request.ToUserName;
                            newsResponse4.ToUserName   = request.FromUserName;
                            newsResponse4.Articles     = new List <Article>();
                            newsResponse4.Articles.Add(new Article
                            {
                                Description = lotteryActivityInfo3.ActivityDesc,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{lotteryActivityInfo3.ActivityPic}",
                                Title       = lotteryActivityInfo3.ActivityName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/SmashEgg.aspx?activityId={lotteryActivityInfo3.ActivityId}"
                            });
                            return(newsResponse4);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies5 = ReplyHelper.GetReplies(ReplyType.SignUp);

            if (replies5 != null && replies5.Count > 0)
            {
                foreach (ReplyInfo item5 in replies5)
                {
                    if (item5.Keys == key)
                    {
                        VActivityInfo activity = VShopHelper.GetActivity(item5.ActivityId);
                        if (activity != null)
                        {
                            NewsResponse newsResponse5 = new NewsResponse();
                            newsResponse5.CreateTime   = DateTime.Now;
                            newsResponse5.FromUserName = request.ToUserName;
                            newsResponse5.ToUserName   = request.FromUserName;
                            newsResponse5.Articles     = new List <Article>();
                            newsResponse5.Articles.Add(new Article
                            {
                                Description = activity.Description,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{activity.PicUrl}",
                                Title       = activity.Name,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/Activity.aspx?id={activity.ActivityId}"
                            });
                            return(newsResponse5);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies6 = ReplyHelper.GetReplies(ReplyType.Ticket);

            if (replies6 != null && replies6.Count > 0)
            {
                foreach (ReplyInfo item6 in replies6)
                {
                    if (item6.Keys == key)
                    {
                        LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(item6.ActivityId);
                        if (lotteryTicket != null)
                        {
                            NewsResponse newsResponse6 = new NewsResponse();
                            newsResponse6.CreateTime   = DateTime.Now;
                            newsResponse6.FromUserName = request.ToUserName;
                            newsResponse6.ToUserName   = request.FromUserName;
                            newsResponse6.Articles     = new List <Article>();
                            newsResponse6.Articles.Add(new Article
                            {
                                Description = lotteryTicket.ActivityDesc,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{lotteryTicket.ActivityPic}",
                                Title       = lotteryTicket.ActivityName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/SignUp.aspx?id={lotteryTicket.ActivityId}"
                            });
                            return(newsResponse6);
                        }
                    }
                }
            }
            return(null);
        }
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Topic, this.wid);

            if ((replies != null) && (replies.Count > 0))
            {
                foreach (ReplyInfo info in replies)
                {
                    if (info.Keys == key)
                    {
                        TopicInfo topic = VShopHelper.Gettopic(info.ActivityId);
                        if (topic != null)
                        {
                            NewsResponse response = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article item = new Article {
                                Description = topic.Title,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, topic.IconUrl),
                                Title       = topic.Title,
                                Url         = string.Format("http://{0}/vshop/Topics.aspx?TopicId={1}", HttpContext.Current.Request.Url.Host, topic.TopicId)
                            };
                            response.Articles.Add(item);
                            return(response);
                        }
                    }
                }
            }
            IList <ReplyInfo> list2 = ReplyHelper.GetReplies(ReplyType.Vote, this.wid);

            if ((list2 != null) && (list2.Count > 0))
            {
                foreach (ReplyInfo info3 in list2)
                {
                    if (info3.Keys == key)
                    {
                        Hidistro.Entities.Promotions.VoteInfo voteById = StoreHelper.GetVoteById((long)info3.ActivityId);
                        if ((voteById != null) && voteById.IsBackup)
                        {
                            NewsResponse response2 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article2 = new Article {
                                Description = voteById.VoteName,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, voteById.ImageUrl),
                                Title       = voteById.VoteName,
                                Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", HttpContext.Current.Request.Url.Host, voteById.VoteId)
                            };
                            response2.Articles.Add(article2);
                            return(response2);
                        }
                    }
                }
            }
            IList <ReplyInfo> list3 = ReplyHelper.GetReplies(ReplyType.Wheel, this.wid);

            if ((list3 != null) && (list3.Count > 0))
            {
                foreach (ReplyInfo info5 in list3)
                {
                    if (info5.Keys == key)
                    {
                        LotteryActivityInfo lotteryActivityInfo = VShopHelper.GetLotteryActivityInfo(info5.ActivityId);
                        if (lotteryActivityInfo != null)
                        {
                            NewsResponse response3 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article3 = new Article {
                                Description = lotteryActivityInfo.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityPic),
                                Title       = lotteryActivityInfo.ActivityName,
                                Url         = string.Format("http://{0}/vshop/BigWheel.aspx?activityId={1}", HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityId)
                            };
                            response3.Articles.Add(article3);
                            return(response3);
                        }
                    }
                }
            }
            IList <ReplyInfo> list4 = ReplyHelper.GetReplies(ReplyType.Scratch, this.wid);

            if ((list4 != null) && (list4.Count > 0))
            {
                foreach (ReplyInfo info7 in list4)
                {
                    if (info7.Keys == key)
                    {
                        LotteryActivityInfo info8 = VShopHelper.GetLotteryActivityInfo(info7.ActivityId);
                        if (info8 != null)
                        {
                            NewsResponse response4 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article4 = new Article {
                                Description = info8.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, info8.ActivityPic),
                                Title       = info8.ActivityName,
                                Url         = string.Format("http://{0}/vshop/Scratch.aspx?activityId={1}", HttpContext.Current.Request.Url.Host, info8.ActivityId)
                            };
                            response4.Articles.Add(article4);
                            return(response4);
                        }
                    }
                }
            }
            IList <ReplyInfo> list5 = ReplyHelper.GetReplies(ReplyType.SmashEgg, this.wid);

            if ((list5 != null) && (list5.Count > 0))
            {
                foreach (ReplyInfo info9 in list5)
                {
                    if (info9.Keys == key)
                    {
                        LotteryActivityInfo info10 = VShopHelper.GetLotteryActivityInfo(info9.ActivityId);
                        if (info10 != null)
                        {
                            NewsResponse response5 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article5 = new Article {
                                Description = info10.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, info10.ActivityPic),
                                Title       = info10.ActivityName,
                                Url         = string.Format("http://{0}/vshop/SmashEgg.aspx?activityId={1}", HttpContext.Current.Request.Url.Host, info10.ActivityId)
                            };
                            response5.Articles.Add(article5);
                            return(response5);
                        }
                    }
                }
            }
            IList <ReplyInfo> list6 = ReplyHelper.GetReplies(ReplyType.SignUp, this.wid);

            if ((list6 != null) && (list6.Count > 0))
            {
                foreach (ReplyInfo info11 in list6)
                {
                    if (info11.Keys == key)
                    {
                        ActivityInfo activity = VShopHelper.GetActivity(info11.ActivityId);
                        if (activity != null)
                        {
                            NewsResponse response6 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article6 = new Article {
                                Description = activity.Description,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, activity.PicUrl),
                                Title       = activity.Name,
                                Url         = string.Format("http://{0}/vshop/Activity.aspx?id={1}", HttpContext.Current.Request.Url.Host, activity.ActivityId)
                            };
                            response6.Articles.Add(article6);
                            return(response6);
                        }
                    }
                }
            }
            IList <ReplyInfo> list7 = ReplyHelper.GetReplies(ReplyType.Ticket, this.wid);

            if ((list7 != null) && (list7.Count > 0))
            {
                foreach (ReplyInfo info13 in list7)
                {
                    if (info13.Keys == key)
                    {
                        LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(info13.ActivityId);
                        if (lotteryTicket != null)
                        {
                            NewsResponse response7 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article7 = new Article {
                                Description = lotteryTicket.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityPic),
                                Title       = lotteryTicket.ActivityName,
                                Url         = string.Format("http://{0}/vshop/SignUp.aspx?id={1}", HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityId)
                            };
                            response7.Articles.Add(article7);
                            return(response7);
                        }
                    }
                }
            }
            return(null);
        }
Exemple #12
0
 private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
 {
     System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Vote);
     if (replies != null && replies.Count > 0)
     {
         foreach (Hidistro.Entities.VShop.ReplyInfo current in replies)
         {
             if (current.Keys == key)
             {
                 VoteInfo voteById = StoreHelper.GetVoteById((long)current.ActivityId);
                 if (voteById != null && voteById.IsBackup)
                 {
                     return(new NewsResponse
                     {
                         CreateTime = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName = request.FromUserName,
                         Articles = new System.Collections.Generic.List <Article>
                         {
                             new Article
                             {
                                 Description = voteById.VoteName,
                                 PicUrl = this.FormatImgUrl(voteById.ImageUrl),
                                 Title = voteById.VoteName,
                                 Url = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", System.Web.HttpContext.Current.Request.Url.Host, voteById.VoteId)
                             }
                         }
                     });
                 }
             }
         }
     }
     return(null);
 }