private void GenerateGeographicHtmlPages(RegionFilterModel filterModel) { CreateTopLevelRegionsFile(_currentRoot); var regions = _queryManager.GetRegions() .ToList(); foreach (var currentRegion in regions) { if (filterModel == null || ((filterModel.Name.IsNullOrEmpty() || currentRegion.Name == filterModel.Name))) { CreateAllFilesForRegion(currentRegion, filterModel); } } }
private void GenerateContent() { var filter = new RegionFilterModel { // UA //Name = "North West", //Division = "Cheshire West and Chester" // London borough //Name = "London", //Division = "Bromley" // W District //Name = "Wales", //Division = "Bridgend" // Sc District //Name = "Scotland", //Division = "Glasgow City" //// NI District //Name = "Northern Ireland", //Division = "Strabane" // Met County Name = "North East", Division = "Tyne and Wear" //Name = "North West", //Division = "Greater Manchester" //Name = "South West", //Division = "Devon", //// County //Name = "North West", //Division = "Cumbria" // British Isles }; // GenerateGeographicHtmlPages(filter); GenerateGeographicHtmlPages(null); }
private void CreateAllFilesForRegion(Authority region, RegionFilterModel filterModel) { int orgsInRegionCount; if (region.IsOutsideUnitedKingdom) { orgsInRegionCount = region.HauntedPubCount; } else { var firstDescendantAuthoritiesInRegion = _queryManager.GetHauntedFirstDescendantAuthoritiesInRegion(region.Id); orgsInRegionCount = firstDescendantAuthoritiesInRegion.Sum(x => x.HauntedPubCount); } if (orgsInRegionCount == 0) { return; } var inRegion = CreateRegionHeaderFile(region, orgsInRegionCount); if (!inRegion.Any()) { CreateAuthorityFilesTop(region); } else { // todo - work out why filterModel == null? var filtered = inRegion.Where(authority => filterModel == null || filterModel.Division.IsNullOrEmpty() || authority.Name == filterModel.Division); foreach (var authority in filtered) { CreateAuthorityFilesTop(authority); } } }