protected void Page_Load(object sender, EventArgs e) { try { QuotesViewTableAdapter quotesAdpt = new QuotesViewTableAdapter(); CoreDataObjects.QuotesViewRow r = (CoreDataObjects.QuotesViewRow)quotesAdpt.GetQuoteOfTheDay().Rows[0]; string likeUrl = string.Format("http://www.whatwouldthefoundersdo.org/showQuote.aspx?q={0}", r.QuoteID); //setup page meta data title Page.Title = string.Format("{0} Quote #{1}", r.FullName, r.QuoteID); Page.AddMetaInfo(OpenGraphMetaTags.Title, string.Format("{0} Quote #{1}", r.FullName, r.QuoteID)); Page.AddMetaInfo(OpenGraphMetaTags.Type, "article"); Page.AddMetaInfo(OpenGraphMetaTags.Site_Name, "WhatWouldTheFoundersDo.org"); Page.AddMetaInfo(OpenGraphMetaTags.URL, likeUrl); Page.AddMetaInfo(OpenGraphMetaTags.Description, string.Format("{0}", r.QuoteText)); //load the quote Wwfd.Web.Quotes.QuoteHelper.LoadQuote(PanelQOTD, r.FullName, r.QuoteText, r.QuoteID, r.ReferenceInfo, r.Keywords, false); //adjust the like page to link to the actual quote of the day url FrameFacebookLike.Attributes.Add("src", string.Format(@"http://www.facebook.com/plugins/like.php?href={0}&layout=standard&show_faces=false&width=330&action=like&font=tahoma&colorscheme=light&height=28", likeUrl)); } catch { } }
private void LoadQuotesByFounder(int founderId) { bool addedMeta = false; CoreDataObjects.QuotesViewDataTable quotesDt = quotesAdpt.GetByFounderID(founderId); int numOfRecords = quotesDt.Rows.Count; int numOfPages = (int)Math.Ceiling((decimal)numOfRecords / (decimal)RECORDS_PER_PAGE); //loop for generating the page links for these results for (int p = 1; p <= numOfPages; p++) { string linkUrl = string.Format("~/search.aspx?searchType=Founders&founderId={0}&p={1}", _founderId, p); HyperLink pageLink = new HyperLink(); pageLink.NavigateUrl = linkUrl; pageLink.Text = p.ToString(); //set visual difference for active page if (p == _page) { pageLink.CssClass = "ActivePage"; } PanelPagingBottom.Controls.Add(pageLink); } //loop that displays the quotes int startRecord = ((_page * RECORDS_PER_PAGE) - RECORDS_PER_PAGE) + 1; int lastRecOnPage = _page * RECORDS_PER_PAGE; int recRatio = lastRecOnPage / numOfRecords; int totalRecsLeft = numOfRecords - ((_page - 1) * RECORDS_PER_PAGE); int endRecord = lastRecOnPage + (recRatio * totalRecsLeft) - (recRatio * RECORDS_PER_PAGE); if (numOfRecords < RECORDS_PER_PAGE) { startRecord = 1; endRecord = numOfRecords; PanelPagingBottom.Visible = false; } for (int i = startRecord; i <= endRecord; i++) { //add the quote to the page CoreDataObjects.QuotesViewRow r = (CoreDataObjects.QuotesViewRow)quotesDt.Rows[i - 1]; QuoteHelper.LoadQuote(PanelQuotes, "", r.QuoteText, r.QuoteID, r.ReferenceInfo, r.Keywords, false); //add the page meta data only once if (!addedMeta) { SummaryText.Text = string.Format("Showing {3} Quotes <b>{0}</b> - <b>{1}</b> of <b>{2}</b>", startRecord, endRecord, quotesDt.Rows.Count, r.FullName); LoadFounderData(_founderId); Page.Title = string.Format("Quotes By {0}", r.FullName); Page.AddMetaInfo(MetaTags.Title, string.Format("What Would The Founders Do : {0}", r.FullName)); Page.AddMetaInfo(MetaTags.Description, string.Format("WWFD found {0} quotes by {1}: \"{2}\" More quotes available at http://whatwouldthefoundersdo.org.", quotesDt.Rows.Count, r.FullName, r.QuoteText)); addedMeta = true; } } }
private void GetRandomQuote() { //load a random quote CoreDataObjects.QuotesViewRow r = (CoreDataObjects.QuotesViewRow)quotesAdpt.GetRandomQuote().Rows[0]; Response.Redirect("showQuote.aspx?q=" + r.QuoteID.ToString()); }