예제 #1
0
        protected void rptSeries_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Repeater r = e.Item.FindControl("rptSeason") as Repeater;

                r.DataSource = Episode.List((int)e.Item.DataItem);
                r.DataBind();
            }
        }
예제 #2
0
        public void ProcessRequest(HttpContext context)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(@"<?xml version=""1.0"" encoding=""UTF-8""?>");
            sb.AppendLine(@"<urlset xmlns=""http://www.sitemaps.org/schemas/sitemap/0.9"">");
            context.Response.ContentType = "text/xml";

            string domain = "https://" + "www.kpfanworld.com";

            sb.AppendLine($"<url><loc>{domain}</loc></url>");
            sb.AppendLine($"<url><loc>{domain}/Guides</loc></url>");
            sb.AppendLine($"<url><loc>{domain}/About</loc></url>");
            sb.AppendLine($"<url><loc>{domain}/Contact</loc></url>");
            sb.AppendLine($"<url><loc>{domain}/Chat</loc></url>");
            sb.AppendLine($"<url><loc>{domain}/Caps</loc></url>");
            sb.AppendLine($"<url><loc>{domain}/Donate</loc></url>");

            foreach (var ep in Episode.List())
            {
                sb.AppendLine($"<url><loc>{domain}/Guides/{ep.UrlLabel}</loc></url>");

                if (ep.HasTranscript)
                {
                    sb.AppendLine($"<url><loc>{domain}/Guides/{ep.UrlLabel}/Transcript</loc></url>");
                }
            }

            foreach (var ep in EpCapsList.S1List)
            {
                sb.AppendLine($"<url><loc>{domain}/Caps/{ep.UrlLabel}</loc></url>");
            }

            foreach (var ep in EpCapsList.S2List)
            {
                sb.AppendLine($"<url><loc>{domain}/Caps/{ep.UrlLabel}</loc></url>");
            }

            foreach (var ep in EpCapsList.S3List)
            {
                sb.AppendLine($"<url><loc>{domain}/Caps/{ep.UrlLabel}</loc></url>");
            }

            foreach (var ep in EpCapsList.S4List)
            {
                sb.AppendLine($"<url><loc>{domain}/Caps/{ep.UrlLabel}</loc></url>");
            }

            foreach (var ep in EpCapsList.MovieList)
            {
                sb.AppendLine($"<url><loc>{domain}/Caps/{ep.UrlLabel}</loc></url>");
            }

            foreach (var ep in EpCapsList.MiscList)
            {
                sb.AppendLine($"<url><loc>{domain}/Caps/{ep.UrlLabel}</loc></url>");
            }

            sb.AppendLine("</urlset>");

            context.Response.Write(sb.ToString());
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string epUrl   = Page.RouteData.Values["Episode"]?.ToString();
            string epTitle = Page.RouteData.Values["EpisodeTranscript"]?.ToString();

            if (epUrl != null)
            {
                if (new Regex("^[0-9]+$").IsMatch(epUrl))
                {
                    epUrl = Episode.GetUrl(Convert.ToInt32(epUrl));
                    if (epUrl == "")
                    {
                        Response.Redirect("~/Guides");
                        return;
                    }
                    Response.RedirectPermanent($"~/Guides/{epUrl}");
                    return;
                }

                Episode ep = Episode.GetByUrl(epUrl);
                if (ep == null)
                {
                    Response.Redirect("~/Guides");
                    return;
                }
                LoadEpisode(ep);
            }
            else if (epTitle != null)
            {
                if (new Regex("^[0-9]+$").IsMatch(epTitle.Trim()))
                {
                    epTitle = Episode.GetUrl(Convert.ToInt32(epTitle));
                    if (epTitle == "")
                    {
                        Response.Redirect("~/Guides");
                        return;
                    }
                    Response.RedirectPermanent($"~/Guides/{epTitle}/Transcript");
                    return;
                }

                Episode ep = Episode.GetByUrl(epTitle);
                if (ep == null)
                {
                    Response.Redirect("~/Guides");
                    return;
                }

                LoadTranscript(ep);
            }
            else
            {
                List <Episode> l = Episode.List();
                var            s = l.Where(ep => ep.Season == 1).ToList();
                rptSeries.DataSource = l.Select(i => i.Season).Distinct();
                rptSeries.DataBind();
                //rptS1.DataSource = s;
                //rptS1.DataBind();

                //s = l.Where(ep => ep.Season == 2).ToList();
                //rptS2.DataSource = s;
                //rptS2.DataBind();

                //s = l.Where(ep => ep.Season == 3).ToList();
                //rptS3.DataSource = s;
                //rptS3.DataBind();

                //s = l.Where(ep => ep.Season == 4).ToList();
                //rptS4.DataSource = s;
                //rptS4.DataBind();
            }

            pnlList.Visible       = epUrl == null && epTitle == null;
            pnlEpisode.Visible    = epUrl != null;
            pnlTranscript.Visible = epTitle != null;
        }