private void PrepareViewBagForEditing(MetadataViewModel model) { ViewBag.TopicCategoryValues = new SelectList(GetListOfTopicCategories(), "Key", "Value", model.TopicCategory); ViewBag.SpatialRepresentationValues = new SelectList(GetListOfSpatialRepresentations(), "Key", "Value", model.SpatialRepresentation); ViewBag.VectorFormats = new SelectList(GetListOfVectorFormats(), "Key", "Value"); ViewBag.RasterFormats = new SelectList(GetListOfRasterFormats(), "Key", "Value"); ViewBag.predefinedDistributionProtocols = new SelectList(GetListOfpredefinedDistributionProtocols(), "Key", "Value"); ViewBag.UnitsOfDistributionValues = new SelectList(GetListOfUnitsOfDistribution(), "Key", "Value", model.UnitsOfDistribution); ViewBag.MaintenanceFrequencyValues = new SelectList(GetListOfMaintenanceFrequencyValues(), "Key", "Value", model.MaintenanceFrequency); ViewBag.StatusValues = new SelectList(GetListOfStatusValues(), "Key", "Value", model.Status); ViewBag.SecurityConstraintValues = new SelectList(GetListOfClassificationValues(), "Key", "Value", model.SecurityConstraints); ViewBag.UseConstraintValues = new SelectList(GetListOfRestrictionValues(), "Key", "Value", model.UseConstraints); ViewBag.LicenseTypesValues = new SelectList(GetListOfLicenseTypes(), "Key", "Value", model.OtherConstraintsLink); if (!string.IsNullOrEmpty(model.OtherConstraintsAccess) && (model.OtherConstraintsAccess.ToLower() == "no restrictions" || model.OtherConstraintsAccess.ToLower() == "norway digital restricted")) { model.AccessConstraints = model.OtherConstraintsAccess; } ViewBag.AccessConstraintValues = new SelectList(GetListOfRestrictionValuesAdjusted(), "Key", "Value", model.AccessConstraints); ViewBag.CreateProductSheetUrl = System.Web.Configuration.WebConfigurationManager.AppSettings["ProductSheetGeneratorUrl"] + model.Uuid; ViewBag.ThumbnailUrl = System.Web.Configuration.WebConfigurationManager.AppSettings["EditorUrl"] + "thumbnails/"; ViewBag.GeoNetworkViewUrl = GeoNetworkUtil.GetViewUrl(model.Uuid); ViewBag.GeoNetworkXmlDownloadUrl = GeoNetworkUtil.GetXmlDownloadUrl(model.Uuid); var seoUrl = new SeoUrl("", model.Title); ViewBag.KartkatalogViewUrl = System.Web.Configuration.WebConfigurationManager.AppSettings["KartkatalogUrl"] + "Metadata/" + seoUrl.Title + "/" + model.Uuid; Dictionary<string, string> OrganizationList = GetListOfOrganizations(); if (string.IsNullOrEmpty(model.ContactMetadata.Organization)) { if (Request.Form["ContactMetadata.Organization.Old"] != null || !string.IsNullOrWhiteSpace(Request.Form["ContactMetadata.Organization.Old"])) { model.ContactMetadata.Organization = Request.Form["ContactMetadata.Organization.Old"].ToString(); } } if (string.IsNullOrEmpty(model.ContactPublisher.Organization)) { if (Request.Form["ContactPublisher.Organization.Old"] != null || !string.IsNullOrWhiteSpace(Request.Form["ContactPublisher.Organization.Old"])) { model.ContactPublisher.Organization = Request["ContactPublisher.Organization.Old"].ToString(); } } if (string.IsNullOrEmpty(model.ContactOwner.Organization)) { if (Request.Form["ContactOwner.Organization.Old"] != null || !string.IsNullOrWhiteSpace(Request.Form["ContactOwner.Organization.Old"])) { model.ContactOwner.Organization = Request["ContactOwner.Organization.Old"].ToString(); } } ViewBag.OrganizationContactMetadataValues = new SelectList(OrganizationList, "Key", "Value", model.ContactMetadata.Organization); ViewBag.OrganizationContactPublisherValues = new SelectList(OrganizationList, "Key", "Value", model.ContactPublisher.Organization); ViewBag.OrganizationContactOwnerValues = new SelectList(OrganizationList, "Key", "Value", model.ContactOwner.Organization); Dictionary<string, string> ReferenceSystemsList = GetListOfReferenceSystems(); ViewBag.ReferenceSystemsValues = new SelectList(ReferenceSystemsList, "Key", "Value"); ViewBag.NationalThemeValues = new SelectList(GetListOfNationalTheme(), "Key", "Value"); ViewBag.NationalInitiativeValues = new SelectList(GetListOfNationalInitiative(), "Key", "Value"); ViewBag.InspireValues = new SelectList(GetListOfInspire(), "Key", "Value"); IEnumerable<SelectListItem> conceptItems = from concept in model.KeywordsConcept select new SelectListItem { Text = concept.Split('|')[0].ToString(), Value = concept.ToString(), Selected = true, }; ViewBag.Concepts = new MultiSelectList(conceptItems,"Value", "Text", conceptItems.Select(c => c.Value).ToArray()); var productspesifications = GetRegister("produktspesifikasjoner", model); if(!string.IsNullOrEmpty(model.ProductSpecificationUrl)) { KeyValuePair<string, string> prodspecSelected = new KeyValuePair<string, string>(model.ProductSpecificationUrl, model.ProductSpecificationUrl); if (!productspesifications.ContainsKey(prodspecSelected.Key)) { productspesifications.Add(prodspecSelected.Key, prodspecSelected.Value); } } ViewBag.ProductspesificationValues = new SelectList(productspesifications, "Key", "Value", model.ProductSpecificationUrl); var orderingInstructions = GetSubRegister("metadata-kodelister/kartverket/norge-digitalt-tjenesteerklaering", model); if (!string.IsNullOrEmpty(model.OrderingInstructions)) { KeyValuePair<string, string> orderingInstructionsSelected = new KeyValuePair<string, string>(model.OrderingInstructions, model.OrderingInstructions); if (!orderingInstructions.ContainsKey(orderingInstructionsSelected.Key)) { orderingInstructions.Add(orderingInstructionsSelected.Key, orderingInstructionsSelected.Value); } } ViewBag.OrderingInstructionsValues = new SelectList(orderingInstructions, "Key", "Value", model.OrderingInstructions); ViewBag.ProductsheetValues = new SelectList(GetRegister("produktark", model), "Key", "Value", model.ProductSheetUrl); ViewBag.LegendDescriptionValues = new SelectList(GetRegister("tegneregler", model), "Key", "Value", model.LegendDescriptionUrl); ViewBag.ValideringUrl = System.Web.Configuration.WebConfigurationManager.AppSettings["ValideringUrl"] + "api/metadata/" + model.Uuid; ViewBag.Municipalities = new KomDataService().GetListOfMunicipalityOrganizations(); ViewBag.ValidModel = true; if (Request.QueryString["metadatacreated"] == null ) { ViewBag.ValidModel = TryValidateModel(model); } }
private void PrepareViewBagForEditing(SimpleMetadataViewModel model) { ViewBag.MaintenanceFrequencyValues = new SelectList(GetListOfMaintenanceFrequencyValues(), "Key", "Value", model.MaintenanceFrequency); ViewBag.CreateProductSheetUrl = System.Web.Configuration.WebConfigurationManager.AppSettings["ProductSheetGeneratorUrl"] + model.Uuid; ViewBag.DatasetUrl = System.Web.Configuration.WebConfigurationManager.AppSettings["DownloadDatasetUrl"]; ViewBag.GeoNetworkViewUrl = GeoNetworkUtil.GetViewUrl(model.Uuid); ViewBag.GeoNetworkXmlDownloadUrl = GeoNetworkUtil.GetXmlDownloadUrl(model.Uuid); var seoUrl = new SeoUrl("", model.Title); ViewBag.KartkatalogViewUrl = System.Web.Configuration.WebConfigurationManager.AppSettings["KartkatalogUrl"] + "Metadata/" + seoUrl.Title + "/" + model.Uuid; ViewBag.predefinedDistributionProtocols = new SelectList(GetListOfpredefinedDistributionProtocols(), "Key", "Value"); Dictionary<string, string> OrganizationList = GetListOfOrganizations(); if (string.IsNullOrEmpty(model.ContactMetadata.Organization)) { if (Request.Form["ContactMetadata.Organization.Old"] != null || !string.IsNullOrWhiteSpace(Request.Form["ContactMetadata.Organization.Old"])) { model.ContactMetadata.Organization = Request.Form["ContactMetadata.Organization.Old"].ToString(); } } if (string.IsNullOrEmpty(model.ContactPublisher.Organization)) { if (Request.Form["ContactPublisher.Organization.Old"] != null || !string.IsNullOrWhiteSpace(Request.Form["ContactPublisher.Organization.Old"])) { model.ContactPublisher.Organization = Request["ContactPublisher.Organization.Old"].ToString(); } } if (string.IsNullOrEmpty(model.ContactOwner.Organization)) { if (Request.Form["ContactOwner.Organization.Old"] != null || !string.IsNullOrWhiteSpace(Request.Form["ContactOwner.Organization.Old"])) { model.ContactOwner.Organization = Request["ContactOwner.Organization.Old"].ToString(); } } ViewBag.OrganizationContactMetadataValues = new SelectList(OrganizationList, "Key", "Value", model.ContactMetadata.Organization); ViewBag.OrganizationContactPublisherValues = new SelectList(OrganizationList, "Key", "Value", model.ContactPublisher.Organization); ViewBag.OrganizationContactOwnerValues = new SelectList(OrganizationList, "Key", "Value", model.ContactOwner.Organization); ViewBag.NationalThemeValues = new SelectList(GetListOfNationalTheme(), "Key", "Value"); ViewBag.NationalInitiativeValues = new SelectList(GetListOfNationalInitiative(), "Key", "Value"); ViewBag.InspireValues = new SelectList(GetListOfInspire(), "Key", "Value"); ViewBag.UseConstraintValues = new SelectList(GetListOfRestrictionValues(), "Key", "Value", model.UseConstraints); ViewBag.LicenseTypesValues = new SelectList(GetListOfLicenseTypes(), "Key", "Value", model.OtherConstraintsLink); ViewBag.ValideringUrl = System.Web.Configuration.WebConfigurationManager.AppSettings["ValideringUrl"] + "api/metadata/" + model.Uuid; ViewBag.Municipalities = new KomDataService().GetListOfMunicipalityOrganizations(); }
public string MetadataViewParameters() { var seoUrl = new SeoUrl(Organization, Title); return "Metadata/"+ seoUrl.Title + "/" + Uuid; }