/// <summary> /// Generate a thumbnail from frontpage of a PDF document. /// </summary> /// <param name="document"></param> /// <param name="documentfile"></param> /// <param name="url"></param> /// <returns></returns> private string GenerateThumbnail(Document document, HttpPostedFileBase documentfile, string url) { if (document.documentUrl.Contains(".pdf")) { string filtype; string seofilename = MakeSeoFriendlyDocumentName(documentfile, out filtype, out seofilename); string documentNameSeo = RegisterUrls.MakeSeoFriendlyString(document.name); string input = Path.Combine(Server.MapPath(Constants.DataDirectory + Document.DataDirectory), document.register.seoname + "_" + documentNameSeo + "_v" + document.versionNumber + "_" + seofilename + "." + filtype); string output = Path.Combine(Server.MapPath(Constants.DataDirectory + Document.DataDirectory), document.register.seoname + "_thumbnail_" + documentNameSeo + "_v" + document.versionNumber + "_" + seofilename + ".jpg"); GhostscriptWrapper.GenerateOutput(input, output, GsSettings()); ImageResizer.ImageJob newImage = new ImageResizer.ImageJob(output, output, new ImageResizer.Instructions("maxwidth=160;maxheight=300;quality=75")); newImage.Build(); return(url + document.register.seoname + "_thumbnail_" + documentNameSeo + "_v" + document.versionNumber + "_" + seofilename + ".jpg"); } else if (document.documentUrl.Contains(".xsd")) { return("/Content/xsd.svg"); } else { return("/Content/pdf.jpg"); } }
public ActionResult Create(GeoDataCollection collection, string ownerId) { try { if (!(User.IsInRole(GeonorgeRoles.MetadataAdmin) || User.IsInRole(GeonorgeRoles.MetadataEditor))) { new HttpUnauthorizedResult(); } var org = _dbContext.Organizations.Where(o => o.systemId.ToString() == ownerId).FirstOrDefault(); collection.systemId = Guid.NewGuid(); collection.Organization = org; collection.Owner = ClaimsPrincipal.Current.GetOrganizationName(); collection.SeoName = RegisterUrls.MakeSeoFriendlyString(collection.Title); _dbContext.GeoDataCollections.Add(collection); _dbContext.SaveChanges(); return(Redirect("Edit?id=" + collection.systemId)); } catch { return(View()); } }
public void UpdateRegisterItem(RegisterItem item) { name = item.name; seoname = RegisterUrls.MakeSeoFriendlyString(name); description = item.description; submitterId = item.submitterId; }
private List <Models.RegisterItem> GetListOfVersions(string versionName, Models.Register register, string Owner) { Models.Version versionGroup = new Models.Version(); versionGroup.systemId = Guid.NewGuid(); versionGroup.lastVersionNumber = 1; List <Models.RegisterItem> versions = new List <Models.RegisterItem>(); for (int i = 0; i < 5; i++) { Models.Document document = new Document(); document.systemId = Guid.Parse("c6056ed8-e040-42ef-b3c8-02f66fbb0ce" + i); document.name = versionName; document.seoname = RegisterUrls.MakeSeoFriendlyString(document.name); Organization organisasjon = NewOrganization(Owner); document.documentowner = organisasjon; document.submitter = organisasjon; document.versionNumber = versionGroup.lastVersionNumber; document.versioning = versionGroup; document.versioningId = versionGroup.systemId; document.register = register; versions.Add(document); versionGroup.lastVersionNumber++; } versionGroup.currentVersion = versions[0].systemId; foreach (Models.RegisterItem doc in versions) { doc.versioning.currentVersion = versionGroup.currentVersion; } return(versions); }
//[Route("kodeliste/{parentregister}/{registerowner}/{registername}/{itemowner}/{itemname}/rediger")] //[Route("kodeliste/{registername}/{itemowner}/{itemname}/rediger")] public ActionResult Edit(CodelistValue codelistValue, string itemowner, string registername, string itemname, string parentregister, List <Guid> narrower, Guid?broader, string registerowner) { var originalCodelistValue = (CodelistValue)_registerItemService.GetRegisterItem(parentregister, registername, itemname, null); if (originalCodelistValue != null) { if (_accessControlService.Access(originalCodelistValue)) { if (ModelState.IsValid) { InitialisationCodelistValue(codelistValue, narrower, broader, originalCodelistValue); if (!NameIsValid(codelistValue)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); Viewbags(originalCodelistValue); return(View(originalCodelistValue)); } _registerItemService.SaveEditedRegisterItem(originalCodelistValue); return(Redirect(RegisterUrls.DeatilsRegisterItemUrl(parentregister, registerowner, registername, itemowner, originalCodelistValue.seoname))); } } else { throw new HttpException(401, "Access Denied"); } } Viewbags(originalCodelistValue); return(View(originalCodelistValue)); }
//[Route("organisasjoner/{parentRegister}/{registerowner}/{registername}/ny")] //[Route("organisasjoner/{registername}/ny")] public ActionResult Create(Organization organization, HttpPostedFileBase fileSmal, HttpPostedFileBase fileLarge, string registername, string parentRegister, HttpPostedFileBase agreementDocument, HttpPostedFileBase priceformDocument, string registerOwner) { organization.register = _registerService.GetRegister(parentRegister, registername); if (organization.register != null) { if (_accessControlService.Access(organization.register)) { if (ModelState.IsValid) { InitializeOrganization(organization, fileSmal, fileLarge, agreementDocument, priceformDocument); if (!NameIsValid(organization)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); return(View(organization)); } _registerItemService.SaveNewRegisterItem(organization); return(Redirect(RegisterUrls.DeatilsRegisterItemUrl(parentRegister, registerOwner, registername, organization.submitter.seoname, organization.seoname))); } else { throw new HttpException(401, "Access Denied"); } } } return(View(organization)); }
public IHttpActionResult GetRegisterItemByName(string registerName, string subregisters = null) { var path = RegisterUrls.GetPath(registerName, subregisters); string systemId = RegisterUrls.GetSystemIdFromPath(registerName + "/" + subregisters); string format = RegisterUrls.GetFileExtension(registerName + "/" + subregisters); path = RegisterUrls.RemoveExtension(path); var mediatype = GetFormattingForMediaType(format); var register = _registerService.GetRegisterByPath(path); if (register == null) { var currentVersion = ConvertCurrentAndVersions(null, registerName, RegisterUrls.GetItemFromPath(subregisters)); if (currentVersion != null) { return(Content(HttpStatusCode.OK, currentVersion, mediatype.Formatter, mediatype.MediaTypeHeader)); } return(NotFound()); } if (!string.IsNullOrEmpty(systemId)) { var currentVersion = ConvertCurrentAndVersions(register, systemId); return(Content(HttpStatusCode.OK, currentVersion, mediatype.Formatter, mediatype.MediaTypeHeader)); } else { var result = (ConvertRegisterAndNextLevel(register)); return(Content(HttpStatusCode.OK, result, mediatype.Formatter, mediatype.MediaTypeHeader)); } }
public InspireDataService UpdateInspireDataService(InspireDataService originalDataService, InspireDataService inspireDataServiceFromKartkatalogen) { originalDataService.Name = inspireDataServiceFromKartkatalogen.Name; originalDataService.Seoname = RegisterUrls.MakeSeoFriendlyString(originalDataService.Name); originalDataService.Description = inspireDataServiceFromKartkatalogen.Description; originalDataService.OwnerId = inspireDataServiceFromKartkatalogen.OwnerId; originalDataService.Modified = DateTime.Now; originalDataService.Uuid = inspireDataServiceFromKartkatalogen.Uuid; originalDataService.InspireDataType = inspireDataServiceFromKartkatalogen.InspireDataType; originalDataService.UpdateInspireTheme(inspireDataServiceFromKartkatalogen.InspireThemes); if (originalDataService.InspireDeliveryMetadata != null) { originalDataService.InspireDeliveryMetadata.StatusId = _datasetDeliveryService.GetMetadataStatus(inspireDataServiceFromKartkatalogen.Uuid, originalDataService.InspireDeliveryMetadata.AutoUpdate, originalDataService.InspireDeliveryMetadata.StatusId); } originalDataService.InspireDeliveryMetadataInSearchService.StatusId = "good"; if (originalDataService.InspireDeliveryServiceStatus != null) { originalDataService.InspireDeliveryServiceStatus.StatusId = _datasetDeliveryService.GetInspireServiceStatus(originalDataService.InspireDataType, inspireDataServiceFromKartkatalogen.Uuid, originalDataService.InspireDeliveryServiceStatus.StatusId); } originalDataService.Url = inspireDataServiceFromKartkatalogen.Url; originalDataService.ServiceType = inspireDataServiceFromKartkatalogen.ServiceType; _dbContext.Entry(originalDataService).State = EntityState.Modified; _dbContext.SaveChanges(); return(originalDataService); }
private void NewInspireDataServiceFromKartkatalogen(InspireDataService inspireDataService, Synchronize synchronizationJob) { if (!_registerItemService.ItemNameIsValid(inspireDataService)) { return; } inspireDataService.SystemId = Guid.NewGuid(); inspireDataService.Seoname = RegisterUrls.MakeSeoFriendlyString(inspireDataService.Name); inspireDataService.SubmitterId = _registerService.GetOrganizationIdByUserName(); inspireDataService.DateSubmitted = DateTime.Now; inspireDataService.Modified = DateTime.Now; inspireDataService.RegisterId = _registerService.GetInspireStatusRegisterId(); inspireDataService.VersioningId = _registerItemService.NewVersioningGroup(inspireDataService); inspireDataService.VersionNumber = 1; inspireDataService.StatusId = "Submitted"; var metadataStatus = _datasetDeliveryService.GetMetadataStatus(inspireDataService.Uuid); var inspireDeliveryMetadataInSearchService = "good"; var inspireDeliveryServiceStatus = _datasetDeliveryService.GetInspireServiceStatus(inspireDataService.InspireDataType, inspireDataService.Uuid, "deficient"); inspireDataService.InspireDeliveryMetadataId = _datasetDeliveryService.CreateDatasetDelivery(metadataStatus); inspireDataService.InspireDeliveryMetadataInSearchServiceId = _datasetDeliveryService.CreateDatasetDelivery(inspireDeliveryMetadataInSearchService); inspireDataService.InspireDeliveryServiceStatusId = _datasetDeliveryService.CreateDatasetDelivery(inspireDeliveryServiceStatus); _dbContext.InspireDataServices.Add(inspireDataService); _dbContext.SaveChanges(); synchronizationJob.AddedLog.Add(new SyncLogEntry(inspireDataService, "Lagt til")); }
//[Route("epsg/{parentRegister}/{registerowner}/{registername}/ny")] //[Route("epsg/{registername}/ny")] public ActionResult Create(EPSG epsgKode, string registername, string parentRegister, string registerowner) { epsgKode.register = _registerService.GetRegister(parentRegister, registername); if (epsgKode.register != null) { if (_accessControlService.Access(epsgKode.register)) { if (ModelState.IsValid) { initialisationEPSG(epsgKode); if (!NameIsValid(epsgKode)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); ViewBag.dimensionId = new SelectList(db.Dimensions.ToList().Select(s => new { value = s.value, description = s.DescriptionTranslated() }).OrderBy(s => s.description), "value", "description", string.Empty); return(View(epsgKode)); } _registerItemService.SaveNewRegisterItem(epsgKode); return(Redirect(RegisterUrls.DeatilsRegisterItemUrl(parentRegister, registerowner, registername, epsgKode.submitter.seoname, epsgKode.seoname))); } else { throw new HttpException(401, "Access Denied"); } } } ViewBag.dimensionId = new SelectList(db.Dimensions.ToList().Select(s => new { value = s.value, description = s.DescriptionTranslated() }).OrderBy(s => s.description), "value", "description", string.Empty); return(View(epsgKode)); }
public void Update(Document document) { systemId = document.systemId; name = document.name; seoname = RegisterUrls.MakeSeoFriendlyString(name); modified = DateTime.Now; description = document.description; approvalDocument = document.approvalDocument; approvalReference = document.approvalReference; UmlModelTreeStructureLink = document.UmlModelTreeStructureLink; ApplicationSchema = document.ApplicationSchema; GMLApplicationSchema = document.GMLApplicationSchema; CartographyFile = document.CartographyFile; CartographyDetailsUrl = document.CartographyDetailsUrl; versionName = document.versionName; versionNumber = document.versionNumber; Accepted = document.Accepted; documentownerId = document.documentownerId; submitterId = document.submitterId; versioningId = document.versioningId; documentUrl = document.documentUrl; documentUrl2 = document.documentUrl2; if(!string.IsNullOrEmpty(document.thumbnail)) thumbnail = document.thumbnail; }
public void UpdateRegisterItem(RegisterItem item, bool transliterNorwegian) { name = item.name; seoname = RegisterUrls.MakeSeoFriendlyString(name, transliterNorwegian); description = item.description; submitterId = item.submitterId; }
private Models.Register CreateRegister(string name = "testregister") { return(new Models.Register() { name = name, seoname = RegisterUrls.MakeSeoFriendlyString(name) }); }
// **** HJELPEMETODER **** private Models.Register NewRegister(string name) { Models.Register register = new Models.Register(); register.systemId = Guid.NewGuid(); register.name = name; register.seoname = RegisterUrls.MakeSeoFriendlyString(register.name); register.description = "testbeskrivelse"; return(register); }
private Models.Organization NewOrganization(string name) { Models.Organization organization = new Models.Organization(); organization.systemId = Guid.NewGuid(); organization.name = name; organization.seoname = RegisterUrls.MakeSeoFriendlyString(organization.name); organization.description = "beskrivelse av organisasjon"; return(organization); }
//[Route("dataset/{parentregister}/{registerowner}/{registername}/{itemowner}/{itemname}/slett")] //[Route("dataset/{registername}/{itemowner}/{itemname}/slett")] //[Route("dataset/{registername}/{itemowner}/{itemname}/slett")] public ActionResult DeleteConfirmed(string registername, string itemname, string parentregister, string registerowner, string itemowner) { Dataset dataset = (Dataset)_registerItemService.GetCurrentRegisterItem(parentregister, registername, itemname); _registerItemService.DeleteCoverageByDatasetId(dataset.systemId); dataset.StatusHistories.Clear(); _registerItemService.SaveDeleteRegisterItem(dataset); return(Redirect(RegisterUrls.registerUrl(parentregister, registerowner, registername))); }
private string SaveFileToDisk(HttpPostedFileBase file, string name, string register, int vnr) { string filtype; string seofilename = RegisterUrls.MakeSeoFriendlyDocumentName(file, out filtype, out seofilename); string filename = register + "_" + name + "_v" + vnr + "_" + seofilename + "." + filtype; var path = Path.Combine("", filename); file.SaveAs(path); return filename; }
public CodelistValue NewCodelistValueFromImport(Models.Register register, string[] codelistValueImport) { //name, description, value //name, description, value, nameTranslated, descriptionTranslated var codelistValue = new CodelistValue(); switch (codelistValueImport.Length) { case 3: break; case 6: codelistValue.Translations.Add(Translation(codelistValueImport, codelistValue)); break; case 10: codelistValue.systemId = Guid.NewGuid(); codelistValue.name = codelistValueImport[0]; codelistValue.value = codelistValueImport[2]; codelistValue.description = codelistValueImport[6]; codelistValue.registerId = register.systemId; codelistValue.register = register; codelistValue.submitterId = _userService.GetUserOrganizationId(); codelistValue.modified = DateTime.Now; codelistValue.dateSubmitted = DateTime.Now; codelistValue.statusId = "Submitted"; codelistValue.seoname = RegisterUrls.MakeSeoFriendlyString(codelistValue.name, register.TransliterNorwegian); return(codelistValue); default: return(null); } codelistValue.systemId = Guid.NewGuid(); codelistValue.name = codelistValueImport[0]; codelistValue.value = codelistValueImport[2]; if (codelistValueImport.Length == 6) { codelistValue.valueEnglish = codelistValueImport[5]; } codelistValue.description = codelistValueImport[1]; codelistValue.registerId = register.systemId; codelistValue.register = register; codelistValue.submitterId = _userService.GetUserOrganizationId(); codelistValue.modified = DateTime.Now; codelistValue.dateSubmitted = DateTime.Now; codelistValue.statusId = "Submitted"; codelistValue.seoname = RegisterUrls.MakeSeoFriendlyString(codelistValue.name, register.TransliterNorwegian); return(codelistValue); }
private Models.Register NewRegister(string name, int accessId = 2) { Models.Register register = new Models.Register(); register.systemId = Guid.NewGuid(); register.name = name; register.seoname = RegisterUrls.MakeSeoFriendlyString(register.name); register.description = "testbeskrivelse"; register.owner = NewOrganization("Kartverket"); register.accessId = accessId; return(register); }
public ActionResult Edit(Models.Register register, string registername, string accessRegister) { if (IsAdmin()) { if (_registerService.validationName(register)) { ModelState.AddModelError("ErrorMessage", Registers.ErrorMessageValidationName); } Models.Register originalRegister = _registerService.GetRegister(null, registername); if (ModelState.IsValid) { if (register.name != null) { originalRegister.name = register.name; } if (register.description != null) { originalRegister.description = register.description; } if (register.ownerId != null) { originalRegister.ownerId = register.ownerId; } if (register.managerId != null) { originalRegister.managerId = register.managerId; } if (register.targetNamespace != null) { originalRegister.targetNamespace = register.targetNamespace; } originalRegister.accessId = register.accessId; originalRegister.parentRegisterId = register.parentRegisterId; originalRegister.seoname = RegisterUrls.MakeSeoFriendlyString(originalRegister.name); originalRegister.modified = DateTime.Now; if (register.statusId != null) { originalRegister = _registerService.SetStatus(register, originalRegister); } _translationService.UpdateTranslations(register, originalRegister); _db.Entry(originalRegister).State = EntityState.Modified; _db.SaveChanges(); Viewbags(register); return(Redirect(RegisterUrls.registerUrl(null, null, registername))); } Viewbags(register); return(View(originalRegister)); } return(HttpNotFound()); }
public void InitializeNew(bool transliterNorwegian) { systemId = Guid.NewGuid(); modified = DateTime.Now; dateSubmitted = DateTime.Now; modified = DateTime.Now; statusId = "Submitted"; seoname = RegisterUrls.MakeSeoFriendlyString(name, transliterNorwegian); versionNumber = 1; if (submitter != null) submitterId = submitter.systemId; if (register != null) registerId = register.systemId; }
public GeodatalovDataset NewGeodatalovDataset(GeodatalovDatasetViewModel geodatalovViewModel, string parentregister, string registername) { var geodatalovDataset = new GeodatalovDataset(); geodatalovDataset.SystemId = Guid.NewGuid(); geodatalovDataset.Name = geodatalovViewModel.Name; geodatalovDataset.Seoname = RegisterUrls.MakeSeoFriendlyString(geodatalovDataset.Name); geodatalovDataset.Description = geodatalovViewModel.Description; geodatalovDataset.SubmitterId = _registerService.GetOrganizationIdByUserName(); geodatalovDataset.OwnerId = geodatalovViewModel.OwnerId; geodatalovDataset.DateSubmitted = DateTime.Now; geodatalovDataset.Modified = DateTime.Now; geodatalovDataset.RegisterId = _registerService.GetRegisterId(parentregister, registername); geodatalovDataset.VersioningId = _registerItemService.NewVersioningGroup(geodatalovDataset); geodatalovDataset.VersionNumber = 1; geodatalovDataset.StatusId = "Submitted"; geodatalovDataset.Uuid = geodatalovViewModel.Uuid; geodatalovDataset.Notes = geodatalovViewModel.Notes; geodatalovDataset.SpecificUsage = geodatalovViewModel.SpecificUsage; geodatalovDataset.ProductSheetUrl = geodatalovViewModel.ProductSheetUrl; geodatalovDataset.PresentationRulesUrl = geodatalovViewModel.PresentationRulesUrl; geodatalovDataset.ProductSpecificationUrl = geodatalovViewModel.ProductSpecificationUrl; geodatalovDataset.MetadataUrl = geodatalovViewModel.MetadataUrl; geodatalovDataset.DistributionFormat = geodatalovViewModel.DistributionFormat; geodatalovDataset.DistributionUrl = geodatalovViewModel.DistributionUrl; geodatalovDataset.DistributionArea = geodatalovViewModel.DistributionArea; geodatalovDataset.WmsUrl = geodatalovViewModel.WmsUrl; geodatalovDataset.ThemeGroupId = geodatalovViewModel.ThemeGroupId; geodatalovDataset.DatasetThumbnail = geodatalovViewModel.DatasetThumbnail; geodatalovDataset.DokStatusId = "Proposal"; geodatalovDataset.UuidService = geodatalovViewModel.UuidService; GetDeliveryStatuses(geodatalovViewModel, geodatalovDataset); geodatalovDataset.InspireTheme = geodatalovViewModel.InspireTheme; geodatalovDataset.Dok = geodatalovViewModel.Dok; geodatalovDataset.NationalDataset = geodatalovViewModel.NationalDataset; geodatalovDataset.Plan = geodatalovViewModel.Plan; geodatalovDataset.Geodatalov = geodatalovViewModel.Geodatalov; geodatalovDataset.MetadataStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.MetadataStatusId, geodatalovViewModel.MetadataNote); geodatalovDataset.ProductSpesificationStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); geodatalovDataset.SosiDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); geodatalovDataset.GmlDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); geodatalovDataset.WmsStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); geodatalovDataset.WfsStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WfsStatusId, geodatalovViewModel.WfsNote); geodatalovDataset.AtomFeedStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.AtomFeedStatusId, geodatalovViewModel.AtomFeedNote); geodatalovDataset.CommonStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); _dbContext.GeodatalovDatasets.Add(geodatalovDataset); _dbContext.SaveChanges(); return(geodatalovDataset); }
private string SaveFileToDisk(HttpPostedFileBase file, string name, string register, int vnr) { string filtype; string seofilename = MakeSeoFriendlyDocumentName(file, out filtype, out seofilename); name = RegisterUrls.MakeSeoFriendlyString(name); string filename = register + "_" + name + "_v" + vnr + "_" + seofilename + "." + filtype; var path = Path.Combine(Server.MapPath(Constants.DataDirectory + Document.DataDirectory), filename); file.SaveAs(path); return(filename); }
public ActionResult Import(HttpPostedFileBase csvfile) { string filename = "import_" + Path.GetFileName(csvfile.FileName); var path = Path.Combine(Server.MapPath(Constants.DataDirectory + Organization.DataDirectory), filename); csvfile.SaveAs(path); var lines = System.IO.File.ReadAllLines(path).Select(a => a.Split(';')).Skip(1); foreach (var org in lines) { //orgnr, navn, beskrivelse, logo Organization organization = new Organization(); organization.systemId = Guid.NewGuid(); organization.number = org[0]; organization.name = org[1]; organization.description = org[2]; if (organization.name == null) { organization.name = "ikke angitt"; } string currentUserOrganizationName = CurrentUserOrganizationName(); var queryResultsOrganization = from o in _dbContext.Organizations where o.name == currentUserOrganizationName select o.systemId; Guid orgId = queryResultsOrganization.FirstOrDefault(); Organization submitterOrganisasjon = _dbContext.Organizations.Find(orgId); organization.submitterId = orgId; organization.submitter = submitterOrganisasjon; var queryResultsRegister = from o in _dbContext.Registers where o.name == "Organisasjoner" select o.systemId; Guid regId = queryResultsRegister.FirstOrDefault(); organization.modified = DateTime.Now; organization.dateSubmitted = DateTime.Now; organization.registerId = regId; organization.statusId = "Submitted"; organization.seoname = RegisterUrls.MakeSeoFriendlyString(organization.name); organization.logoFilename = org[3]; organization.largeLogo = org[3]; _dbContext.RegisterItems.Add(organization); _dbContext.SaveChanges(); } return(Redirect("/register/organisasjoner")); }
public InspireDataset NewInspireDataset(InspireDatasetViewModel inspireDatasetViewModel, string parentregister, string registername) { var inspireDataset = new InspireDataset(); inspireDataset.SystemId = Guid.NewGuid(); inspireDataset.Name = inspireDatasetViewModel.Name; inspireDataset.Seoname = RegisterUrls.MakeSeoFriendlyString(inspireDataset.Name); inspireDataset.Description = inspireDatasetViewModel.Description; inspireDataset.SubmitterId = _registerService.GetOrganizationIdByUserName(); inspireDataset.OwnerId = inspireDatasetViewModel.OwnerId; inspireDataset.DateSubmitted = DateTime.Now; inspireDataset.Modified = DateTime.Now; inspireDataset.RegisterId = _registerService.GetRegisterId(parentregister, registername); inspireDataset.VersioningId = _registerItemService.NewVersioningGroup(inspireDataset); inspireDataset.VersionNumber = 1; inspireDataset.StatusId = "Submitted"; inspireDataset.Uuid = inspireDatasetViewModel.Uuid; inspireDataset.Notes = inspireDatasetViewModel.Notes; inspireDataset.SpecificUsage = inspireDatasetViewModel.SpecificUsage; inspireDataset.ProductSheetUrl = inspireDatasetViewModel.ProductSheetUrl; inspireDataset.PresentationRulesUrl = inspireDatasetViewModel.PresentationRulesUrl; inspireDataset.ProductSpecificationUrl = inspireDatasetViewModel.ProductSpecificationUrl; inspireDataset.MetadataUrl = inspireDatasetViewModel.MetadataUrl; inspireDataset.DistributionFormat = inspireDatasetViewModel.DistributionFormat; inspireDataset.DistributionUrl = inspireDatasetViewModel.DistributionUrl; inspireDataset.DistributionArea = inspireDatasetViewModel.DistributionArea; inspireDataset.WmsUrl = inspireDatasetViewModel.WmsUrl; inspireDataset.ThemeGroupId = inspireDatasetViewModel.ThemeGroupId; inspireDataset.DatasetThumbnail = inspireDatasetViewModel.DatasetThumbnail; inspireDataset.DokStatusId = "Proposal"; inspireDataset.UuidService = inspireDatasetViewModel.UuidService; GetDeliveryStatuses(inspireDatasetViewModel, inspireDataset); inspireDataset.InspireThemes = inspireDatasetViewModel.InspireThemes; inspireDataset.InspireDeliveryMetadataId = _datasetDeliveryService.CreateDatasetDelivery(inspireDatasetViewModel.MetadataStatusId, inspireDatasetViewModel.MetadataNote); inspireDataset.InspireDeliveryMetadataServiceId = _datasetDeliveryService.CreateDatasetDelivery(inspireDatasetViewModel.MetadataServiceStatusId, inspireDatasetViewModel.MetadataServiceNote); inspireDataset.InspireDeliveryDistributionId = _datasetDeliveryService.CreateDatasetDelivery(inspireDatasetViewModel.DistributionStatusId, inspireDatasetViewModel.DistributionNote); inspireDataset.InspireDeliveryWmsId = _datasetDeliveryService.CreateDatasetDelivery(inspireDatasetViewModel.WmsStatusId, inspireDatasetViewModel.WmsNote); inspireDataset.InspireDeliveryWfsId = _datasetDeliveryService.CreateDatasetDelivery(inspireDatasetViewModel.WfsStatusId, inspireDatasetViewModel.WfsNote); inspireDataset.InspireDeliveryAtomFeedId = _datasetDeliveryService.CreateDatasetDelivery(inspireDatasetViewModel.AtomFeedStatusId, inspireDatasetViewModel.AtomFeedNote); inspireDataset.InspireDeliveryWfsOrAtomId = _datasetDeliveryService.CreateDatasetDelivery(inspireDatasetViewModel.WfsOrAtomStatusId, inspireDatasetViewModel.WfsOrAtomNote); inspireDataset.InspireDeliveryHarmonizedDataId = _datasetDeliveryService.CreateDatasetDelivery(inspireDatasetViewModel.HarmonizedDataStatusId, inspireDatasetViewModel.HarmonizedDataNote); inspireDataset.InspireDeliverySpatialDataServiceId = _datasetDeliveryService.CreateDatasetDelivery(inspireDatasetViewModel.SpatialDataServiceStatusId, inspireDatasetViewModel.SpatialDataServiceNote); _dbContext.InspireDatasets.Add(inspireDataset); _dbContext.SaveChanges(); return(inspireDataset); }
private static void MakeSeoFriendlyDocumentName(HttpPostedFileBase file, out string filtype, out string seofilename) { string[] documentfilename = file.FileName.Split('.'); filtype = documentfilename.Last(); seofilename = null; foreach (string item in documentfilename) { if (item == filtype) { break; } seofilename += RegisterUrls.MakeSeoFriendlyString(item) + "_"; } }
// **** HJELPEMETODER **** private Models.Register NewRegister(string name) { Models.Register register = new Models.Register(); register.systemId = Guid.NewGuid(); register.name = name; register.seoname = RegisterUrls.MakeSeoFriendlyString(register.name); register.description = "testbeskrivelse"; register.owner = NewOrganization("Testorg"); register.Translations.Add(new Models.Translations.RegisterTranslation { CultureName = Culture.NorwegianCode }); register.AddMissingTranslations(); return(register); }
public MareanoDataset NewMareanoDataset(MareanoDatasetViewModel MareanoViewModel, string parentregister, string registername) { var MareanoDataset = new MareanoDataset(); MareanoDataset.SystemId = Guid.NewGuid(); MareanoDataset.Name = MareanoViewModel.Name; MareanoDataset.Seoname = RegisterUrls.MakeSeoFriendlyString(MareanoDataset.Name); MareanoDataset.Description = MareanoViewModel.Description; MareanoDataset.SubmitterId = _registerService.GetOrganizationIdByUserName(); MareanoDataset.OwnerId = MareanoViewModel.OwnerId; MareanoDataset.DateSubmitted = DateTime.Now; MareanoDataset.Modified = DateTime.Now; MareanoDataset.RegisterId = _registerService.GetRegisterId(parentregister, registername); MareanoDataset.VersioningId = _registerItemService.NewVersioningGroup(MareanoDataset); MareanoDataset.VersionNumber = 1; MareanoDataset.StatusId = "Submitted"; MareanoDataset.Uuid = MareanoViewModel.Uuid; MareanoDataset.Notes = MareanoViewModel.Notes; MareanoDataset.SpecificUsage = MareanoViewModel.SpecificUsage; MareanoDataset.ProductSheetUrl = MareanoViewModel.ProductSheetUrl; MareanoDataset.PresentationRulesUrl = MareanoViewModel.PresentationRulesUrl; MareanoDataset.ProductSpecificationUrl = MareanoViewModel.ProductSpecificationUrl; MareanoDataset.MetadataUrl = MareanoViewModel.MetadataUrl; MareanoDataset.DistributionFormat = MareanoViewModel.DistributionFormat; MareanoDataset.DistributionUrl = MareanoViewModel.DistributionUrl; MareanoDataset.DistributionArea = MareanoViewModel.DistributionArea; MareanoDataset.WmsUrl = MareanoViewModel.WmsUrl; MareanoDataset.ThemeGroupId = MareanoViewModel.ThemeGroupId; MareanoDataset.DatasetThumbnail = MareanoViewModel.DatasetThumbnail; MareanoDataset.DokStatusId = "Proposal"; MareanoDataset.UuidService = MareanoViewModel.UuidService; GetDeliveryStatuses(MareanoViewModel, MareanoDataset); MareanoDataset.MetadataStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.MetadataStatusId, MareanoViewModel.MetadataNote); MareanoDataset.ProductSpesificationStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.SosiDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.GmlDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.WmsStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.WfsStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WfsStatusId, MareanoViewModel.WfsNote); MareanoDataset.AtomFeedStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.AtomFeedStatusId, MareanoViewModel.AtomFeedNote); MareanoDataset.CommonStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.Grade = GetGrade(MareanoDataset); _dbContext.MareanoDatasets.Add(MareanoDataset); _dbContext.SaveChanges(); return(MareanoDataset); }
private Dataset NewDataset(string name) { Dataset dataset = new Dataset(); dataset.systemId = Guid.NewGuid(); dataset.name = name; dataset.seoname = RegisterUrls.MakeSeoFriendlyString(dataset.name); dataset.description = "testbeskrivelse"; dataset.datasetowner = NewOrganization("Testorg"); dataset.datasetownerId = dataset.datasetowner.systemId; dataset.submitter = dataset.datasetowner; dataset.submitterId = dataset.submitterId; dataset.versionNumber = 1; dataset.register = NewRegister("DOK-statusregisteret"); return(dataset); }
private void NewMareanoDatasetFromKartkatalogen(MareanoDataset MareanoDataset) { if (!_registerItemService.ItemNameIsValid(MareanoDataset)) { return; } MareanoDataset.SystemId = Guid.NewGuid(); MareanoDataset.Seoname = RegisterUrls.MakeSeoFriendlyString(MareanoDataset.Name); MareanoDataset.SubmitterId = _registerService.GetOrganizationIdByUserName(); MareanoDataset.DateSubmitted = DateTime.Now; MareanoDataset.Modified = DateTime.Now; MareanoDataset.RegisterId = _registerService.GetMareanoStatusRegisterId(); MareanoDataset.VersioningId = _registerItemService.NewVersioningGroup(MareanoDataset); MareanoDataset.VersionNumber = 1; MareanoDataset.StatusId = "Submitted"; MareanoDataset.DokStatusId = "Proposal"; var metadataStatusId = _datasetDeliveryService.GetMetadataStatus(MareanoDataset.Uuid); var productSpesificationStatusId = _registerService.GetDOKStatus(MareanoDataset.ProductSpecificationUrl, true, "deficient"); var productSheetStatusId = _registerService.GetDOKStatus(MareanoDataset.ProductSheetUrl, true, "deficient"); var presentationRulesStatusId = _registerService.GetDOKStatus(MareanoDataset.PresentationRulesUrl, true, "deficient"); var sosiDataStatusId = _registerService.GetSosiRequirements(MareanoDataset.Uuid, "", true, "deficient"); var gmlDataStatusId = _registerService.GetGmlRequirements(MareanoDataset.Uuid, true, "deficient"); var wmsStatusId = _datasetDeliveryService.GetDokDeliveryServiceStatus(MareanoDataset.Uuid, true, "deficient", MareanoDataset.UuidService); var wfsStatusId = _datasetDeliveryService.GetWfsStatus(MareanoDataset.Uuid); var atomFeedStatusId = _datasetDeliveryService.GetAtomFeedStatus(MareanoDataset.Uuid); var commonStatusId = _datasetDeliveryService.GetDownloadRequirementsStatus(wfsStatusId, atomFeedStatusId); MareanoDataset.MetadataStatusId = _datasetDeliveryService.CreateDatasetDelivery(metadataStatusId); MareanoDataset.ProductSpesificationStatusId = _datasetDeliveryService.CreateDatasetDelivery(productSpesificationStatusId); MareanoDataset.ProductSheetStatusId = _datasetDeliveryService.CreateDatasetDelivery(productSheetStatusId); MareanoDataset.PresentationRulesStatusId = _datasetDeliveryService.CreateDatasetDelivery(presentationRulesStatusId); MareanoDataset.SosiDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(sosiDataStatusId); MareanoDataset.GmlDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(gmlDataStatusId); MareanoDataset.WmsStatusId = _datasetDeliveryService.CreateDatasetDelivery(wmsStatusId); MareanoDataset.WfsStatusId = _datasetDeliveryService.CreateDatasetDelivery(wfsStatusId); MareanoDataset.AtomFeedStatusId = _datasetDeliveryService.CreateDatasetDelivery(atomFeedStatusId); MareanoDataset.CommonStatusId = _datasetDeliveryService.CreateDatasetDelivery(commonStatusId); MareanoDataset.Grade = GetGrade(MareanoDataset); SetFAIR(ref MareanoDataset); _dbContext.MareanoDatasets.Add(MareanoDataset); _dbContext.SaveChanges(); }