public override HtmlRegion GetHtmlFromDb(RegionBase region, string pageName) { HtmlRegion htmlRegion = new HtmlRegion(region); if (pageCache == null) { var locations = from towns in context.ChosenTowns where towns.town == pageName select towns; pageCache = locations.FirstOrDefault(); } var data = string.Empty; if (pageCache != null) { string wikiPurl = "http://en.wikipedia.org/wiki/" + pageName; switch (region.mappedObject) { // mapping from objects to database fields case "description": data = pageCache.cleaneddata + "<br /><a target='_blank' href='" + wikiPurl + "' rel='nofollow'><i class='fa fa-wikipedia-w' alt='more from wikipedia' title='more from wikipedia'></i></a>"; break; case "links": data = GetLinks(pageName); break; } } htmlRegion.data = new Html(data); return(htmlRegion); }
public void LoadPageData(string rootPath, string site, string parameter) { foreach (var region in regions) { switch (region.regionType) { case RegionType.Gallery: var galleryRegion = new GalleryRegion(region); galleryRegion.LoadData(rootPath, region.mappedObject, site); galleryRegions.Add(galleryRegion); break; case RegionType.Html: var htmlRegion = new HtmlRegion(region); htmlRegion.LoadData(site, rootPath, title, region.mappedObject); htmlRegions.Add(htmlRegion); break; case RegionType.YouTube: var youtubeRegion = new YouTubeRegion(region); youtubeRegion.LoadData(site, rootPath, title, region.mappedObject); youtubeRegions.Add(youtubeRegion); break; case RegionType.Blog: var blogRegion = new BlogRegion(region); blogRegion.LoadData(rootPath, region.mappedObject, site, parameter, friendlyUrl); blogRegions.Add(blogRegion); break; case RegionType.Map: var mapRegion = new MapRegion(region); mapRegion.LoadData(site, rootPath, title, region.mappedObject); mapRegions.Add(mapRegion); break; } } }
public override HtmlRegion GetHtmlFromDb(RegionBase region, string pageName) { HtmlRegion htmlRegion = new HtmlRegion(region); if (pageCache == null) { var locations = from places in context.ChosenFerrydest where places.Location == pageName select places; pageCache = locations.FirstOrDefault(); } var data = string.Empty; if (pageCache != null) { string wikiPurl = "http://en.wikipedia.org/wiki/" + pageName; switch (region.mappedObject) { // mapping from objects to database fields case "description": string blurb = ("" + pageCache.Cleaneddatax); var selectPos = blurb.IndexOf("<select"); var routes = string.Empty; if (selectPos > 0) { routes = blurb.Substring(selectPos); blurb = blurb.Substring(0, selectPos); } data = blurb; break; } } htmlRegion.data = new Html(data); return(htmlRegion); }