Esempio n. 1
0
        protected void SetChapterCode(int minChapterCode, int maxChapterCode)
        {
            MinMaxChapterCode = ChapterContext.GetRangeToken(minChapterCode, maxChapterCode);
            if (!string.IsNullOrEmpty(MinMaxChapterCode))
            {
                MinChapterCode = minChapterCode;
                MaxChapterCode = maxChapterCode;

                ResetChapterCode(ChapterDirection);
            }
        }
Esempio n. 2
0
        public ActionResult T(int id = 0, string type = "")
        {
            Constants.Novel.PromotionType promotionType = Constants.Novel.PromotionType.none;
            string url = "";

            if (id > 0)
            {
                if (EnumHelper.TryParsebyName <Constants.Novel.PromotionType>(type, out promotionType))
                {
                    if (promotionType == Constants.Novel.PromotionType.pmc)
                    {
                        PromotionLink promotionLink = _promotionLinkService.Detail(id);
                        if (promotionLink != null && promotionLink.Id > 0 &&
                            !string.IsNullOrEmpty(promotionLink.ChannelCode) &&
                            !string.IsNullOrEmpty(promotionLink.PromotionCode))
                        {
                            SetSessionHeaderInfoFromRoute(promotionLink.ChannelCode, promotionLink.PromotionCode);

                            string chapterUrl  = "/chapter/detail/".GetChannelRouteUrl(promotionLink.ChannelCode);
                            int    chapterCode = promotionLink.EndChapterCode > promotionLink.StartChapterCode ? promotionLink.EndChapterCode : 0;

                            if (promotionLink.FuncType == 1)
                            {
                                IDictionary <string, object> dict = new Dictionary <string, object>();
                                dict.Add("c", ChapterContext.GetRangeToken(promotionLink.EndChapterCode, promotionLink.FollowChapter));
                                dict.Add("rp", ChapterContext.GetReplyText(promotionLink.ReplyKeywords));
                                chapterUrl = "/preview".GetChannelRouteUrl(promotionLink.ChannelCode).SpliceUrl(dict);
                            }

                            url = ChapterContext.GetUrl(chapterUrl, promotionLink.NovelId, chapterCode, Constants.Novel.ChapterDirection.none, channelId: RouteChannelId);
                        }
                    }
                    else if (promotionType == Constants.Novel.PromotionType.rk)
                    {
                        PromotionLink promotionLink = _promotionLinkService.Detail(id);
                        if (promotionLink != null && promotionLink.Id > 0 &&
                            !string.IsNullOrEmpty(promotionLink.ChannelCode) &&
                            !string.IsNullOrEmpty(promotionLink.PromotionCode))
                        {
                            SetSessionHeaderInfoFromRoute(promotionLink.ChannelCode, promotionLink.PromotionCode);

                            string chapterUrl = "/chapter/detail/".GetChannelRouteUrl(promotionLink.ChannelCode);

                            url = ChapterContext.GetUrl(chapterUrl, promotionLink.NovelId, promotionLink.FollowChapter, Constants.Novel.ChapterDirection.none, channelId: RouteChannelId);
                        }
                    }
                }
                else
                {
                    NovelPromotionChannel model = _novelPromotionChannelService.Detail(id);
                    if (model != null && model.NovelId > 0 && model.ChapterCode >= 0)
                    {
                        string chapterUrl = "chapter/detail";
                        string channelId  = model.ChannelId;

                        if (!string.IsNullOrEmpty(channelId))
                        {
                            chapterUrl = string.Concat(chapterUrl, "?channelid=", channelId);
                        }
                        url = ChapterContext.GetUrl(chapterUrl, model.NovelId, model.ChapterCode, channelId: RouteChannelId);
                    }
                }
            }

            if (string.IsNullOrEmpty(url))
            {
                url = DataContext.GetErrorUrl(channelId: RouteChannelId);
            }

            return(Redirect(url));
        }