public ActionResult NameAuthoritiesByGuide(ExportViewModel evm) { var resources = AsRepo.GetArchivesSpaceResources(); var found = resources.FirstOrDefault(x => x.title + $" ({x.ead_id})" == evm.NewAsResource); var asUrl = ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id; var requests = SearchNameByAsUri(asUrl); var csv = new StringBuilder(); csv.AppendLine("id,authoritativeLabel,type"); var type = string.Empty; foreach (var result in requests.Results.Docs) { if (result.creator != null && result.creator.Contains(asUrl)) { type = "creator"; } else if (result.source != null && result.source.Contains(asUrl)) { type = "source"; } //else if (result.corporateNameCreator != null && result.corporateNameCreator.Contains(asUrl)) { type = "corporateNameCreator"; } //else if (result.corporateNameSource != null && result.corporateNameSource.Contains(asUrl)) { type = "corporateNameSource"; } //else if (result.familyNameCreator != null && result.familyNameCreator.Contains(asUrl)) { type = "familyNameCreator"; } //else if (result.familyNameSource != null && result.familyNameSource.Contains(asUrl)) { type = "familyNameSource"; } csv.AppendLine($"{result._id},\"{result.authoritativeLabel}\",{type}"); } System.IO.File.WriteAllText(Server.MapPath($"~/Download/{found.ead_id}NameAuths.csv"), csv.ToString(), Encoding.UTF8); return(Redirect($"~/Download/{found.ead_id}NameAuths.csv")); }
public ActionResult Subject() { var vm = new ExportViewModel(); var resources = AsRepo.GetArchivesSpaceResources(); vm.AsResources = resources.Select(x => new SelectListItem { Value = $"{ConfigurationManager.AppSettings["ArchivesSpaceUrl"]}{x.id}", Text = x.title + $" ({x.ead_id})" }); return(View(vm)); }
//public ActionResult Tester() //{ // var resources = AsRepo.GetArchivesSpaceResources(); // //var count = 0; // //for (var i = 0; i < 100; i++) // foreach (var guide in resources) // { // var subs = SearchSubjectByAsUri(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + guide.id); // foreach (var sub in subs.Results.Docs) // { // ViewBag.Results += $"{guide.ead_id}*{sub.authoritativeLabel}*"; // } // ViewBag.Results += "$$"; // //count++; // //if (count == 5) break; // } // return View(); //} public ActionResult SubjectCheck(int id) { ViewBag.ArchivesSpaceUrl = ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + id; var gvm = AsRepo.GetResourceAuthorities(id); var resources = AsRepo.GetArchivesSpaceResources(); gvm.Name = SearchNameByAsUri(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + id); gvm.Subject = SearchSubjectByAsUri(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + id); var match = resources.FirstOrDefault(x => x.id == id); ViewBag.Guide = match.title + $" ({match.ead_id})"; return(View(gvm)); }
// public ActionResult Subject(string id) { var avm = new AssignViewModel(); avm.Doc = GetSubjectDocByUuid(id); var resources = AsRepo.GetArchivesSpaceResources(); avm.AsResources = resources.Select(x => new SelectListItem { Value = $"{ConfigurationManager.AppSettings["ArchivesSpaceUrl"]}{x.id}", Text = x.title + $" ({x.ead_id})" }); return(View(avm)); }
public ActionResult AsSubjectReport() { var subjectLinks = AsRepo.GetLinkedSubjects(); var authority = GetSubjectAllDocs(); var csv = new StringBuilder(); csv.AppendLine("sid,rid,repo,subject,type,found,auth_id_exists"); foreach (var link in subjectLinks) { Row found; var match = false; var authMatch = false; var repo = link.repo_id == 2 ? "Archives" : link.repo_id == 3 ? "Manuscripts" : "Laupus"; if (link.type == "topical") { found = authority.Find(x => x.doc.authoritativeLabel == link.subject && x.doc.topic.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && link.type == "topical"); if (found != null) { match = true; authMatch = link.authority_id == found.doc._id; } csv.AppendLine($"{link.id},{link.resource_id},{repo},\"{link.subject}\",{link.type},{match},{authMatch}"); } else if (link.type == "geographic") { found = authority.Find(x => x.doc.authoritativeLabel == link.subject && x.doc.geographic.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && link.type == "geographic"); if (found != null) { match = true; authMatch = link.authority_id == found.doc._id; } csv.AppendLine($"{link.id},{link.resource_id},{repo},\"{link.subject}\",{link.type},{match},{authMatch}"); } else if (link.type == "personal") { found = authority.Find(x => x.doc.authoritativeLabel == link.subject && x.doc.personalNameSubject.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && link.type == "personal"); if (found != null) { match = true; authMatch = link.authority_id == found.doc._id; } csv.AppendLine($"{link.id},{link.resource_id},{repo},\"{link.subject}\",{link.type},{match},{authMatch}"); } else if (link.type == "family") { found = authority.Find(x => x.doc.authoritativeLabel == link.subject && x.doc.familyNameSubject.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && link.type == "family"); if (found != null) { match = true; authMatch = link.authority_id == found.doc._id; } csv.AppendLine($"{link.id},{link.resource_id},{repo},\"{link.subject}\",{link.type},{match},{authMatch}"); } else if (link.type == "corporate") { found = authority.Find(x => x.doc.authoritativeLabel == link.subject && x.doc.corporateNameSubject.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && link.type == "corporate"); if (found != null) { match = true; authMatch = link.authority_id == found.doc._id; } csv.AppendLine($"{link.id},{link.resource_id},{repo},\"{link.subject}\",{link.type},{match},{authMatch}"); } else if (link.type == "meeting") { found = authority.Find(x => x.doc.authoritativeLabel == link.subject && x.doc.meeting.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && link.type == "meeting"); if (found != null) { match = true; authMatch = link.authority_id == found.doc._id; } csv.AppendLine($"{link.id},{link.resource_id},{repo},\"{link.subject}\",{link.type},{match},{authMatch}"); } else if (link.type == "uniform_title") { found = authority.Find(x => x.doc.authoritativeLabel == link.subject && x.doc.uniformTitle.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && link.type == "uniform_title"); if (found != null) { match = true; authMatch = link.authority_id == found.doc._id; } csv.AppendLine($"{link.id},{link.resource_id},{repo},\"{link.subject}\",{link.type},{match},{authMatch}"); } else { csv.AppendLine($"{link.id},{link.resource_id},{repo},\"{link.subject}\",{link.type},{match},{authMatch}"); } } System.IO.File.WriteAllText(Server.MapPath("~/Download/AsSubjectReport.csv"), csv.ToString(), Encoding.UTF8); return(Redirect("~/Download/AsSubjectReport.csv")); }
public ActionResult SubjectAuthorities() { var authority = GetSubjectAllDocs(); var subjectLinks = AsRepo.GetLinkedSubjects(); var csv = new StringBuilder(); csv.AppendLine("id,authoritativeLabel,externalAuthorityUri,archivesSpaceUri,type,rid,found,auth_id_exists"); SubjectGroup found; foreach (var result in authority) { var match = false; var authMatch = false; //if (result.doc._id == "3bd545c1c309a78af7f2d6875928aabe") //{ // var test = "adf"; // test.ToUpper(); //} if (!result.doc._id.StartsWith("_")) { var externalUri = string.Empty; if (result.doc.externalAuthorityUri != null) { externalUri = result.doc.externalAuthorityUri; } else if (result.doc.substrings != null && result.doc.substrings.Count > 0) { externalUri = string.Join(";", result.doc.substrings?.Select(x => x.externalAuthorityUri)); } if (result.doc.archivesSpaceRelations != null) { foreach (var item in result.doc.archivesSpaceRelations) { found = subjectLinks.Find(x => x.subject == result.doc.authoritativeLabel && x.resource_id.ToString() == item.Replace("http://archivesspace.ecu.edu/resources/", "")); if (found != null) { match = true; authMatch = found.authority_id == result.doc._id; } csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},{result.doc.type},{item.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); } } //if (result.doc.topic != null) //{ // foreach (var topic in result.doc.topic) // { // //if (result.doc.authoritativeLabel.StartsWith("Inchon")) // //{ // // var x = 33; // //} // found = subjectLinks.Find(x => x.subject == result.doc.authoritativeLabel && x.resource_id.ToString() == topic.Replace("http://archivesspace.ecu.edu/resources/", ""));// && x.type == "topical"); // if (found != null) // { // match = true; // authMatch = found.authority_id == result.doc._id; // } // csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},topical,{topic.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); // } //} //if (result.doc.geographic != null) //{ // foreach (var item in result.doc.geographic) // { // found = subjectLinks.Find(x => x.subject == result.doc.authoritativeLabel && x.resource_id.ToString() == item.Replace("http://archivesspace.ecu.edu/resources/", ""));// && x.type == "geographic"); // if (found != null) // { // match = true; // authMatch = found.authority_id == result.doc._id; // } // csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},geographic,{item.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); // } //} //if (result.doc.personalNameSubject != null) //{ // foreach (var item in result.doc.personalNameSubject) // { // found = subjectLinks.Find(x => x.subject == result.doc.authoritativeLabel && x.resource_id.ToString() == item.Replace("http://archivesspace.ecu.edu/resources/", ""));// && x.type == "personal"); // if (found != null) // { // match = true; // authMatch = found.authority_id == result.doc._id; // } // csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},personal,{item.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); // } //} //if (result.doc.familyNameSubject != null) //{ // foreach (var item in result.doc.familyNameSubject) // { // found = subjectLinks.Find(x => x.subject == result.doc.authoritativeLabel && x.resource_id.ToString() == item.Replace("http://archivesspace.ecu.edu/resources/", ""));// && x.type == "family"); // if (found != null) // { // match = true; // authMatch = found.authority_id == result.doc._id; // } // csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},family,{item.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); // } //} //if (result.doc.corporateNameSubject != null) //{ // foreach (var item in result.doc.corporateNameSubject) // { // found = subjectLinks.Find(x => x.subject == result.doc.authoritativeLabel && x.resource_id.ToString() == item.Replace("http://archivesspace.ecu.edu/resources/", ""));// && x.type == "corporate"); // if (found != null) // { // match = true; // authMatch = found.authority_id == result.doc._id; // } // csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},corporate,{item.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); // } //} //if (result.doc.meeting != null) //{ // foreach (var item in result.doc.meeting) // { // found = subjectLinks.Find(x => x.subject == result.doc.authoritativeLabel && x.resource_id.ToString() == item.Replace("http://archivesspace.ecu.edu/resources/", ""));// && x.type == "meeting"); // if (found != null) // { // match = true; // authMatch = found.authority_id == result.doc._id; // } // csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},meeting,{item.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); // } //} //if (result.doc.uniformTitle != null) //{ // foreach (var item in result.doc.uniformTitle) // { // found = subjectLinks.Find(x => x.subject == result.doc.authoritativeLabel && x.resource_id.ToString() == item.Replace("http://archivesspace.ecu.edu/resources/", ""));// && x.type == "uniform_title"); // if (found != null) // { // match = true; // authMatch = found.authority_id == result.doc._id; // } // csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},title,{item.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); // } //} } } System.IO.File.WriteAllText(Server.MapPath("~/Download/subjectAuths.csv"), csv.ToString(), Encoding.UTF8); return(Redirect("~/Download/subjectAuths.csv")); }
public ActionResult NameAuthorities() { var results = GetNameAllDocs(); var agentLinks = AsRepo.GetLinkedAgents(); var csv = new StringBuilder(); csv.AppendLine("id,authoritativeLabel,externalAuthorityUri,archivesSpaceUri,type,rid,found,auth_id_exists"); foreach (var result in results) { AgentGroup found; var match = false; var authMatch = false; if (!result.doc._id.StartsWith("_")) { var externalUri = string.Empty; if (result.doc.externalAuthorityUri != null) { externalUri = result.doc.externalAuthorityUri; } else if (result.doc.substrings != null && result.doc.substrings.Count > 0) { externalUri = string.Join(";", result.doc.substrings?.Select(x => x.externalAuthorityUri)); } if (result.doc.creator != null) { foreach (var item in result.doc.creator) { found = agentLinks.Find(x => x.person_name == result.doc.authoritativeLabel && x.resource_id.ToString() == item.Replace("http://archivesspace.ecu.edu/resources/", "") && x.role_id == 878); if (found != null) { match = true; authMatch = result.doc._id == found.authority_id; } csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},creator,{item.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); } } if (result.doc.source != null) { foreach (var item in result.doc.source) { found = agentLinks.Find(x => x.person_name == result.doc.authoritativeLabel && x.resource_id.ToString() == item.Replace("http://archivesspace.ecu.edu/resources/", "") && x.role_id == 879); if (found != null) { match = true; authMatch = result.doc._id == found.authority_id; } csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",{externalUri},{result.doc.archivesSpaceUri},source,{item.Replace("http://archivesspace.ecu.edu/resources/", "")},{match},{authMatch}"); } } if (result.doc.creator == null && result.doc.source == null) { csv.AppendLine($"{result.doc._id},\"{result.doc.authoritativeLabel}\",,{result.doc.archivesSpaceUri},,FALSE,{match},{authMatch}"); } } } System.IO.File.WriteAllText(Server.MapPath("~/Download/nameAuths.csv"), csv.ToString(), Encoding.UTF8); return(Redirect("~/Download/nameAuths.csv")); }
public ActionResult AsNameReport() { var agentLinks = AsRepo.GetLinkedAgents(); var authority = GetNameAllDocs(); var csv = new StringBuilder(); csv.AppendLine("resource_id,repo,role_id,agent_person_id,person_name,agent_family_id,family_name,agent_corporate_entity_id,corp_name,found,auth_id_exists"); foreach (var link in agentLinks) { Row found = null; var match = false; var authMatch = false; var repo = link.repo_id == 2 ? "Archives" : link.repo_id == 3 ? "Manuscripts" : "Laupus"; if (link.agent_corporate_entity_id != null) { if (link.role_id == 878) { found = authority.Find(x => x.doc.authoritativeLabel == link.corp_name && x.doc.corporateNameCreator != null && x.doc.corporateNameCreator.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && x.doc.archivesSpaceUri == "http://archivesspace.ecu.edu/agents/agent_corporate_entity/" + link.agent_corporate_entity_id); } else if (link.role_id == 879) { found = authority.Find(x => x.doc.authoritativeLabel == link.corp_name && x.doc.corporateNameSource != null && x.doc.corporateNameSource.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && x.doc.archivesSpaceUri == "http://archivesspace.ecu.edu/agents/agent_corporate_entity/" + link.agent_corporate_entity_id); } if (found != null) { match = true; authMatch = found.doc._id == link.authority_id; } csv.AppendLine($"{link.resource_id},{repo},{link.role_id},{link.agent_person_id},\"{link.person_name}\",{link.agent_family_id},\"{link.family_name}\",{link.agent_corporate_entity_id},\"{link.corp_name}\",{match},{authMatch}"); } else if (link.agent_person_id != null) { if (link.role_id == 878) { found = authority.Find(x => x.doc.authoritativeLabel == link.person_name && x.doc.personalNameCreator != null && x.doc.personalNameCreator.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && x.doc.archivesSpaceUri == "http://archivesspace.ecu.edu/agents/agent_person/" + link.agent_person_id); } else if (link.role_id == 879) { found = authority.Find(x => x.doc.authoritativeLabel == link.person_name && x.doc.personalNameSource != null && x.doc.personalNameSource.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && x.doc.archivesSpaceUri == "http://archivesspace.ecu.edu/agents/agent_person/" + link.agent_person_id); } if (found != null) { match = true; authMatch = found.doc._id == link.authority_id; } csv.AppendLine($"{link.resource_id},{repo},{link.role_id},{link.agent_person_id},\"{link.person_name}\",{link.agent_family_id},\"{link.family_name}\",{link.agent_corporate_entity_id},\"{link.corp_name}\",{match},{authMatch}"); } else if (link.agent_family_id != null) { if (link.role_id == 878) { found = authority.Find(x => x.doc.authoritativeLabel == link.family_name && x.doc.familyNameCreator != null && x.doc.familyNameCreator.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && x.doc.archivesSpaceUri == "http://archivesspace.ecu.edu/agents/agent_family/" + link.agent_family_id); } else if (link.role_id == 879) { found = authority.Find(x => x.doc.authoritativeLabel == link.family_name && x.doc.familyNameSource != null && x.doc.familyNameSource.Contains("http://archivesspace.ecu.edu/resources/" + link.resource_id) && x.doc.archivesSpaceUri == "http://archivesspace.ecu.edu/agents/agent_family/" + link.agent_family_id); } if (found != null) { match = true; authMatch = found.doc._id == link.authority_id; } csv.AppendLine($"{link.resource_id},{repo},{link.role_id},{link.agent_person_id},\"{link.person_name}\",{link.agent_family_id},\"{link.family_name}\",{link.agent_corporate_entity_id},\"{link.corp_name}\",{match},{authMatch}"); } } System.IO.File.WriteAllText(Server.MapPath("~/Download/AsNameReport.csv"), csv.ToString(), Encoding.UTF8); return(Redirect("~/Download/AsNameReport.csv")); }
public ActionResult AssignNameAsResource(AssignViewModel avm, string asButton) { asButton = Regex.Replace(asButton, @" \(...\)", ""); var resources = AsRepo.GetArchivesSpaceResources(); var found = resources.FirstOrDefault(x => x.title + $" ({x.ead_id})" == avm.NewAsResource); if (found == null) { TempData["Message"] = "Resource Not Found"; } else { var fullDoc = GetNameDocByUuid(avm.Doc._id); if (asButton == "Creator") { if (fullDoc.creator == null) { fullDoc.creator = new List <string>(); } fullDoc.creator.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); } else if (asButton == "Source") { if (fullDoc.source == null) { fullDoc.source = new List <string>(); } fullDoc.source.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); } //if (asButton == "PersonalNameCreator") //{ // if (fullDoc.personalNameCreator == null) { fullDoc.personalNameCreator = new List<string>(); } // fullDoc.personalNameCreator.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "PersonalNameSource") //{ // if (fullDoc.personalNameSource == null) { fullDoc.personalNameSource = new List<string>(); } // fullDoc.personalNameSource.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "FamilyNameCreator") //{ // if (fullDoc.familyNameCreator == null) { fullDoc.familyNameCreator = new List<string>(); } // fullDoc.familyNameCreator.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "FamilyNameSource") //{ // if (fullDoc.familyNameSource == null) { fullDoc.familyNameSource = new List<string>(); } // fullDoc.familyNameSource.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "CorporateNameCreator") //{ // if (fullDoc.corporateNameCreator == null) { fullDoc.corporateNameCreator = new List<string>(); } // fullDoc.corporateNameCreator.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "CorporateNameSource") //{ // if (fullDoc.corporateNameSource == null) { fullDoc.corporateNameSource = new List<string>(); } // fullDoc.corporateNameSource.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} SaveNameDoc(fullDoc); TempData["Message"] = "Resource Added"; } return(RedirectToAction("Name", new { id = avm.Doc._id })); }
public ActionResult AssignSubjectAsResource(AssignViewModel avm, string asButton) { asButton = Regex.Replace(asButton, @" \(...\)", ""); var resources = AsRepo.GetArchivesSpaceResources(); var found = resources.FirstOrDefault(x => x.title + $" ({x.ead_id})" == avm.NewAsResource); if (found == null) { TempData["Message"] = "Resource Not Found"; } else { var fullDoc = GetSubjectDocByUuid(avm.Doc._id); if (asButton == "Assign") { if (fullDoc.archivesSpaceRelations == null) { fullDoc.archivesSpaceRelations = new List <string>(); } fullDoc.archivesSpaceRelations.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); } //if (asButton == "Topic") //{ // if (fullDoc.topic == null) { fullDoc.topic = new List<string>(); } // fullDoc.topic.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "Geographic") //{ // if (fullDoc.geographic == null) { fullDoc.geographic = new List<string>(); } // fullDoc.geographic.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "PersonalName") //{ // if (fullDoc.personalNameSubject == null) { fullDoc.personalNameSubject = new List<string>(); } // fullDoc.personalNameSubject.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "FamilyName") //{ // if (fullDoc.familyNameSubject == null) { fullDoc.familyNameSubject = new List<string>(); } // fullDoc.familyNameSubject.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "CorporateName") //{ // if (fullDoc.corporateNameSubject == null) { fullDoc.corporateNameSubject = new List<string>(); } // fullDoc.corporateNameSubject.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "MeetingName") //{ // if (fullDoc.meeting == null) { fullDoc.meeting = new List<string>(); } // fullDoc.meeting.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} //else if (asButton == "UniformTitle") //{ // if (fullDoc.uniformTitle == null) { fullDoc.uniformTitle = new List<string>(); } // fullDoc.uniformTitle.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id); //} SaveSubjectDoc(fullDoc); TempData["Message"] = "Resource Added"; } return(RedirectToAction("Subject", new { id = avm.Doc._id })); }
public ActionResult Name(EditViewModel evm) { var svm = new SearchViewModel(); svm.Term = evm.Doc.authoritativeLabel; var search = SearchNameByLabel(svm); // if one doc with same id -- no change // if one doc with different id -- another auth has this value if (search.Results.Docs.Count == 1) { if (search.Results.Docs[0]._id != evm.Doc._id) { TempData["Message"] = $"No changes made: existing authority found with provided label: <a href='" + Url.Action("Name", new { id = search.Results.Docs[0]._id }) + "'>" + search.Results.Docs[0]._id + "</a>"; return(RedirectToAction("Name", new { id = evm.Doc._id })); } } // if more than one -- another auth and a problem else if (search.Results.Docs.Count > 1) { TempData["Message"] = $"No changes made: existing authority found with provided label: <a href='" + Url.Action("Name", new { id = search.Results.Docs[0]._id }) + "'>" + search.Results.Docs[0]._id + "</a>"; return(RedirectToAction("Name", new { id = evm.Doc._id })); } // if zero -- update var fullDoc = GetNameDocByUuid(evm.Doc._id); fullDoc.authoritativeLabel = evm.Doc.authoritativeLabel.Trim(); fullDoc.externalAuthorityUri = evm.Doc.externalAuthorityUri?.Trim(); fullDoc.archivesSpaceUri = evm.Doc.archivesSpaceUri?.Trim(); fullDoc.type = evm.Doc.type; // wipe substrings if externalAuthorityUri has value if (fullDoc.externalAuthorityUri != null) { fullDoc.substrings = null; } else { fullDoc.substrings = evm.Doc.substrings; if (evm.NewLabel != null && evm.NewUri != null) { if (fullDoc.substrings == null) { fullDoc.substrings = new List <Substring>(); } fullDoc.substrings.Add(new Substring(evm.NewLabel, evm.NewUri)); } } SaveNameDoc(fullDoc); TempData["Message"] = "Authority saved"; if (fullDoc.archivesSpaceUri != null) { if (fullDoc.archivesSpaceUri.Contains("agent_person")) { AsRepo.UpdateAsName(int.Parse(fullDoc.archivesSpaceUri.Replace("http://archivesspace.ecu.edu/agents/agent_person/", "")), fullDoc.authoritativeLabel); } else if (fullDoc.archivesSpaceUri.Contains("agent_corporate_entity")) { AsRepo.UpdateAsCorporate(int.Parse(fullDoc.archivesSpaceUri.Replace("http://archivesspace.ecu.edu/agents/agent_corporate_entity/", "")), fullDoc.authoritativeLabel); } else if (fullDoc.archivesSpaceUri.Contains("agent_family")) { AsRepo.UpdateAsFamily(int.Parse(fullDoc.archivesSpaceUri.Replace("http://archivesspace.ecu.edu/agents/agent_family/", "")), fullDoc.authoritativeLabel); } TempData["Message"] += ", AS name updated"; } return(RedirectToAction("Name", new { id = evm.Doc._id })); }
public ActionResult Subject() { ViewBag.ArchivesSpaceUrl = ConfigurationManager.AppSettings["ArchivesSpaceUrl"]; return(View(AsRepo.GetArchivesSpaceResources())); }