// GET: Municipality/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var municipality = await _service.Get(id.Value); if (municipality == null) { return(NotFound()); } return(View(municipality)); }
public IActionResult Municipality([FromQuery] int id) { ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, false)); IMunicipality municipality = _municipalityService.Get(id); MapViewModel mapViewModel = new MapViewModel(municipality); 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.GetByMunicipality(id), AdministrativeUnitName = municipality.Name, Type = AdministrativeUnitType.Municipality, LegendItemStyles = _dataQualityClassificationService.GetLegendItemStyles(), MetadataUrl = _metadataUrl, MapViewModel = mapViewModel }; return(View("Views/FkbData/DataContent/Aspects/DataQualityClassification.cshtml", model)); }
public IActionResult Get(int id) { var municipality = _municipalityService.Get(id); if (municipality == null) { return(NotFound()); } return(Ok(municipality)); }
public IActionResult Municipality([FromQuery] int id) { ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, false)); IMunicipality municipality = _municipalityService.Get(id); MapViewModel mapViewModel = new MapViewModel(municipality); DataQualityDistributionViewModel model = new DataQualityDistributionViewModel( _dataQualityDistributionService.GetByMunicipality(id), _applicationSettings.QualityCategoryColors, _applicationSettings.DataQualityDataSetToLayerMap) { AdministrativeUnitName = municipality.Name, Type = AdministrativeUnitType.Municipality, 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 Index( string municipalityNumber, int officeId, MappingProjectState state, RelevantMappingProjectDeliveryType deliveryType, int year) { MappingProjectViewModel model = new MappingProjectViewModel( _mappingProjectService.Get(municipalityNumber, officeId, state, deliveryType, year), _municipalityService.Get(), _offices.Get(), municipalityNumber, officeId, state, deliveryType, year); return(View("Views/MappingProjects/Geovekst/Projects/Projects.cshtml", model)); }
public IActionResult Municipality([FromQuery] int id) { IMunicipality municipality = _municipalityService.Get(id); MunicipalityViewModel model = new MunicipalityViewModel() { DataSets = GetDataSets(id), Name = municipality.Name }; _dbContext.Database.OpenConnection(); using (var command = _dbContext.Database.GetDbConnection().CreateCommand()) { command.CommandText = "SELECT [GeosynkInnfort] FROM [KOS_Prod_Replika].[dbo].[PlanInfo] where [Kommune_Kommunenr] = @kommunenr"; command.Parameters.Add(new SqlParameter("@kommunenr", id)); using (var result = command.ExecuteReader()) { if (result.HasRows) { result.Read(); var geosynkInnfort = !result.IsDBNull(0) ? result.GetString(0) :""; if (!string.IsNullOrEmpty(geosynkInnfort)) { model.StatusMessage = "Geosynkronisering av plandata innført: " + FormatDate(geosynkInnfort); } else { model.StatusMessage = "Geosynkronisering av plandata ikke innført"; } } } } ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, false)); return(View("Views/NAP/Management/Aspects/Geosynchronization/Municipality.cshtml", model)); }
public IActionResult Municipality([FromQuery] int id) { ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, false)); IMunicipality municipality = _municipalityService.Get(id); MapViewModel mapViewModel = new MapViewModel(municipality); List <ITransactionData> transactionData = _transactionDataService.GetByMunicipality(id); mapViewModel.AddService(_ServiceType, _url, _Layer); TransactionDataViewModel model = new TransactionDataViewModel { TransactionData = transactionData, AdministrativeUnitName = municipality.Name, LegendItemStyles = _transactionDataService.GetLayerStyles(transactionData), MapViewModel = mapViewModel, MetadataUrl = _metadataUrl }; return(View("Views/FkbData/Management/Aspects/TransactionData/Municipality.cshtml", model)); }
public IActionResult Municipality([FromQuery] int id) { IMunicipality municipality = _municipalityService.Get(id); MunicipalityViewModel model = new MunicipalityViewModel() { DataSets = _dataSetService.GetByMunicipality(id), Name = municipality.Name }; switch (municipality.IntroductionState) { case IntroductionState.NotIntroduced: model.Caption = "Ikke planlagt innføring av direkteoppdatering i Sentral FKB"; break; case IntroductionState.Planned: model.Caption = "Direkteoppdatering i Sentral FKB planlagt innført {0}"; model.DateTime = municipality.PlannedIntroductionDate; break; case IntroductionState.Introduced: model.Caption = "Direkteoppdatering i Sentral FKB innført {0}"; model.DateTime = municipality.IntroductionDate; break; case IntroductionState.Geosynch: model.Caption = "Geosynkronisering innført"; break; default: throw new InvalidEnumArgumentException(); } ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, false)); return(View("Views/FkbData/Management/Aspects/DirectUpdateInfo/Municipality.cshtml", model)); }
public string GetFileName() { return(_provider.GetFileName(_geonerator, _municipalityService.Get(), "25833")); }