private string GenerateDateList(int startDate, int endDate, string institutionCode, string languageCode) { short? curYear = 0; StringBuilder html = new StringBuilder(); String cacheKey = "YearBrowse" + startDate.ToString() + endDate.ToString() + institutionCode + languageCode; if (Cache[cacheKey] != null) { // Use cached version html.Append(Cache[cacheKey].ToString()); } else { BHLProvider provider = new BHLProvider(); CustomGenericList<Data.Title> tl = provider.TitleSelectByDateRangeAndInstitution(startDate, endDate, institutionCode, languageCode); html.Append("<p class=\"pageheader\">"); html.Append(tl.Count + " title"); if (tl.Count != 1) html.Append("s"); html.Append(" with a publication start date between " + startDate.ToString() + " and " + endDate.ToString()); html.Append("</p>"); html.Append("<ul>"); foreach (Data.Title t in tl) { if (t.StartYear != curYear) { curYear = t.StartYear; html.Append("</ul><p class=\"pageheader\">" + curYear.Value.ToString() + "</p><ul>"); } html.Append("<li><a href=\"/bibliography/" + t.TitleID.ToString() + "\">" + t.FullTitle + " " + (t.PartNumber ?? "") + " " + (t.PartName ?? "") + "</a><br />"); html.Append("Publication Info: " + t.PublicationDetails + "<br>"); html.Append("Contributed By: " + t.InstitutionName + "</li>"); } html.Append("</ul>"); // Cache the HTML fragment Cache.Add(cacheKey, html.ToString(), null, DateTime.Now.AddMinutes( Convert.ToDouble(ConfigurationManager.AppSettings["BrowseQueryCacheTime"])), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null); } return ( html.ToString() ); }