/// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary> /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param> public override void Save_To_Bib(SobekCM_Item Bib) { // Get the list of classifications List <Classification_Info> workableList = new List <Classification_Info>(); if (Bib.Bib_Info.Classifications_Count > 0) { workableList.AddRange(Bib.Bib_Info.Classifications); } // Collect all the strings from the form Dictionary <string, string> classifications = new Dictionary <string, string>(); Dictionary <string, string> authorities = new Dictionary <string, string>(); string[] getKeys = HttpContext.Current.Request.Form.AllKeys; foreach (string thisKey in getKeys) { if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_text") == 0) { string term = HttpContext.Current.Request.Form[thisKey]; string index = thisKey.Replace(html_element_name.Replace("_", "") + "_text", ""); classifications[index] = term; } if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_select") == 0) { string scheme = HttpContext.Current.Request.Form[thisKey]; string index = thisKey.Replace(html_element_name.Replace("_", "") + "_select", ""); authorities[index] = scheme.ToLower(); } } // Step through and add each classification foreach (string index in classifications.Keys) { Classification_Info newClassification = new Classification_Info { Classification = classifications[index] }; if (authorities.ContainsKey(index)) { newClassification.Authority = authorities[index]; } // Was there a match already? bool found = false; foreach (Classification_Info thisClassification in workableList) { if ((newClassification.Classification.Trim() == thisClassification.Classification.Trim()) && (newClassification.Authority == thisClassification.Authority.Trim())) { newClassification = thisClassification; found = true; break; } } // If found, remove from existing list if (found) { workableList.Remove(newClassification); } // Add to bib Bib.Bib_Info.Add_Classification(newClassification); } // Remove any remaining classifications foreach (Classification_Info deleteClassification in workableList) { Bib.Bib_Info.Remove_Classification(deleteClassification); } }
/// <summary> Reads the MODS-compliant section of XML and stores the data in the provided digital resource </summary> /// <param name="r"> XmlTextReader from which to read the MODS data </param> /// <param name="package"> Digital resource object to save the data to </param> public static void Read_MODS_Info(XmlReader r, Bibliographic_Info thisBibInfo, SobekCM_Item Return_Item) { while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "METS:mdWrap") || (r.Name == "mdWrap") || (r.Name == "mods"))) return; if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:abstract": case "abstract": Abstract_Info thisAbstract = new Abstract_Info(); if (r.MoveToAttribute("ID")) thisAbstract.ID = r.Value; if (r.MoveToAttribute("type")) thisAbstract.Type = r.Value; if (r.MoveToAttribute("displayLabel")) thisAbstract.Display_Label = r.Value; if (r.MoveToAttribute("lang")) thisAbstract.Language = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { thisAbstract.Abstract_Text = r.Value; thisBibInfo.Add_Abstract(thisAbstract); } break; case "mods:accessCondition": case "accessCondition": if (r.MoveToAttribute("ID")) thisBibInfo.Access_Condition.ID = r.Value; if (r.MoveToAttribute("type")) thisBibInfo.Access_Condition.Type = r.Value; if (r.MoveToAttribute("displayLabel")) thisBibInfo.Access_Condition.Display_Label = r.Value; if (r.MoveToAttribute("lang")) thisBibInfo.Access_Condition.Language = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Access_Condition.Text = r.Value; } break; case "mods:classification": case "classification": Classification_Info thisClassification = new Classification_Info(); if (r.MoveToAttribute("edition")) thisClassification.Edition = r.Value; if (r.MoveToAttribute("authority")) thisClassification.Authority = r.Value; if (r.MoveToAttribute("displayLabel")) thisClassification.Display_Label = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { thisClassification.Classification = r.Value; thisBibInfo.Add_Classification(thisClassification); } break; case "mods:identifier": case "identifier": Identifier_Info thisIdentifier = new Identifier_Info(); if (r.MoveToAttribute("type")) thisIdentifier.Type = r.Value; if (r.MoveToAttribute("displayLabel")) thisIdentifier.Display_Label = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { thisIdentifier.Identifier = r.Value; thisBibInfo.Add_Identifier(thisIdentifier); } break; case "mods:genre": case "genre": Genre_Info thisGenre = new Genre_Info(); if (r.MoveToAttribute("ID")) thisGenre.ID = r.Value; if (r.MoveToAttribute("authority")) thisGenre.Authority = r.Value; if (r.MoveToAttribute("lang")) thisGenre.Language = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { thisGenre.Genre_Term = r.Value; thisBibInfo.Add_Genre(thisGenre); } break; case "mods:language": case "language": string language_text = String.Empty; string language_rfc_code = String.Empty; string language_iso_code = String.Empty; string language_id = String.Empty; if (r.MoveToAttribute("ID")) language_id = r.Value; while (r.Read()) { if ((r.NodeType == XmlNodeType.Element) && ((r.Name == "mods:languageTerm") || (r.Name == "languageTerm"))) { if (r.MoveToAttribute("type")) { switch (r.Value) { case "code": if (r.MoveToAttribute("authority")) { if (r.Value == "rfc3066") { r.Read(); if (r.NodeType == XmlNodeType.Text) { language_rfc_code = r.Value; } } else if (r.Value == "iso639-2b") { r.Read(); if (r.NodeType == XmlNodeType.Text) { language_iso_code = r.Value; } } } break; case "text": r.Read(); if (r.NodeType == XmlNodeType.Text) { language_text = r.Value; } // Quick check for a change we started in 2010 if (language_text == "governmental publication") language_text = "government publication"; break; default: r.Read(); if (r.NodeType == XmlNodeType.Text) { language_text = r.Value; } break; } } else { r.Read(); if (r.NodeType == XmlNodeType.Text) { language_text = r.Value; } } } if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:language") || (r.Name == "language"))) { break; } } if ((language_text.Length > 0) || (language_rfc_code.Length > 0) || (language_iso_code.Length > 0)) { thisBibInfo.Add_Language(language_text, language_iso_code, language_rfc_code); } break; case "mods:location": case "location": while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:location") || (r.Name == "location"))) break; if (r.NodeType == XmlNodeType.Element) { if ((r.Name == "mods:physicalLocation") || (r.Name == "physicalLocation")) { if (r.MoveToAttribute("type")) { if (r.Value == "code") { r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Location.Holding_Code = r.Value; } } } else { r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Location.Holding_Name = r.Value; } } } if ((r.Name == "mods:url") || (r.Name == "url")) { // TEST if (r.MoveToAttribute("access")) { if (r.Value == "object in context") { r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Location.PURL = r.Value; } } } else { string url_displayLabel = r.GetAttribute("displayLabel"); string url_note = r.GetAttribute("note"); r.Read(); if (r.NodeType == XmlNodeType.Text) { if ((url_displayLabel != null) && (url_displayLabel == "Finding Guide")) { if (url_note != null) { thisBibInfo.Location.EAD_Name = url_note; } thisBibInfo.Location.EAD_URL = r.Value; } else { if (url_displayLabel != null) { thisBibInfo.Location.Other_URL_Display_Label = url_displayLabel; } if (url_note != null) { thisBibInfo.Location.Other_URL_Note = url_note; } thisBibInfo.Location.Other_URL = r.Value; } } } } } } break; case "mods:name": case "name": Name_Info tempNewName = read_name_object(r); if (tempNewName.Main_Entity) thisBibInfo.Main_Entity_Name = tempNewName; else { bool donor = false; foreach (Name_Info_Role role in tempNewName.Roles) { if ((role.Role == "donor") || (role.Role == "honoree") || (role.Role == "endowment") || (role.Role == "collection")) { donor = true; break; } } if (donor) { thisBibInfo.Donor = tempNewName; } else { thisBibInfo.Add_Named_Entity(tempNewName); } } break; case "mods:note": case "note": Note_Info newNote = new Note_Info(); if (r.MoveToAttribute("ID")) newNote.ID = r.Value; if (r.MoveToAttribute("type")) newNote.Note_Type_String = r.Value; if (r.MoveToAttribute("displayLabel")) newNote.Display_Label = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { newNote.Note = r.Value; thisBibInfo.Add_Note(newNote); } break; case "mods:Origin_Info": case "Origin_Info": case "mods:originInfo": case "originInfo": while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:Origin_Info") || (r.Name == "Origin_Info") || (r.Name == "mods:originInfo") || (r.Name == "originInfo"))) break; if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:publisher": case "publisher": r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.Add_Publisher(r.Value); thisBibInfo.Add_Publisher(r.Value); } break; case "mods:place": case "place": string place_text = String.Empty; string place_marc = String.Empty; string place_iso = String.Empty; while ((r.Read()) && (!(((r.Name == "mods:place") || (r.Name == "place")) && (r.NodeType == XmlNodeType.EndElement)))) { if ((r.NodeType == XmlNodeType.Element) && ((r.Name == "mods:placeTerm") || (r.Name == "placeTerm"))) { if ((r.MoveToAttribute("type")) && (r.Value == "code")) { if (r.MoveToAttribute("authority")) { switch (r.Value) { case "marccountry": r.Read(); if (r.NodeType == XmlNodeType.Text) { place_marc = r.Value; } break; case "iso3166": r.Read(); if (r.NodeType == XmlNodeType.Text) { place_iso = r.Value; } break; } } } else { r.Read(); if (r.NodeType == XmlNodeType.Text) { place_text = r.Value; } } } } if ((place_text.Length > 0) || (place_marc.Length > 0) || (place_iso.Length > 0)) { thisBibInfo.Origin_Info.Add_Place(place_text, place_marc, place_iso); } break; case "mods:dateIssued": case "dateIssued": if ((r.MoveToAttribute("encoding")) && (r.Value == "marc")) { if (r.MoveToAttribute("point")) { if (r.Value == "start") { r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.MARC_DateIssued_Start = r.Value; } } else if (r.Value == "end") { r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.MARC_DateIssued_End = r.Value; } } } else { r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.MARC_DateIssued = r.Value; } } } else { r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.Date_Issued = r.Value; } } break; case "mods:dateCreated": case "dateCreated": r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.Date_Created = r.Value; } break; case "mods:copyrightDate": case "copyrightDate": r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.Date_Copyrighted = r.Value; } break; case "mods:dateOther": case "dateOther": if ((r.MoveToAttribute("type")) && (r.Value == "reprint")) { r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.Date_Reprinted = r.Value; } } break; case "mods:edition": case "edition": r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.Edition = r.Value; } break; case "mods:frequency": case "frequency": string freq_authority = String.Empty; if (r.MoveToAttribute("authority")) freq_authority = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.Add_Frequency(r.Value, freq_authority); } break; case "mods:issuance": case "issuance": r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Origin_Info.Add_Issuance(r.Value); } break; } } } break; case "mods:physicalDescription": case "physicalDescription": read_physical_description(r, thisBibInfo.Original_Description); break; case "mods:recordInfo": case "recordInfo": while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:recordInfo") || (r.Name == "recordInfo"))) { break; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:recordCreationDate": case "recordCreationDate": if ((r.MoveToAttribute("encoding")) && (r.Value == "marc")) { r.Read(); thisBibInfo.Record.MARC_Creation_Date = r.Value; } break; case "mods:recordIdentifier": case "recordIdentifier": string source = String.Empty; if (r.MoveToAttribute("source")) { thisBibInfo.Record.Main_Record_Identifier.Type = r.Value; } r.Read(); thisBibInfo.Record.Main_Record_Identifier.Identifier = r.Value; break; case "mods:recordOrigin": case "recordOrigin": r.Read(); thisBibInfo.Record.Record_Origin = r.Value; break; case "mods:descriptionStandard": case "descriptionStandard": r.Read(); thisBibInfo.Record.Description_Standard = r.Value; break; case "mods:recordContentSource": case "recordContentSource": if (r.MoveToAttribute("authority")) { if (r.Value == "marcorg") { r.Read(); thisBibInfo.Record.Add_MARC_Record_Content_Sources(r.Value); } } else { r.Read(); thisBibInfo.Source.Statement = r.Value; } break; case "mods:languageOfCataloging": case "languageOfCataloging": string cat_language_text = String.Empty; string cat_language_rfc_code = String.Empty; string cat_language_iso_code = String.Empty; string cat_language_id = String.Empty; while (r.Read()) { if ((r.NodeType == XmlNodeType.Element) && ((r.Name == "mods:languageTerm") || (r.Name == "languageTerm"))) { if (r.MoveToAttribute("ID")) cat_language_id = r.Value; if (r.MoveToAttribute("type")) { switch (r.Value) { case "code": if (r.MoveToAttribute("authority")) { if (r.Value == "rfc3066") { r.Read(); if (r.NodeType == XmlNodeType.Text) { cat_language_rfc_code = r.Value; } } else if (r.Value == "iso639-2b") { r.Read(); if (r.NodeType == XmlNodeType.Text) { cat_language_iso_code = r.Value; } } } break; case "text": r.Read(); if (r.NodeType == XmlNodeType.Text) { cat_language_text = r.Value; } break; default: r.Read(); if (r.NodeType == XmlNodeType.Text) { cat_language_text = r.Value; } break; } } else { r.Read(); if (r.NodeType == XmlNodeType.Text) { cat_language_text = r.Value; } } } if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:languageOfCataloging") || (r.Name == "languageOfCataloging"))) { break; } } if ((cat_language_text.Length > 0) || (cat_language_rfc_code.Length > 0) || (cat_language_iso_code.Length > 0)) { Language_Info newCatLanguage = new Language_Info(cat_language_text, cat_language_iso_code, cat_language_rfc_code); thisBibInfo.Record.Add_Catalog_Language(newCatLanguage); } break; } } } break; case "mods:relatedItem": case "relatedItem": string relatedItemType = String.Empty; if (r.MoveToAttribute("type")) relatedItemType = r.Value.ToLower(); switch (relatedItemType) { case "original": while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:relatedItem") || (r.Name == "relatedItem"))) break; if (r.NodeType == XmlNodeType.Element) { if ((r.Name == "mods:physicalDescription") || (r.Name == "physicalDescription")) { read_physical_description(r, thisBibInfo.Original_Description); } } } break; case "series": string part_type = String.Empty; string part_caption = String.Empty; string part_number = String.Empty; while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:relatedItem") || (r.Name == "mods:relatedItem"))) { break; } if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:detail") || (r.Name == "detail"))) { try { switch (part_type) { case "Enum1": thisBibInfo.Series_Part_Info.Enum1 = part_caption; thisBibInfo.Series_Part_Info.Enum1_Index = Convert.ToInt32(part_number); break; case "Enum2": thisBibInfo.Series_Part_Info.Enum2 = part_caption; thisBibInfo.Series_Part_Info.Enum2_Index = Convert.ToInt32(part_number); break; case "Enum3": thisBibInfo.Series_Part_Info.Enum3 = part_caption; thisBibInfo.Series_Part_Info.Enum3_Index = Convert.ToInt32(part_number); break; case "Enum4": thisBibInfo.Series_Part_Info.Enum4 = part_caption; thisBibInfo.Series_Part_Info.Enum4_Index = Convert.ToInt32(part_number); break; case "Year": thisBibInfo.Series_Part_Info.Year = part_caption; thisBibInfo.Series_Part_Info.Year_Index = Convert.ToInt32(part_number); break; case "Month": thisBibInfo.Series_Part_Info.Month = part_caption; thisBibInfo.Series_Part_Info.Month_Index = Convert.ToInt32(part_number); break; case "Day": thisBibInfo.Series_Part_Info.Day = part_caption; thisBibInfo.Series_Part_Info.Day_Index = Convert.ToInt32(part_number); break; } } catch { } part_type = String.Empty; part_caption = String.Empty; part_number = String.Empty; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:titleInfo": case "titleInfo": thisBibInfo.SeriesTitle = read_title_object(r); break; case "mods:detail": case "detail": if (r.MoveToAttribute("type")) { part_type = r.Value; } break; case "mods:caption": case "caption": r.Read(); if (r.NodeType == XmlNodeType.Text) { part_caption = r.Value; } break; case "mods:number": case "number": r.Read(); if (r.NodeType == XmlNodeType.Text) { part_number = r.Value; } break; } } } break; default: Related_Item_Info newRelated = new Related_Item_Info(); thisBibInfo.Add_Related_Item(newRelated); switch (relatedItemType) { case "preceding": newRelated.Relationship = Related_Item_Type_Enum.preceding; break; case "succeeding": newRelated.Relationship = Related_Item_Type_Enum.succeeding; break; case "otherVersion": newRelated.Relationship = Related_Item_Type_Enum.otherVersion; break; case "otherFormat": newRelated.Relationship = Related_Item_Type_Enum.otherFormat; break; case "host": newRelated.Relationship = Related_Item_Type_Enum.host; break; } if (r.MoveToAttribute("ID")) newRelated.ID = r.Value; while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:relatedItem") || (r.Name == "relatedItem"))) { break; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:titleInfo": case "titleInfo": newRelated.Set_Main_Title(read_title_object(r)); break; case "mods:identifier": case "identifier": Identifier_Info thisRIdentifier = new Identifier_Info(); if (r.MoveToAttribute("type")) thisRIdentifier.Type = r.Value; if (r.MoveToAttribute("displayLabel")) thisRIdentifier.Display_Label = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { thisRIdentifier.Identifier = r.Value; newRelated.Add_Identifier(thisRIdentifier); } break; case "mods:name": case "name": newRelated.Add_Name(read_name_object(r)); break; case "mods:note": case "note": Note_Info newRNote = new Note_Info(); if (r.MoveToAttribute("ID")) newRNote.ID = r.Value; if (r.MoveToAttribute("type")) newRNote.Note_Type_String = r.Value; if (r.MoveToAttribute("displayLabel")) newRNote.Display_Label = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { newRNote.Note = r.Value; newRelated.Add_Note(newRNote); } break; case "mods:url": case "url": if (r.MoveToAttribute("displayLabel")) newRelated.URL_Display_Label = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { newRelated.URL = r.Value; } break; case "mods:publisher": case "publisher": r.Read(); if (r.NodeType == XmlNodeType.Text) { newRelated.Publisher = r.Value; } break; case "mods:recordIdentifier": case "recordIdentifier": if (r.MoveToAttribute("source")) { if ((r.Value == "ufdc") || (r.Value == "dloc") || (r.Value.ToLower() == "sobekcm")) { r.Read(); if (r.NodeType == XmlNodeType.Text) { newRelated.SobekCM_ID = r.Value; } } } break; case "mods:dateIssued": case "dateIssued": if (r.MoveToAttribute("point")) { if (r.Value == "start") { r.Read(); if (r.NodeType == XmlNodeType.Text) { newRelated.Start_Date = r.Value; } } else if (r.Value == "end") { r.Read(); if (r.NodeType == XmlNodeType.Text) { newRelated.End_Date = r.Value; } } } break; } } } break; } break; case "mods:subject": case "subject": read_subject_object(r, thisBibInfo); break; case "mods:targetAudience": case "targetAudience": TargetAudience_Info newTarget = new TargetAudience_Info(); if (r.MoveToAttribute("ID")) newTarget.ID = r.Value; if (r.MoveToAttribute("authority")) newTarget.Authority = r.Value; r.Read(); if (r.NodeType == XmlNodeType.Text) { newTarget.Audience = r.Value; thisBibInfo.Add_Target_Audience(newTarget); } break; case "mods:tableOfContents": case "tableOfContents": r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.TableOfContents = r.Value; } break; case "mods:titleInfo": case "titleInfo": Title_Info thisTitle = read_title_object(r); if (thisTitle.Title_Type == Title_Type_Enum.UNSPECIFIED) thisBibInfo.Main_Title = thisTitle; else thisBibInfo.Add_Other_Title(thisTitle); break; case "mods:typeOfResource": case "typeOfResource": r.Read(); if (r.NodeType == XmlNodeType.Text) { thisBibInfo.Type.Add_Uncontrolled_Type(r.Value); } break; case "mods:extension": case "extension": string schema = String.Empty; string alias = String.Empty; if (r.HasAttributes) { for (int i = 0; i < r.AttributeCount; i++) { r.MoveToAttribute(i); if (r.Name.IndexOf("xmlns") == 0) { alias = r.Name.Replace("xmlns:", ""); schema = r.Value; break; } } } if (schema.IndexOf("vra.xsd") > 0) { read_vra_core_extensions(r, thisBibInfo, alias, Return_Item); } break; } } } }
/// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary> /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param> public override void Save_To_Bib(SobekCM_Item Bib) { // Get the list of classifications List<Classification_Info> workableList = new List<Classification_Info>(); if (Bib.Bib_Info.Classifications_Count > 0) { workableList.AddRange(Bib.Bib_Info.Classifications); } // Collect all the strings from the form Dictionary<string, string> classifications = new Dictionary<string, string>(); Dictionary<string, string> authorities = new Dictionary<string, string>(); string[] getKeys = HttpContext.Current.Request.Form.AllKeys; foreach (string thisKey in getKeys) { if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_text") == 0) { string term = HttpContext.Current.Request.Form[thisKey]; string index = thisKey.Replace(html_element_name.Replace("_", "") + "_text", ""); classifications[index] = term; } if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_select") == 0) { string scheme = HttpContext.Current.Request.Form[thisKey]; string index = thisKey.Replace(html_element_name.Replace("_", "") + "_select", ""); authorities[index] = scheme.ToLower(); } } // Step through and add each classification foreach (string index in classifications.Keys) { Classification_Info newClassification = new Classification_Info {Classification = classifications[index]}; if (authorities.ContainsKey(index)) { newClassification.Authority = authorities[index]; } // Was there a match already? bool found = false; foreach (Classification_Info thisClassification in workableList) { if ((newClassification.Classification.Trim() == thisClassification.Classification.Trim()) && (newClassification.Authority == thisClassification.Authority.Trim())) { newClassification = thisClassification; found = true; break; } } // If found, remove from existing list if (found) workableList.Remove(newClassification); // Add to bib Bib.Bib_Info.Add_Classification(newClassification); } // Remove any remaining classifications foreach (Classification_Info deleteClassification in workableList) { Bib.Bib_Info.Remove_Classification(deleteClassification); } }
/// <summary> Adds a new classification to this item </summary> /// <param name="Classification">Classification</param> /// <param name="Authority">Authority</param> /// <returns>Newly built and added classification object, or or if there is a similar classification added already, the matching classification</returns> public Classification_Info Add_Classification(string Classification, string Authority) { if (classifications == null) classifications = new List<Classification_Info>(); Classification_Info newClassification = new Classification_Info(Classification, Authority); if (!classifications.Contains(newClassification)) { classifications.Add(newClassification); return newClassification; } else { Classification_Info returnClassification = classifications.Find(newClassification.Equals); if (newClassification.Authority.Length > 0) returnClassification.Authority = newClassification.Authority; if (newClassification.Display_Label.Length > 0) returnClassification.Display_Label = newClassification.Display_Label; if (newClassification.Edition.Length > 0) returnClassification.Edition = newClassification.Edition; return returnClassification; } }
/// <summary> Adds a new classifications to this item </summary> /// <param name="Classification">Classification</param> /// <returns>Newly built and added classification object, or or if there is a similar classification added already, the matching classification</returns> public Classification_Info Add_Classification(Classification_Info Classification) { if (classifications == null) classifications = new List<Classification_Info>(); if (!classifications.Contains(Classification)) { classifications.Add(Classification); return Classification; } else { Classification_Info returnClassification = classifications.Find(Classification.Equals); if (Classification.Authority.Length > 0) returnClassification.Authority = Classification.Authority; if (Classification.Display_Label.Length > 0) returnClassification.Display_Label = Classification.Display_Label; if (Classification.Edition.Length > 0) returnClassification.Edition = Classification.Edition; return returnClassification; } }
/// <summary> Remove an existing classification from this digital resource </summary> /// <param name="Classification"> Classification to remove </param> public void Remove_Classification(Classification_Info Classification) { if (classifications == null) return; else classifications.Remove(Classification); }