protected void Page_Init(object sender, EventArgs e) { GoogleMetaDescription = "Your single access to all your catholic needs."; if (Page.RouteData.Values["bible-verse-id"] != null) { var bibleVerseService = new BibleVerseService(); var verse = bibleVerseService.Find(Convert.ToInt32(Page.RouteData.Values["bible-verse-id"])); MetaDescription = verse.BibleVerseContent; GoogleMetaDescription = MetaDescription; MetaTitle = "Bible Verse"; MetaUrl = "http://www.mycatholicportal.org/BibleVerse.aspx"; MetaImage = "http://www.mycatholicportal.org/Images/BibleVerse.png"; } if (Page.RouteData.Values["religious-quote-id"] != null) { var religiousQuoteService = new ReligiousQuoteService(); var religiousQuote = religiousQuoteService.Find(Convert.ToInt32(Page.RouteData.Values["religious-quote-id"])); MetaDescription = religiousQuote.Quote; GoogleMetaDescription = MetaDescription; MetaTitle = "Religious Quote"; MetaUrl = "http://www.mycatholicportal.org/ReligiousQuote.aspx"; MetaImage = "http://www.mycatholicportal.org/Images/RelQuotes.png"; } if (Page.RouteData.Values["music-id"] != null) { var musicalInspirationService = new MusicalInspirationService(); var music = musicalInspirationService.Find(Convert.ToInt32(Page.RouteData.Values["music-id"])); MetaDescription = "Currently playing " + music.SongTitle + " by " + music.Artist; GoogleMetaDescription = MetaDescription; MetaTitle = "Musical Inspiration"; MetaUrl = "http://www.mycatholicportal.org/MusicalInspirations.aspx"; MetaImage = "http://www.mycatholicportal.org/Images/Musical.png"; } if (Page.RouteData.Values["church-id"] != null) { var churchService = new ChurchService(); var church = churchService.Find(Convert.ToInt32(Page.RouteData.Values["church-id"])); char[] separator = { ',' }; MetaTitle = church.Parish; MetaDescription = church.ChurchHistory.Split(separator)[0]; GoogleMetaDescription = MetaDescription; MetaUrl = "http://www.mycatholicportal.org/Church/" + church.SimbahanID; MetaImage = church.ChurchPhotos.Count > 0 ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos : ""; } if (Page.RouteData.Values["organization-id"] != null) { var organizationService = new OrganizationService(); var church = organizationService.Find(Convert.ToInt32(Page.RouteData.Values["organization-id"])); char[] separator = { ',' }; MetaTitle = church.Name; MetaDescription = ""; MetaUrl = "http://www.mycatholicportal.org/Organization/" + church.Id; MetaImage = ""; } if (Page.RouteData.Values["devote-id"] != null) { var devotionService = new DevotionService(); var devotion = devotionService.Find(Convert.ToInt32(Page.RouteData.Values["devote-id"])); char[] separator = { ',' }; MetaTitle = devotion.Title; MetaDescription = devotion.Prayer.Split(separator)[0]; GoogleMetaDescription = MetaDescription; MetaUrl = "http://www.mycatholicportal.org/Dvote/" + devotion.Id; //MetaImage = church.ChurchPhotos.Count > 0 ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos : ""; } if (Page.RouteData.Values["prayer-id"] != null) { var bcpService = new BasicCatholicPrayerService(); var bcp = bcpService.Find(Convert.ToInt32(Page.RouteData.Values["prayer-id"])); char[] separator = { ',' }; MetaTitle = bcp.Title; MetaDescription = bcp.Prayer.Split(separator)[0]; GoogleMetaDescription = MetaDescription; MetaUrl = "http://www.mycatholicportal.org/Prayer/" + bcp.Id; //MetaImage = church.ChurchPhotos.Count > 0 ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos : ""; } if (Page.RouteData.Values["other-prayer-id"] != null) { var ocpService = new OtherCatholicPrayerService(); var ocp = ocpService.Find(Convert.ToInt32(Page.RouteData.Values["other-prayer-id"])); char[] separator = { ',' }; MetaTitle = ocp.Title; MetaDescription = ocp.Prayer.Split(separator)[0]; GoogleMetaDescription = MetaDescription; MetaUrl = "http://www.mycatholicportal.org/OtherPrayer/" + ocp.Id; //MetaImage = church.ChurchPhotos.Count > 0 ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos : ""; } if (Page.RouteData.Values["saint-id"] != null) { var saintService = new SaintService(); var saint = saintService.Find(Convert.ToInt32(Page.RouteData.Values["saint-id"])); MetaTitle = saint.Name; MetaDescription = saint.Biography; GoogleMetaDescription = MetaDescription; MetaUrl = "http://www.mycatholicportal.org/Saint/" + saint.Id; } if (Page.RouteData.Values["gospel-id"] != null) { var dailyGospelService = new DailyGospelService(); int id; Models.DailyGospel gospel; if (int.TryParse(Page.RouteData.Values["gospel-id"].ToString(), out id)) { gospel = dailyGospelService.Find(id); } else if (Page.RouteData.Values["gospel-id"].ToString().Length > 1) { gospel = dailyGospelService.FindByDate(Convert.ToDateTime(Page.RouteData.Values["gospel-id"])); } else { gospel = dailyGospelService.FindByDate(DateTime.Now); } MetaDescription = gospel.FirstReadingContent; GoogleMetaDescription = MetaDescription; MetaTitle = "Daily Gospel"; MetaUrl = "http://www.mycatholicportal.org/Gospel/" + gospel.Id; MetaImage = "http://www.mycatholicportal.org/Images/dailyreadings.jpg"; } if (Page.RouteData.Values["daily-reflection-id"] != null) { var reflectionService = new DailyReflectionService(); int id; Models.DailyReflection reflection; if (int.TryParse(Page.RouteData.Values["daily-reflection-id"].ToString(), out id)) { reflection = reflectionService.Find(id); } else if (Page.RouteData.Values["daily-reflection-id"].ToString().Length > 1) { reflection = reflectionService.FindByDate(Convert.ToDateTime(Page.RouteData.Values["daily-reflection-id"])); } else { reflection = reflectionService.FindByDate(DateTime.Now); } MetaDescription = reflection.FirstContentTitle; GoogleMetaDescription = MetaDescription; MetaTitle = "Daily Reflection"; MetaImage = "http://www.mycatholicportal.org/Images/dailyreadings.jpg"; MetaUrl = "http://www.mycatholicportal.org/Reflection/" + reflection.Id; } if (Page.RouteData.Values["announcement-id"] != null) { var announcementService = new AnnouncementService(); var announcement = announcementService.Find(Convert.ToInt32(Page.RouteData.Values["announcement-id"])); char[] separator = { ',' }; MetaTitle = announcement.Title; MetaDescription = announcement.Description; GoogleMetaDescription = MetaDescription; MetaUrl = "http://www.mycatholicportal.org/Announcement/" + announcement.Id; //MetaImage = church.ChurchPhotos.Count > 0 ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos : ""; } // The code below helps to protect against XSRF attacks var requestCookie = Request.Cookies[AntiXsrfTokenKey]; Guid requestCookieGuidValue; if (requestCookie != null && Guid.TryParse(requestCookie.Value, out requestCookieGuidValue)) { // Use the Anti-XSRF token from the cookie _antiXsrfTokenValue = requestCookie.Value; Page.ViewStateUserKey = _antiXsrfTokenValue; } else { // Generate a new Anti-XSRF token and save to the cookie _antiXsrfTokenValue = Guid.NewGuid().ToString("N"); Page.ViewStateUserKey = _antiXsrfTokenValue; var responseCookie = new HttpCookie(AntiXsrfTokenKey) { HttpOnly = true, Value = _antiXsrfTokenValue }; if (FormsAuthentication.RequireSSL && Request.IsSecureConnection) { responseCookie.Secure = true; } Response.Cookies.Set(responseCookie); } Page.PreLoad += master_Page_PreLoad; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Models.DailyGospel dailyGospel; var dailyGospelService = new DailyGospelService(); if (Page.RouteData.Values["gospel-id"] != null) { int id; if (int.TryParse(Page.RouteData.Values["gospel-id"].ToString(), out id)) { dailyGospel = dailyGospelService.Find(id); } else if (Page.RouteData.Values["gospel-id"].ToString().Length > 1) { dailyGospel = dailyGospelService.FindByDate(Convert.ToDateTime(Page.RouteData.Values["gospel-id"])); } else { dailyGospel = dailyGospelService.FindByDate(DateTime.UtcNow); } } else { var date = Request["date"] != null?Convert.ToDateTime(Request["date"]) : DateTime.UtcNow; dailyGospel = GetReading(date); } GospelID.Value = dailyGospel.Id.ToString(); SourceContent.InnerHtml = dailyGospel.Source; GospelDate.InnerHtml = dailyGospel.DateOfGospel.DayOfWeek + ", " + dailyGospel.DateOfGospel.ToString("MMMM dd, yyyy"); FRTitle.InnerHtml = dailyGospel.FirstReadingTitle; FRContent.InnerHtml = dailyGospel.FirstReadingContent; RPTitle.InnerHtml = dailyGospel.ResponsorialPsalmTitle; RPContent.InnerHtml = dailyGospel.ResponsorialPsalmContent; SRTitle.InnerHtml = dailyGospel.SecondReadingTitle; SRContent.InnerHtml = dailyGospel.SecondReadingContent; VBGTitle.InnerHtml = dailyGospel.VerseBeforeGospelTitle; VBGContent.InnerHtml = dailyGospel.VerseBeforeGospelContent; DGospelTitle.InnerHtml = dailyGospel.GospelTitle; DGospelContent.InnerHtml = dailyGospel.GospelContent; SecondReading.Attributes.Add("style", dailyGospel.SecondReadingTitle == "" ? "display:none" : "display:block"); SecondReading.Attributes.Add("style", dailyGospel.SecondReadingContent == "" ? "display:none" : "display:block"); VerseBeforeGospel.Attributes.Add("style", dailyGospel.VerseBeforeGospelTitle == "" ? "display:none" : "display:block"); VerseBeforeGospel.Attributes.Add("style", dailyGospel.VerseBeforeGospelContent == "" ? "display:none" : "display:block"); DateTime dateParam; dateParam = Request["date"] != null?Convert.ToDateTime(Request["date"]) : DateTime.UtcNow; var verse = GetVerse(dateParam); var quote = GetQuote(dateParam); //TextBox1.Text = DateTime.Now.ToString().Split(' ')[0] + " " + DateTime.Now.ToString().Split(' ')[1]; HttpUtility.HtmlEncode(BibleQuote.InnerHtml = verse.BibleVerseContent); HttpUtility.HtmlEncode(BibleVerse.InnerHtml = verse.ChapterTitle); RelQuote.InnerHtml = quote.Quote; Author.InnerHtml = quote.Author; var service = new DailyGospelReflectionService(); if (!service.UserHasReflection(Auth.user().Id, dailyGospel.Id)) { return; } var reflection = service.GetUserReflection(Auth.user().Id, dailyGospel.Id); GReflectTitle.Value = reflection.Title; GReflectContent.Value = reflection.ReflectionContent; } }