public IActionResult County([FromQuery] int id) { ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, true)); ICounty county = _countyService.Get(id); MapViewModel mapViewModel = new MapViewModel(county); string sld = _dataQualityClassificationService.GetSld(); Dictionary <string, string> customParameters = new Dictionary <string, string> { { "SLD_BODY", sld } }; mapViewModel.AddService(_ServiceType, _url, _Layer, customParameters); AddAdminUnitsToServices(mapViewModel); DataQualityClassificationViewModel model = new DataQualityClassificationViewModel { Classifications = _dataQualityClassificationService.GetByCounty(id), AdministrativeUnitName = county.Name, Type = AdministrativeUnitType.County, LegendItemStyles = _dataQualityClassificationService.GetLegendItemStyles(), MetadataUrl = _metadataUrl, MapViewModel = mapViewModel }; return(View("Views/FkbData/DataContent/Aspects/DataQualityClassification.cshtml", model)); }
// GET: Admin/Counties/Details/5 public IActionResult Details(string id) { if (id == null) { return(NotFound()); } var county = countyService.Get(id); if (county == null) { return(NotFound()); } return(View(county)); }
public IActionResult Country() { string url = $"{_applicationSettings.UrlThematicGeoJson}/{_geoJsonService.GetFileName()}"; MapViewModel mapViewModel = new MapViewModel(); mapViewModel.AddService(_serviceType, url, _layer); CountiesViewModel model = new CountiesViewModel() { Counties = _countyService.Get(), MapViewModel = mapViewModel }; model.DirectUpdateCount = model.Counties.Sum(c => c.DirectUpdateCount); ViewBag.ContextViewModel = _contextViewModelHelper.Create(); return(View("Views/FkbData/Management/Aspects/DirectUpdateInfo/Country.cshtml", model)); }
public async Task WhenToRunTheGetMethod() { _serviceMock = new Mock <ICountyService>(); _serviceMock.Setup(m => m.Get(IdCounty)).ReturnsAsync(countyDto); _serviceCounty = _serviceMock.Object; var result = await _serviceCounty.Get(IdCounty); Assert.NotNull(result); Assert.True(result.Id == IdCounty); Assert.Equal(NameCounty, result.Name); Assert.Equal(CodeIbgeCounty, result.CodeIbge); _serviceMock = new Mock <ICountyService>(); _serviceMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(Task.FromResult((CountyDto)null)); _serviceCounty = _serviceMock.Object; result = await _serviceCounty.Get(IdCounty); Assert.Null(result); }
public IActionResult County([FromQuery] int id) { ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, true)); ICounty county = _countyService.Get(id); MapViewModel mapViewModel = new MapViewModel(county); DataQualityDistributionViewModel model = new DataQualityDistributionViewModel( _dataQualityDistributionService.GetByCounty(id), _applicationSettings.QualityCategoryColors, _applicationSettings.DataQualityDataSetToLayerMap) { AdministrativeUnitName = county.Name, Type = AdministrativeUnitType.County, MetadataUrl = _applicationSettings.ExternalUrls.MetadataDataQualityDistribution, MapViewModel = mapViewModel }; return(View("Views/FkbData/DataContent/Aspects/DataQualityDistribution.cshtml", model)); }
public ContextViewModel Create(string selectedKey = "") { ContextViewModel viewModel = new ContextViewModel(); List <ICounty> counties = _countyService.Get(); List <IMunicipality> municipalities = _municipalityService.Get(); counties.Sort((x, y) => x.Name.CompareTo(y.Name)); municipalities.Sort((x, y) => x.Name.CompareTo(y.Name)); counties.ForEach(c => viewModel.Counties.Add($"F{c.Id}", c.Name)); int count = municipalities.Count; CultureInfo cultureInfo = new System.Globalization.CultureInfo("nb-NO"); for (int i = 0; i < municipalities.Count; ++i) { if (i < count - 1 && municipalities[i].Name == municipalities[i + 1].Name) { string county1 = _countyService.GetByMunicipalityId(municipalities[i].Id).Name; string county2 = _countyService.GetByMunicipalityId(municipalities[i + 1].Id).Name; if (string.Compare(county1, county2, cultureInfo, CompareOptions.None) > 0) { viewModel.Municipalities.Add($"M{municipalities[i + 1].Id}", $"{municipalities[i + 1].Name} i {county2}"); viewModel.Municipalities.Add($"M{municipalities[i].Id}", $"{municipalities[i].Name} i {county1}"); } else { viewModel.Municipalities.Add($"M{municipalities[i].Id}", $"{municipalities[i].Name} i {county1}"); viewModel.Municipalities.Add($"M{municipalities[i + 1].Id}", $"{municipalities[i + 1].Name} i {county2}"); } ++i; } else { viewModel.Municipalities.Add($"M{municipalities[i].Id}", municipalities[i].Name); } } viewModel.SelectedKey = selectedKey; return(viewModel); }
public IActionResult County([FromQuery] int id) { ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, true)); ICounty county = _countyService.Get(id); MapViewModel mapViewModel = new MapViewModel(county); List <ITransactionData> transactionData = _transactionDataService.GetByCounty(id); mapViewModel.AddService(_ServiceType, _url, _Layer); TransactionDataViewModel model = new TransactionDataViewModel { TransactionData = transactionData, AdministrativeUnitName = county.Name, LegendItemStyles = _transactionDataService.GetLayerStyles(transactionData), MapViewModel = mapViewModel, MetadataUrl = _metadataUrl }; return(View("Views/FkbData/Management/Aspects/TransactionData/County.cshtml", model)); }
public IActionResult County([FromQuery] int id) { ICounty county = _countyService.Get(id); MunicipalitiesViewModel model = new MunicipalitiesViewModel() { CountyName = county.Name }; string idSql = id.ToString(); if (idSql.Length == 1) { idSql = "0" + idSql; } _dbContext.Database.OpenConnection(); using (var command = _dbContext.Database.GetDbConnection().CreateCommand()) { command.CommandText = "SELECT COUNT(PlanInfo.Kommune_Kommunenr) AS TotalKommunerCount FROM PlanInfo INNER JOIN Kommune ON PlanInfo.Kommune_Kommunenr = Kommune.Kommunenr INNER JOIN Fylke ON Kommune.Fylke_Fylkesnr = Fylke.Fylkesnr WHERE (Kommune.Aktiv = 1) AND (Fylke.Fylkesnr = @fylkesnr)"; command.Parameters.Add(new SqlParameter("@fylkesnr", id)); using (var result = command.ExecuteReader()) { if (result.HasRows) { result.Read(); model.Count = result.GetInt32(0); } } } using (var command = _dbContext.Database.GetDbConnection().CreateCommand()) { command.CommandText = "SELECT COUNT(PlanInfo.Kommune_Kommunenr) AS GeosynchIntroducedCount FROM PlanInfo INNER JOIN Kommune ON PlanInfo.Kommune_Kommunenr = Kommune.Kommunenr INNER JOIN Fylke ON Kommune.Fylke_Fylkesnr = Fylke.Fylkesnr WHERE(PlanInfo.GeosynkInnfort IS NOT NULL) AND (Kommune.Aktiv = 1) AND (Fylke.Fylkesnr = @fylkesnr)"; command.Parameters.Add(new SqlParameter("@fylkesnr", id)); using (var result = command.ExecuteReader()) { if (result.HasRows) { result.Read(); model.CountGeosynch = result.GetInt32(0); } } } using (var command = _dbContext.Database.GetDbConnection().CreateCommand()) { command.CommandText = "SELECT DISTINCT FDVProsjekt.Kommune_Kommunenr, Kommune.Kommunenavn, FDVDatasettForvaltningstype.Type FROM FDVDatasett INNER JOIN FDVProsjekt ON FDVDatasett.FDVProsjekt_Id = FDVProsjekt.Id INNER JOIN Kommune ON FDVProsjekt.Kommune_Kommunenr = Kommune.Kommunenr INNER JOIN Datasett ON FDVDatasett.Datasett_Id = Datasett.Id LEFT OUTER JOIN FDVDatasettForvaltningstype ON FDVDatasett.FDVDatasettForvaltningstype_Id = FDVDatasettForvaltningstype.Id WHERE Datasett.Navn = 'Reguleringsplan - vedtatt' and(FDVProsjekt.Kommune_Kommunenr LIKE @fylkesnr) AND(Kommune.Aktiv = 1) AND(FDVProsjekt.Aktiv = 1) and FDVProsjekt.Ar = (select max(Ar) from FDVProsjekt where Kommune_Kommunenr LIKE @fylkesnr ) GROUP BY FDVProsjekt.Ar,FDVProsjekt.Kommune_Kommunenr, FDVDatasettForvaltningstype.Type, Kommune.Kommunenavn ORDER BY FDVProsjekt.Kommune_Kommunenr"; command.Parameters.Add(new SqlParameter("@fylkesnr", idSql + "%")); using (var result = command.ExecuteReader()) { model.Municipalities = new List <GeosynchInfo>(); while (result.Read()) { GeosynchInfo geosynchInfo = new GeosynchInfo(); geosynchInfo.MunicipalityNumber = result.GetString(0); geosynchInfo.MunicipalityName = result.GetString(1); geosynchInfo.UpdateType = result.GetString(2); if (geosynchInfo.UpdateType == "SOSI originaldata") { geosynchInfo.UpdateType = "Periodisk ajourhold"; } GetStatus(ref geosynchInfo); model.Municipalities.Add(geosynchInfo); } } } ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, true)); return(View("Views/NAP/Management/Aspects/Geosynchronization/County.cshtml", model)); }